summaryrefslogtreecommitdiffhomepage
path: root/mixgtk
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-27 22:50:00 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-27 22:50:00 +0000
commit97f14dfaa15c1d36128848d1deb67fec0e688233 (patch)
tree214bbafbc10c0217c2da866bd2f4a652ea7f495f /mixgtk
parent2f0c4e4aa87209194f8fcb1296525a032d00f8c6 (diff)
downloadmdk-97f14dfaa15c1d36128848d1deb67fec0e688233.tar.gz
mdk-97f14dfaa15c1d36128848d1deb67fec0e688233.tar.bz2
hot split swap
Diffstat (limited to 'mixgtk')
-rw-r--r--mixgtk/mixgtk.c8
-rw-r--r--mixgtk/mixgtk.glade20
-rw-r--r--mixgtk/mixgtk.h2
-rw-r--r--mixgtk/mixgtk_fontsel.c5
-rw-r--r--mixgtk/mixgtk_fontsel.h2
-rw-r--r--mixgtk/mixgtk_mixal.c8
-rw-r--r--mixgtk/mixgtk_mixvm.c2
-rw-r--r--mixgtk/mixgtk_widgets.c5
-rw-r--r--mixgtk/mixgtk_widgets.h2
-rw-r--r--mixgtk/mixgtk_wm.c41
10 files changed, 56 insertions, 39 deletions
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c
index 2f60cb2..b94f819 100644
--- a/mixgtk/mixgtk.c
+++ b/mixgtk/mixgtk.c
@@ -39,11 +39,11 @@ static const gchar *SPLIT_ARG_ = "-s";
static const gchar *SPLIT_LONG_ARG_ = "--s";
gboolean
-mixgtk_restart (gboolean split)
+mixgtk_restart (void)
{
mix_vm_t *vm;
- if (!mixgtk_widget_factory_init (split))
+ if (!mixgtk_widget_factory_init ())
{
g_error ("Unable to initialise application: missing glade file");
return FALSE;
@@ -86,7 +86,7 @@ mixgtk_restart (gboolean split)
mixgtk_input_init ();
mixgtk_colorsel_init ();
- mixgtk_fontsel_load_defaults (split);
+ mixgtk_fontsel_load_defaults ();
gtk_widget_show (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN));
mixgtk_mixvm_update_vm_widgets ();
@@ -120,7 +120,7 @@ mixgtk_init (int argc, char *argv[])
gtk_init (&argc, &argv);
- return mixgtk_restart (split);
+ return mixgtk_restart ();
}
/* main loop */
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index 3d6c39b..f2c8773 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -361,7 +361,7 @@
</signal>
<label>_Split windows</label>
<active>False</active>
- <always_show_toggle>False</always_show_toggle>
+ <always_show_toggle>True</always_show_toggle>
</widget>
<widget>
@@ -394,7 +394,7 @@
</signal>
<label>Save on _exit</label>
<active>False</active>
- <always_show_toggle>False</always_show_toggle>
+ <always_show_toggle>True</always_show_toggle>
</widget>
</widget>
</widget>
@@ -1507,8 +1507,8 @@
<last_modification_time>Sun, 24 Jun 2001 12:24:52 GMT</last_modification_time>
</signal>
<label>_MIX</label>
- <active>True</active>
- <always_show_toggle>False</always_show_toggle>
+ <active>False</active>
+ <always_show_toggle>True</always_show_toggle>
</widget>
<widget>
@@ -1520,8 +1520,8 @@
<last_modification_time>Sun, 24 Jun 2001 12:25:14 GMT</last_modification_time>
</signal>
<label>MI_XAL</label>
- <active>True</active>
- <always_show_toggle>False</always_show_toggle>
+ <active>False</active>
+ <always_show_toggle>True</always_show_toggle>
</widget>
<widget>
@@ -1533,8 +1533,8 @@
<last_modification_time>Sun, 24 Jun 2001 12:25:38 GMT</last_modification_time>
</signal>
<label>_Devices</label>
- <active>True</active>
- <always_show_toggle>False</always_show_toggle>
+ <active>False</active>
+ <always_show_toggle>True</always_show_toggle>
</widget>
</widget>
</widget>
@@ -1759,7 +1759,7 @@
</signal>
<label>_Split windows</label>
<active>True</active>
- <always_show_toggle>False</always_show_toggle>
+ <always_show_toggle>True</always_show_toggle>
</widget>
<widget>
@@ -1792,7 +1792,7 @@
</signal>
<label>Save on _exit</label>
<active>False</active>
- <always_show_toggle>False</always_show_toggle>
+ <always_show_toggle>True</always_show_toggle>
</widget>
</widget>
</widget>
diff --git a/mixgtk/mixgtk.h b/mixgtk/mixgtk.h
index e26302e..ed9973f 100644
--- a/mixgtk/mixgtk.h
+++ b/mixgtk/mixgtk.h
@@ -37,7 +37,7 @@ mixgtk_init (int argc, char *argv[]);
/* restart the gui */
extern gboolean
-mixgtk_restart (gboolean split);
+mixgtk_restart (void);
/* enter the main mixgtk loop */
extern void
diff --git a/mixgtk/mixgtk_fontsel.c b/mixgtk/mixgtk_fontsel.c
index a72c5e7..7a9b33e 100644
--- a/mixgtk/mixgtk_fontsel.c
+++ b/mixgtk/mixgtk_fontsel.c
@@ -98,11 +98,14 @@ change_font_ (mixgtk_widget_id_t widget)
}
void
-mixgtk_fontsel_load_defaults (gboolean split)
+mixgtk_fontsel_load_defaults (void)
{
int i;
const gchar *font = NULL;
+ gboolean split = mixgtk_config_is_split ();
+
fontsel_dialog_ = NULL;
+
if (winfo_) g_hash_table_destroy (winfo_);
winfo_ = g_hash_table_new (NULL, NULL);
dialog_ids_ = split? dialog_ids_split_ : dialog_ids_no_split_;
diff --git a/mixgtk/mixgtk_fontsel.h b/mixgtk/mixgtk_fontsel.h
index 705b369..af09c15 100644
--- a/mixgtk/mixgtk_fontsel.h
+++ b/mixgtk/mixgtk_fontsel.h
@@ -30,7 +30,7 @@
/* load default (configured) fonts */
extern void
-mixgtk_fontsel_load_defaults (gboolean split);
+mixgtk_fontsel_load_defaults (void);
/* set a widget's font */
extern void
diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c
index d79e601..eb8c60d 100644
--- a/mixgtk/mixgtk_mixal.c
+++ b/mixgtk/mixgtk_mixal.c
@@ -130,9 +130,11 @@ init_color_ (GdkColor *c, const gchar *name)
gboolean
mixgtk_mixal_init (mix_vm_t *vm, mixgtk_dialog_id_t top)
{
+ static gboolean restart = FALSE;
int i,j;
g_return_val_if_fail (vm != NULL, FALSE);
+ vm_ = vm;
clist_ = GTK_CLIST (mixgtk_widget_factory_get (top, MIXGTK_WIDGET_MIXAL));
g_return_val_if_fail (clist_ != NULL, FALSE);
@@ -162,10 +164,8 @@ mixgtk_mixal_init (mix_vm_t *vm, mixgtk_dialog_id_t top)
}
}
- if (!vm_)
- vm_ = vm;
- else
- mixgtk_mixal_load_file ();
+ if (restart) mixgtk_mixal_load_file ();
+ else restart = TRUE;
return TRUE;
}
diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c
index 2b13f18..f929be1 100644
--- a/mixgtk/mixgtk_mixvm.c
+++ b/mixgtk/mixgtk_mixvm.c
@@ -172,6 +172,8 @@ mixgtk_mixvm_init (mix_vm_t *vm, mixgtk_dialog_id_t top)
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (on_mem_adj_change_), NULL);
+ goto_ = NULL;
+
return TRUE;
}
diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c
index 95fd6f0..be4d4ae 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -130,12 +130,13 @@ init_about_ (void)
/* create a new factory from an xml glade file */
gboolean
-mixgtk_widget_factory_init (gboolean split)
+mixgtk_widget_factory_init (void)
{
const gchar *glade_file = GLADE_FILE;
const gchar *local_glade_file = LOCAL_GLADE_FILE;
FILE *f;
-
+ gboolean split = mixgtk_config_is_split ();
+
about_ = NULL;
if (!file_)
diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h
index 6e2f633..1fafc71 100644
--- a/mixgtk/mixgtk_widgets.h
+++ b/mixgtk/mixgtk_widgets.h
@@ -78,7 +78,7 @@ typedef enum {
/* create a new factory from an xml glade file */
extern gboolean
-mixgtk_widget_factory_init (gboolean split);
+mixgtk_widget_factory_init (void);
/* get a dialog */
extern GtkWidget *
diff --git a/mixgtk/mixgtk_wm.c b/mixgtk/mixgtk_wm.c
index 0804cc3..ce6a6c5 100644
--- a/mixgtk/mixgtk_wm.c
+++ b/mixgtk/mixgtk_wm.c
@@ -50,14 +50,17 @@ static GtkCheckMenuItem *split_menu_ = NULL;
static const gchar *VIEW_YES_ = "Yes";
static const gchar *VIEW_NO_ = "No";
+/* flag marking that we are inside a restart process */
+static gboolean restart_ = FALSE;
+
gboolean
mixgtk_wm_init (void)
{
+ static gboolean restart = FALSE;
split_ = mixgtk_config_is_split ();
if (split_)
{
gint i;
- const gchar *view;
split_menu_ = GTK_CHECK_MENU_ITEM
(mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN,
SPLIT_MENU_NAME_));
@@ -72,12 +75,16 @@ mixgtk_wm_init (void)
(mixgtk_widget_factory_get_child_by_name
(MIXGTK_MAIN, infos_[i].menu_name));
g_return_val_if_fail (infos_[i].menu, FALSE);
- view = mixgtk_config_get (infos_[i].config_key);
- infos_[i].visible = !view || !strcmp (VIEW_YES_, view);
+ if (!restart)
+ {
+ const gchar *view = mixgtk_config_get (infos_[i].config_key);
+ infos_[i].visible = !view || !strcmp (VIEW_YES_, view);
+ }
if (infos_[i].visible) gtk_widget_show (infos_[i].widget);
gtk_check_menu_item_set_active (infos_[i].menu, infos_[i].visible);
}
}
+ restart = TRUE;
return TRUE;
}
@@ -98,7 +105,7 @@ void
mixgtk_wm_hide_window (mixgtk_window_id_t w)
{
g_return_if_fail (w < INF_NO_);
- if (infos_[w].visible)
+ if (infos_[w].visible && !restart_)
{
infos_[w].visible = FALSE;
gtk_check_menu_item_set_active (infos_[w].menu, FALSE);
@@ -111,18 +118,22 @@ mixgtk_wm_hide_window (mixgtk_window_id_t w)
void
on_view_toggled (GtkCheckMenuItem *item)
{
- gint k;
- for (k = 0; k < INF_NO_; ++k)
- if (item == infos_[k].menu) break;
- g_return_if_fail (k < INF_NO_);
- if (item->active)
- mixgtk_wm_show_window (k);
- else
- mixgtk_wm_hide_window (k);
+ if (!restart_)
+ {
+ gint k;
+ for (k = 0; k < INF_NO_; ++k)
+ if (item == infos_[k].menu) break;
+ g_return_if_fail (k < INF_NO_);
+ if (item->active)
+ mixgtk_wm_show_window (k);
+ else
+ mixgtk_wm_hide_window (k);
+ mixgtk_config_update (infos_[k].config_key,
+ (item->active)? VIEW_YES_ : VIEW_NO_);
+ infos_[k].visible = item->active;
+ }
}
-static gboolean restart_ = FALSE;
-
void
on_split_windows_toggled (GtkCheckMenuItem *item)
{
@@ -146,8 +157,8 @@ on_main_window_destroy (GtkWidget *w, gpointer data)
{
if (restart_)
{
+ mixgtk_restart ();
restart_ = FALSE;
- mixgtk_restart (mixgtk_config_is_split ());
}
else gtk_main_quit ();
}