added a horrible hack that sets the paned's position after the first

2004-06-01  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo.c (gimp_session_info_restore): added
	a horrible hack that sets the paned's position after the first
	"size-allocate" after "map". Makes position remembering work for
	the toolbox and fixes bug #142697.

	* app/widgets/gimpdockable.[ch]: added new function
	gimp_dockable_set_tab_style()

	* app/actions/dockable-commands.c (dockable_tab_style_cmd_callback)
	* app/widgets/gimpsessioninfo.c (gimp_session_info_restore):
	use gimp_dockable_set_tab_style().
This commit is contained in:
Michael Natterer 2004-06-01 12:31:44 +00:00 committed by Michael Natterer
parent d2df109399
commit f826916828
5 changed files with 78 additions and 21 deletions

View File

@ -1,3 +1,17 @@
2004-06-01 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpsessioninfo.c (gimp_session_info_restore): added
a horrible hack that sets the paned's position after the first
"size-allocate" after "map". Makes position remembering work for
the toolbox and fixes bug #142697.
* app/widgets/gimpdockable.[ch]: added new function
gimp_dockable_set_tab_style()
* app/actions/dockable-commands.c (dockable_tab_style_cmd_callback)
* app/widgets/gimpsessioninfo.c (gimp_session_info_restore):
use gimp_dockable_set_tab_style().
2004-06-01 Michael Natterer <mitch@gimp.org>
* app/widgets/gimptoolbox.c (toolbox_area_notify): removed

View File

@ -256,7 +256,7 @@ dockable_tab_style_cmd_callback (GtkAction *action,
{
GtkWidget *tab_widget;
dockable->tab_style = tab_style;
gimp_dockable_set_tab_style (dockable, tab_style);
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);

View File

@ -702,6 +702,37 @@ gimp_dockable_get_aux_info (GimpDockable *dockable)
return NULL;
}
void
gimp_dockable_set_tab_style (GimpDockable *dockable,
GimpTabStyle tab_style)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
if (GTK_BIN (dockable)->child &&
! GIMP_DOCKED_GET_INTERFACE (GTK_BIN (dockable)->child)->get_preview)
{
switch (tab_style)
{
case GIMP_TAB_STYLE_PREVIEW:
tab_style = GIMP_TAB_STYLE_ICON;
break;
case GIMP_TAB_STYLE_PREVIEW_NAME:
tab_style = GIMP_TAB_STYLE_ICON_BLURB;
break;
case GIMP_TAB_STYLE_PREVIEW_BLURB:
tab_style = GIMP_TAB_STYLE_ICON_BLURB;
break;
default:
break;
}
}
dockable->tab_style = tab_style;
}
GtkWidget *
gimp_dockable_get_tab_widget (GimpDockable *dockable,
GimpContext *context,

View File

@ -73,6 +73,8 @@ void gimp_dockable_set_aux_info (GimpDockable *dockable,
GList *aux_info);
GList * gimp_dockable_get_aux_info (GimpDockable *dockable);
void gimp_dockable_set_tab_style (GimpDockable *dockable,
GimpTabStyle tab_style);
GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable,
GimpContext *context,
GimpTabStyle tab_style,

View File

@ -543,6 +543,31 @@ gimp_session_info_deserialize (GScanner *scanner,
return token;
}
static void
gimp_session_info_paned_size_allocate (GtkWidget *paned,
GtkAllocation *allocation,
gpointer data)
{
g_signal_handlers_disconnect_by_func (paned,
gimp_session_info_paned_size_allocate,
data);
gtk_paned_set_position (GTK_PANED (paned), GPOINTER_TO_INT (data));
}
static void
gimp_session_info_paned_map (GtkWidget *paned,
gpointer data)
{
g_signal_handlers_disconnect_by_func (paned,
gimp_session_info_paned_map,
data);
g_signal_connect_after (paned, "size-allocate",
G_CALLBACK (gimp_session_info_paned_size_allocate),
data);
}
void
gimp_session_info_restore (GimpSessionInfo *info,
GimpDialogFactory *factory)
@ -620,25 +645,8 @@ gimp_session_info_restore (GimpSessionInfo *info,
if (! dockable)
continue;
if (! GIMP_DOCKED_GET_INTERFACE (GTK_BIN (dockable)->child)->get_preview)
{
switch (dockable_info->tab_style)
{
case GIMP_TAB_STYLE_PREVIEW:
dockable_info->tab_style = GIMP_TAB_STYLE_ICON;
break;
case GIMP_TAB_STYLE_PREVIEW_NAME:
dockable_info->tab_style = GIMP_TAB_STYLE_ICON_BLURB;
break;
case GIMP_TAB_STYLE_PREVIEW_BLURB:
dockable_info->tab_style = GIMP_TAB_STYLE_ICON_BLURB;
break;
default:
break;
}
}
GIMP_DOCKABLE (dockable)->tab_style = dockable_info->tab_style;
gimp_dockable_set_tab_style (GIMP_DOCKABLE (dockable),
dockable_info->tab_style);
if (dockable_info->aux_info)
session_info_set_aux_info (dockable, dockable_info->aux_info);
@ -666,7 +674,9 @@ gimp_session_info_restore (GimpSessionInfo *info,
GtkPaned *paned = GTK_PANED (dockbook->parent);
if (dockbook == paned->child2)
gtk_paned_set_position (paned, book_info->position);
g_signal_connect_after (paned, "map",
G_CALLBACK (gimp_session_info_paned_map),
GINT_TO_POINTER (book_info->position));
}
}