added "dockable_added", "dockable_removed" and "dockable_reordered"

2003-05-03  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdockbook.[ch]: added "dockable_added",
	"dockable_removed" and "dockable_reordered" signals and emit them.

	* app/widgets/gimpimagedock.[ch]: implement GimpDock::book_added()
	and GimpDock::book_removed(). Connect to the above signals and
	update the window title as proposed in bug #111971. Idle-update
	the title so subsequent changes are compressed. Fixes bug #111971.

	* app/widgets/gimpdock.c: cleanup.
This commit is contained in:
Michael Natterer 2003-05-03 11:59:44 +00:00 committed by Michael Natterer
parent c18b6554b1
commit a51bff58f9
8 changed files with 375 additions and 97 deletions

View File

@ -1,3 +1,15 @@
2003-05-03 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdockbook.[ch]: added "dockable_added",
"dockable_removed" and "dockable_reordered" signals and emit them.
* app/widgets/gimpimagedock.[ch]: implement GimpDock::book_added()
and GimpDock::book_removed(). Connect to the above signals and
update the window title as proposed in bug #111971. Idle-update
the title so subsequent changes are compressed. Fixes bug #111971.
* app/widgets/gimpdock.c: cleanup.
2003-05-03 Michael Natterer <mitch@gimp.org>
* app/gui/dialogs.c

View File

