Commit 8fec4cd8 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

split gimp_dialog_factories_toggle() into two functions. Turned the

2005-12-29  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpdialogfactory.[ch]: split
	gimp_dialog_factories_toggle() into two functions. Turned the
	tri-state into a simple boolean state. Dialogs are now either
	shown or not, without treating the toolbox any special.

	* app/actions/dialogs-commands.c
	* app/display/gimpdisplayshell-callbacks.c: changed accordingly.
parent e341b0e3
2005-12-29 Sven Neumann <sven@gimp.org>
* app/widgets/gimpdialogfactory.[ch]: split
gimp_dialog_factories_toggle() into two functions. Turned the
tri-state into a simple boolean state. Dialogs are now either
shown or not, without treating the toolbox any special.
* app/actions/dialogs-commands.c
* app/display/gimpdisplayshell-callbacks.c: changed accordingly.
2005-12-29 Sven Neumann <sven@gimp.org>
* app/main.c: added --license command-line option.
......
......@@ -156,7 +156,7 @@ dialogs_show_toolbox (void)
}
else
{
gimp_dialog_factories_toggle (global_toolbox_factory, TRUE);
gimp_dialog_factory_show_toolbox (global_toolbox_factory);
}
}
......
......@@ -1208,12 +1208,9 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
}
else
{
GimpDialogFactory *dialog_factory;
gimp_dialog_factories_toggle ();
dialog_factory = gimp_dialog_factory_from_name ("toolbox");
/* Hide or show all dialogs */
gimp_dialog_factories_toggle (dialog_factory, FALSE);
gdk_window_focus (canvas->window, time);
}
return_val = TRUE;
......
......@@ -50,14 +50,6 @@
#endif
typedef enum
{
GIMP_DIALOG_SHOW_ALL,
GIMP_DIALOG_HIDE_ALL,
GIMP_DIALOG_SHOW_TOOLBOX
} GimpDialogShowState;
static void gimp_dialog_factory_dispose (GObject *object);
static void gimp_dialog_factory_finalize (GObject *object);
......@@ -997,6 +989,19 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
}
}
void
gimp_dialog_factory_show_toolbox (GimpDialogFactory *toolbox_factory)
{
GtkWidget *toolbox;
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (toolbox_factory));
toolbox = gimp_dialog_factory_get_toolbox (toolbox_factory);
if (toolbox)
gtk_window_present (GTK_WINDOW (toolbox));
}
void
gimp_dialog_factories_session_save (GimpConfigWriter *writer)
{
......@@ -1036,60 +1041,28 @@ gimp_dialog_factories_session_clear (void)
}
void
gimp_dialog_factories_toggle (GimpDialogFactory *toolbox_factory,
gboolean ensure_visibility)
gimp_dialog_factories_toggle (void)
{
static GimpDialogShowState toggle_state = GIMP_DIALOG_SHOW_ALL;
static gboolean doing_update = FALSE;
static gboolean shown = TRUE; /* FIXME */
GimpDialogFactoryClass *factory_class;
if (doing_update)
return;
if (ensure_visibility && toggle_state != GIMP_DIALOG_HIDE_ALL)
{
GtkWidget *toolbox = gimp_dialog_factory_get_toolbox (toolbox_factory);
if (toolbox)
gtk_window_present (GTK_WINDOW (toolbox));
return;
}
doing_update = TRUE;
factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
switch (toggle_state)
if (shown)
{
case GIMP_DIALOG_SHOW_ALL:
toggle_state = GIMP_DIALOG_HIDE_ALL;
shown = FALSE;
g_hash_table_foreach (factory_class->factories,
(GHFunc) gimp_dialog_factories_hide_foreach,
NULL);
break;
case GIMP_DIALOG_HIDE_ALL:
toggle_state = GIMP_DIALOG_SHOW_TOOLBOX;
gimp_dialog_factories_show_foreach (GIMP_OBJECT (toolbox_factory)->name,
toolbox_factory,
NULL);
break;
case GIMP_DIALOG_SHOW_TOOLBOX:
toggle_state = GIMP_DIALOG_SHOW_ALL;
}
else
{
shown = TRUE;
g_hash_table_foreach (factory_class->factories,
(GHFunc) gimp_dialog_factories_show_foreach,
NULL);
default:
break;
}
doing_update = FALSE;
}
void
......
......@@ -153,13 +153,14 @@ void gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
void gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
GtkWidget *dialog);
void gimp_dialog_factory_show_toolbox (GimpDialogFactory *toolbox_factory);
void gimp_dialog_factories_session_save (GimpConfigWriter *writer);
void gimp_dialog_factories_session_restore (void);
void gimp_dialog_factories_session_clear (void);
void gimp_dialog_factories_toggle (GimpDialogFactory *toolbox_factory,
gboolean ensure_visibility);
void gimp_dialog_factories_toggle (void);
void gimp_dialog_factories_set_busy (void);
void gimp_dialog_factories_unset_busy (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment