[gimp] app: Make Toolbox dock title complete
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Make Toolbox dock title complete
- Date: Fri, 5 Mar 2010 20:28:55 +0000 (UTC)
commit 0279daed2844e93f944df2289e964c79d8610cb3
Author: Martin Nordholts <martinn src gnome org>
Date: Fri Mar 5 08:26:24 2010 +0100
app: Make Toolbox dock title complete
Make the Toolbox dock title complete, i.e. if the toolbox dock
contains Tool Options, the title will be "Toolbox - Tool Options".
app/widgets/gimpdock.c | 39 +++++++++++++++++++++++++++++++++++++++
app/widgets/gimpmenudock.c | 39 ---------------------------------------
app/widgets/gimptoolbox.c | 13 ++++++++++++-
3 files changed, 51 insertions(+), 40 deletions(-)
---
diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c
index 3833ad0..bfe45af 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -72,6 +72,7 @@ struct _GimpDockPrivate
static void gimp_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_dock_destroy (GtkObject *object);
+static gchar * gimp_dock_real_get_title (GimpDock *dock);
static void gimp_dock_real_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_dock_real_book_removed (GimpDock *dock,
@@ -137,6 +138,7 @@ gimp_dock_class_init (GimpDockClass *klass)
widget_class->style_set = gimp_dock_style_set;
+ klass->get_title = gimp_dock_real_get_title;
klass->set_host_geometry_hints = NULL;
klass->book_added = gimp_dock_real_book_added;
klass->book_removed = gimp_dock_real_book_removed;
@@ -241,6 +243,43 @@ gimp_dock_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+static gchar *
+gimp_dock_real_get_title (GimpDock *dock)
+{
+ GString *title;
+ GList *list;
+
+ title = g_string_new (NULL);
+
+ for (list = gimp_dock_get_dockbooks (dock);
+ 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, gimp_dockable_get_name (dockable));
+
+ if (g_list_next (child))
+ g_string_append (title, ", ");
+ }
+
+ g_list_free (children);
+
+ if (g_list_next (list))
+ g_string_append (title, " - ");
+ }
+
+ return g_string_free (title, FALSE);
+}
+
static void
gimp_dock_real_book_added (GimpDock *dock,
GimpDockbook *dockbook)
diff --git a/app/widgets/gimpmenudock.c b/app/widgets/gimpmenudock.c
index 5a2bc4c..c6bcf06 100644
--- a/app/widgets/gimpmenudock.c
+++ b/app/widgets/gimpmenudock.c
@@ -54,7 +54,6 @@ struct _GimpMenuDockPrivate
static void gimp_menu_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
-static gchar *gimp_menu_dock_get_title (GimpDock *dock);
static void gimp_menu_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_menu_dock_book_removed (GimpDock *dock,
@@ -79,7 +78,6 @@ gimp_menu_dock_class_init (GimpMenuDockClass *klass)
widget_class->style_set = gimp_menu_dock_style_set;
- dock_class->get_title = gimp_menu_dock_get_title;
dock_class->book_added = gimp_menu_dock_book_added;
dock_class->book_removed = gimp_menu_dock_book_removed;
@@ -160,40 +158,3 @@ gimp_menu_dock_dockbook_changed (GimpDockbook *dockbook,
gimp_dock_invalidate_title (GIMP_DOCK (dock));
}
-static gchar *
-gimp_menu_dock_get_title (GimpDock *dock)
-{
- GString *title;
- GList *list;
-
- title = g_string_new (NULL);
-
- for (list = gimp_dock_get_dockbooks (dock);
- 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, gimp_dockable_get_name (dockable));
-
- if (g_list_next (child))
- g_string_append (title, ", ");
- }
-
- g_list_free (children);
-
- if (g_list_next (list))
- g_string_append (title, " - ");
- }
-
- return g_string_free (title, FALSE);
-}
-
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index 3d3c982..9c801fb 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -769,7 +769,18 @@ gimp_toolbox_drag_drop (GtkWidget *widget,
static gchar *
gimp_toolbox_get_title (GimpDock *dock)
{
- return g_strdup (_("Toolbox"));
+ GString *title = g_string_new (_("Toolbox"));
+ gchar *dock_title = GIMP_DOCK_CLASS (parent_class)->get_title (dock);
+
+ if (dock_title && strlen (dock_title) > 0)
+ {
+ g_string_append (title, " - ");
+ g_string_append (title, dock_title);
+ }
+
+ g_free (dock_title);
+
+ return g_string_free (title, FALSE /*free_segment*/);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]