@ -146,7 +146,7 @@ gimp_dock_class_init (GimpDockClass *klass)
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_DOCKBOOK);
GIMP_TYPE_DOCKBOOK);
dock_signals[BOOK_REMOVED] =
g_signal_new ("book_removed",
@ -156,7 +156,7 @@ gimp_dock_class_init (GimpDockClass *klass)
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_DOCKBOOK);
GIMP_TYPE_DOCKBOOK);
object_class->destroy = gimp_dock_destroy;
@ -214,8 +214,7 @@ gimp_dock_destroy (GtkObject *object)
dock->context = NULL;
}
if (GTK_OBJECT_CLASS (parent_class))
GTK_OBJECT_CLASS (parent_class)->destroy (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -314,9 +313,7 @@ gimp_dock_construct (GimpDock *dock,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
dock->dialog_factory = dialog_factory;
dock->context = context;
g_object_ref (dock->context);
dock->context = g_object_ref (context);
return TRUE;
}
@ -331,7 +328,6 @@ gimp_dock_add (GimpDock *dock,
g_return_if_fail (GIMP_IS_DOCK (dock));
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (dockable->dockbook == NULL);
dockbook = GIMP_DOCKBOOK (dock->dockbooks->data);
@ -345,9 +341,7 @@ gimp_dock_remove (GimpDock *dock,
{
g_return_if_fail (GIMP_IS_DOCK (dock));
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (dockable->dockbook != NULL);
g_return_if_fail (dockable->dockbook->dock != NULL);
g_return_if_fail (dockable->dockbook->dock == dock);
gimp_dockbook_remove (dockable->dockbook, dockable);
@ -362,7 +356,6 @@ gimp_dock_add_book (GimpDock *dock,
g_return_if_fail (GIMP_IS_DOCK (dock));
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
g_return_if_fail (dockbook->dock == NULL);
old_length = g_list_length (dock->dockbooks);

View File

@ -30,6 +30,7 @@
#include "widgets-types.h"
#include "core/gimpcontext.h"
#include "core/gimpmarshal.h"
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
@ -48,6 +49,15 @@
#define MENU_WIDGET_SPACING 4
enum
{
DOCKABLE_ADDED,
DOCKABLE_REMOVED,
DOCKABLE_REORDERED,
LAST_SIGNAL
};
static void gimp_dockbook_class_init (GimpDockbookClass *klass);
static void gimp_dockbook_init (GimpDockbook *dockbook);
@ -87,6 +97,8 @@ static gboolean gimp_dockbook_tab_drag_drop (GtkWidget *widget,
static GtkNotebookClass *parent_class = NULL;
static guint dockbook_signals[LAST_SIGNAL] = { 0 };
static GtkTargetEntry dialog_target_table[] =
{
GIMP_TARGET_DIALOG
@ -132,10 +144,44 @@ gimp_dockbook_class_init (GimpDockbookClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_dockbook_finalize;
dockbook_signals[DOCKABLE_ADDED] =
g_signal_new ("dockable_added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDockbookClass, dockable_added),
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_DOCKABLE);
widget_class->style_set = gimp_dockbook_style_set;
widget_class->drag_drop = gimp_dockbook_drag_drop;
dockbook_signals[DOCKABLE_REMOVED] =
g_signal_new ("dockable_removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDockbookClass, dockable_removed),
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_DOCKABLE);
dockbook_signals[DOCKABLE_REORDERED] =
g_signal_new ("dockable_reordered",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDockbookClass, dockable_reordered),
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_DOCKABLE);
object_class->finalize = gimp_dockbook_finalize;
widget_class->style_set = gimp_dockbook_style_set;
widget_class->drag_drop = gimp_dockbook_drag_drop;
klass->dockable_added = NULL;
klass->dockable_removed = NULL;
klass->dockable_reordered = NULL;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("tab_border",
@ -391,6 +437,8 @@ gimp_dockbook_add (GimpDockbook *dockbook,
dockable->dockbook = dockbook;
gimp_dockable_set_context (dockable, dockbook->dock->context);
g_signal_emit (dockbook, dockbook_signals[DOCKABLE_ADDED], 0, dockable);
}
void
@ -401,22 +449,24 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (dockable->dockbook != NULL);
g_return_if_fail (dockable->dockbook == dockbook);
g_object_ref (dockable);
dockable->dockbook = NULL;
gimp_dockable_set_context (dockable, NULL);
gtk_container_remove (GTK_CONTAINER (dockbook), GTK_WIDGET (dockable));
g_signal_emit (dockbook, dockbook_signals[DOCKABLE_REMOVED], 0, dockable);
g_object_unref (dockable);
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
if (! g_list_length (children))
{
gimp_dock_remove_book (dockbook->dock, dockbook);
}
gimp_dock_remove_book (dockbook->dock, dockbook);
g_list_free (children);
}
@ -752,6 +802,10 @@ gimp_dockbook_tab_drag_drop (GtkWidget *widget,
GTK_WIDGET (src_dockable),
dest_index);
g_signal_emit (src_dockable->dockbook,
dockbook_signals[DOCKABLE_REORDERED], 0,
src_dockable);
return TRUE;
}
}

View File

@ -47,6 +47,13 @@ struct _GimpDockbook
struct _GimpDockbookClass
{
GtkNotebookClass parent_class;
void (* dockable_added) (GimpDockbook *dockbook,
GimpDockable *dockable);
void (* dockable_removed) (GimpDockbook *dockbook,
GimpDockable *dockable);
void (* dockable_reordered) (GimpDockbook *dockbook,
GimpDockable *dockable);
};

View File

@ -35,6 +35,7 @@
#include "gimpdialogfactory.h"
#include "gimpimagedock.h"
#include "gimpcontainermenuimpl.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimp-intl.h"
@ -44,25 +45,35 @@
#define DEFAULT_MENU_PREVIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static void gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock);
static void gimp_image_dock_update_title (GimpImageDock *dock);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static GimpDockClass *parent_class = NULL;
@ -101,15 +112,20 @@ gimp_image_dock_class_init (GimpImageDockClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpDockClass *dock_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
dock_class = GIMP_DOCK_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_image_dock_destroy;
object_class->destroy = gimp_image_dock_destroy;
widget_class->style_set = gimp_image_dock_style_set;
widget_class->style_set = gimp_image_dock_style_set;
dock_class->book_added = gimp_image_dock_book_added;
dock_class->book_removed = gimp_image_dock_book_removed;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("minimal_width",
@ -131,10 +147,11 @@ gimp_image_dock_init (GimpImageDock *dock)
{
GtkWidget *hbox;
dock->image_container = NULL;
dock->display_container = NULL;
dock->show_image_menu = FALSE;
dock->auto_follow_active = TRUE;
dock->image_container = NULL;
dock->display_container = NULL;
dock->show_image_menu = FALSE;
dock->auto_follow_active = TRUE;
dock->update_title_idle_id = 0;
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (GIMP_DOCK (dock)->main_vbox), hbox,
@ -170,6 +187,12 @@ gimp_image_dock_destroy (GtkObject *object)
dock = GIMP_IMAGE_DOCK (object);
if (dock->update_title_idle_id)
{
g_source_remove (dock->update_title_idle_id);
dock->update_title_idle_id = 0;
}
/* remove the image menu and the auto button manually here because
* of weird cross-connections with GimpDock's context
*/
@ -181,8 +204,7 @@ gimp_image_dock_destroy (GtkObject *object)
dock->option_menu->parent);
}
if (GTK_OBJECT_CLASS (parent_class))
GTK_OBJECT_CLASS (parent_class)->destroy (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -232,6 +254,38 @@ gimp_image_dock_style_set (GtkWidget *widget,
focus_line_width));
}
static void
gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook)
{
g_signal_connect (dockbook, "dockable_added",
G_CALLBACK (gimp_image_dock_dockbook_changed),
dock);
g_signal_connect (dockbook, "dockable_removed",
G_CALLBACK (gimp_image_dock_dockbook_changed),
dock);
g_signal_connect (dockbook, "dockable_reordered",
G_CALLBACK (gimp_image_dock_dockbook_changed),
dock);
gimp_image_dock_update_title (GIMP_IMAGE_DOCK (dock));
GIMP_DOCK_CLASS (parent_class)->book_added (dock, dockbook);
}
static void
gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook)
{
g_signal_handlers_disconnect_by_func (dockbook,
gimp_image_dock_dockbook_changed,
dock);
gimp_image_dock_update_title (GIMP_IMAGE_DOCK (dock));
GIMP_DOCK_CLASS (parent_class)->book_added (dock, dockbook);
}
GtkWidget *
gimp_image_dock_new (GimpDialogFactory *dialog_factory,
GimpContainer *image_container,
@ -239,22 +293,15 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
{
GimpImageDock *image_dock;
GimpContext *context;
gchar *title;
gint menu_preview_width;
gint menu_preview_height;
static gint dock_counter = 1;
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (image_container), NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (display_container), NULL);
image_dock = g_object_new (GIMP_TYPE_IMAGE_DOCK, NULL);
title = g_strdup_printf (_("Gimp Dock #%d"), dock_counter++);
gtk_window_set_title (GTK_WINDOW (image_dock), title);
g_free (title);
image_dock->image_container = image_container;
image_dock->display_container = display_container;
@ -332,6 +379,68 @@ gimp_image_dock_set_show_image_menu (GimpImageDock *image_dock,
image_dock->show_image_menu = show ? TRUE : FALSE;
}
static void
gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock)
{
gimp_image_dock_update_title (dock);
}
static gboolean
gimp_image_dock_update_title_idle (GimpImageDock *image_dock)
{
GString *title;
GList *list;
title = g_string_new (NULL);
for (list = GIMP_DOCK (image_dock)->dockbooks;
list;
list = g_list_next (list))
{
GimpDockbook *dockbook = list->data;
GList *children;
GList *child;
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
for (child = children; child; child = g_list_next (child))
{
GimpDockable *dockable = child->data;
g_string_append (title, dockable->short_name);
if (g_list_next (child))
g_string_append (title, ", ");
}
g_list_free (children);
if (g_list_next (list))
g_string_append (title, " | ");
}
gtk_window_set_title (GTK_WINDOW (image_dock), title->str);
g_string_free (title, TRUE);
image_dock->update_title_idle_id = 0;
return FALSE;
}
static void
gimp_image_dock_update_title (GimpImageDock *image_dock)
{
if (image_dock->update_title_idle_id)
g_source_remove (image_dock->update_title_idle_id);
image_dock->update_title_idle_id =
g_idle_add ((GSourceFunc) gimp_image_dock_update_title_idle,
image_dock);
}
static void
gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
@ -342,9 +451,7 @@ gimp_image_dock_factory_display_changed (GimpContext *context,
image_dock = GIMP_IMAGE_DOCK (dock);
if (gdisp && image_dock->auto_follow_active)
{
gimp_context_set_display (dock->context, gdisp);
}
gimp_context_set_display (dock->context, gdisp);
}
static void
@ -356,12 +463,9 @@ gimp_image_dock_factory_image_changed (GimpContext *context,
image_dock = GIMP_IMAGE_DOCK (dock);
/* won't do anything if we already set the display above */
if (gimage && image_dock->auto_follow_active)
{
/* won't do anything if we already set the display above
*/
gimp_context_set_image (dock->context, gimage);
}
gimp_context_set_image (dock->context, gimage);
}
static void

View File

@ -49,6 +49,8 @@ struct _GimpImageDock
GtkWidget *option_menu;
GtkWidget *menu;
GtkWidget *auto_button;
guint update_title_idle_id;
};
struct _GimpImageDockClass

View File

@ -35,6 +35,7 @@
#include "gimpdialogfactory.h"
#include "gimpimagedock.h"
#include "gimpcontainermenuimpl.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimp-intl.h"
@ -44,25 +45,35 @@
#define DEFAULT_MENU_PREVIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static void gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock);
static void gimp_image_dock_update_title (GimpImageDock *dock);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static GimpDockClass *parent_class = NULL;
@ -101,15 +112,20 @@ gimp_image_dock_class_init (GimpImageDockClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpDockClass *dock_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
dock_class = GIMP_DOCK_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_image_dock_destroy;
object_class->destroy = gimp_image_dock_destroy;
widget_class->style_set = gimp_image_dock_style_set;
widget_class->style_set = gimp_image_dock_style_set;
dock_class->book_added = gimp_image_dock_book_added;
dock_class->book_removed = gimp_image_dock_book_removed;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("minimal_width",
@ -131,10 +147,11 @@ gimp_image_dock_init (GimpImageDock *dock)
{
GtkWidget *hbox;
dock->image_container = NULL;
dock->display_container = NULL;
dock->show_image_menu = FALSE;
dock->auto_follow_active = TRUE;
dock->image_container = NULL;
dock->display_container = NULL;
dock->show_image_menu = FALSE;
dock->auto_follow_active = TRUE;
dock->update_title_idle_id = 0;
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (GIMP_DOCK (dock)->main_vbox), hbox,
@ -170,6 +187,12 @@ gimp_image_dock_destroy (GtkObject *object)
dock = GIMP_IMAGE_DOCK (object);
if (dock->update_title_idle_id)
{
g_source_remove (dock->update_title_idle_id);
dock->update_title_idle_id = 0;
}
/* remove the image menu and the auto button manually here because
* of weird cross-connections with GimpDock's context
*/
@ -181,8 +204,7 @@ gimp_image_dock_destroy (GtkObject *object)
dock->option_menu->parent);
}
if (GTK_OBJECT_CLASS (parent_class))
GTK_OBJECT_CLASS (parent_class)->destroy (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -232,6 +254,38 @@ gimp_image_dock_style_set (GtkWidget *widget,
focus_line_width));
}
static void
gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook)
{
g_signal_connect (dockbook, "dockable_added",
G_CALLBACK (gimp_image_dock_dockbook_changed),
dock);
g_signal_connect (dockbook, "dockable_removed",
G_CALLBACK (gimp_image_dock_dockbook_changed),
dock);
g_signal_connect (dockbook, "dockable_reordered",
G_CALLBACK (gimp_image_dock_dockbook_changed),
dock);
gimp_image_dock_update_title (GIMP_IMAGE_DOCK (dock));
GIMP_DOCK_CLASS (parent_class)->book_added (dock, dockbook);
}
static void
gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook)
{
g_signal_handlers_disconnect_by_func (dockbook,
gimp_image_dock_dockbook_changed,
dock);
gimp_image_dock_update_title (GIMP_IMAGE_DOCK (dock));
GIMP_DOCK_CLASS (parent_class)->book_added (dock, dockbook);
}
GtkWidget *
gimp_image_dock_new (GimpDialogFactory *dialog_factory,
GimpContainer *image_container,
@ -239,22 +293,15 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
{
GimpImageDock *image_dock;
GimpContext *context;
gchar *title;
gint menu_preview_width;
gint menu_preview_height;
static gint dock_counter = 1;
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (image_container), NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (display_container), NULL);
image_dock = g_object_new (GIMP_TYPE_IMAGE_DOCK, NULL);
title = g_strdup_printf (_("Gimp Dock #%d"), dock_counter++);
gtk_window_set_title (GTK_WINDOW (image_dock), title);
g_free (title);
image_dock->image_container = image_container;
image_dock->display_container = display_container;
@ -332,6 +379,68 @@ gimp_image_dock_set_show_image_menu (GimpImageDock *image_dock,
image_dock->show_image_menu = show ? TRUE : FALSE;
}
static void
gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock)
{
gimp_image_dock_update_title (dock);
}
static gboolean
gimp_image_dock_update_title_idle (GimpImageDock *image_dock)
{
GString *title;
GList *list;
title = g_string_new (NULL);
for (list = GIMP_DOCK (image_dock)->dockbooks;
list;
list = g_list_next (list))
{
GimpDockbook *dockbook = list->data;
GList *children;
GList *child;
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
for (child = children; child; child = g_list_next (child))
{
GimpDockable *dockable = child->data;
g_string_append (title, dockable->short_name);
if (g_list_next (child))
g_string_append (title, ", ");
}
g_list_free (children);
if (g_list_next (list))
g_string_append (title, " | ");
}
gtk_window_set_title (GTK_WINDOW (image_dock), title->str);
g_string_free (title, TRUE);
image_dock->update_title_idle_id = 0;
return FALSE;
}
static void
gimp_image_dock_update_title (GimpImageDock *image_dock)
{
if (image_dock->update_title_idle_id)
g_source_remove (image_dock->update_title_idle_id);
image_dock->update_title_idle_id =
g_idle_add ((GSourceFunc) gimp_image_dock_update_title_idle,
image_dock);
}
static void
gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
@ -342,9 +451,7 @@ gimp_image_dock_factory_display_changed (GimpContext *context,
image_dock = GIMP_IMAGE_DOCK (dock);
if (gdisp && image_dock->auto_follow_active)
{
gimp_context_set_display (dock->context, gdisp);
}
gimp_context_set_display (dock->context, gdisp);
}
static void
@ -356,12 +463,9 @@ gimp_image_dock_factory_image_changed (GimpContext *context,
image_dock = GIMP_IMAGE_DOCK (dock);
/* won't do anything if we already set the display above */
if (gimage && image_dock->auto_follow_active)
{
/* won't do anything if we already set the display above
*/
gimp_context_set_image (dock->context, gimage);
}
gimp_context_set_image (dock->context, gimage);
}
static void

View File

@ -49,6 +49,8 @@ struct _GimpImageDock
GtkWidget *option_menu;
GtkWidget *menu;
GtkWidget *auto_button;
guint update_title_idle_id;
};
struct _GimpImageDockClass