[gimp] Make the appearance of the "lock content" toggle configurable
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Make the appearance of the "lock content" toggle configurable
- Date: Thu, 20 Aug 2009 11:12:55 +0000 (UTC)
commit ee5b8c6552e935588c6049092a88e3db3aef4fc9
Author: Michael Natterer <mitch gimp org>
Date: Thu Aug 20 12:50:40 2009 +0200
Make the appearance of the "lock content" toggle configurable
* app/widgets/gimpitemtreeview.[ch]: add class members for the lock
content button's icon, tooltip and help_id and use them when
creating the button. Create the button in constructor() instead of
init() so we have access to our real class structure without the
need for a custom get_type() function.
* app/widgets/gimpdrawabletreeview.c: configure the button as "Lock pixels".
* app/widgets/gimpvectorstreeview.c: configure it as "Lock path strokes".
app/widgets/gimpdrawabletreeview.c | 5 +++
app/widgets/gimpitemtreeview.c | 67 ++++++++++++++++++++---------------
app/widgets/gimpitemtreeview.h | 5 +++
app/widgets/gimpvectorstreeview.c | 26 +++++++------
4 files changed, 62 insertions(+), 41 deletions(-)
---
diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c
index fcbe339..35013cf 100644
--- a/app/widgets/gimpdrawabletreeview.c
+++ b/app/widgets/gimpdrawabletreeview.c
@@ -23,6 +23,8 @@
#include <gegl.h>
#include <gtk/gtk.h>
+#include "libgimpwidgets/gimpwidgets.h"
+
#include "widgets-types.h"
#include "core/gimp.h"
@@ -116,6 +118,9 @@ gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass)
tree_view_class->drop_color = gimp_drawable_tree_view_drop_color;
item_view_class->set_image = gimp_drawable_tree_view_set_image;
+
+ item_view_class->lock_content_stock_id = GIMP_STOCK_TOOL_PAINTBRUSH;
+ item_view_class->lock_content_tooltip = _("Lock pixels");
}
static void
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index ae96264..9239fc6 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -253,8 +253,13 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
klass->lower_bottom_action = NULL;
klass->duplicate_action = NULL;
klass->delete_action = NULL;
+
klass->reorder_desc = NULL;
+ klass->lock_content_stock_id = NULL;
+ klass->lock_content_tooltip = NULL;
+ klass->lock_content_help_id = NULL;
+
g_type_class_add_private (klass, sizeof (GimpItemTreeViewPriv));
}
@@ -281,9 +286,6 @@ static void
gimp_item_tree_view_init (GimpItemTreeView *view)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
- GtkWidget *hbox;
- GtkWidget *image;
- GtkIconSize icon_size;
view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view,
GIMP_TYPE_ITEM_TREE_VIEW,
@@ -309,32 +311,6 @@ gimp_item_tree_view_init (GimpItemTreeView *view)
gimp_container_tree_view_set_dnd_drop_to_empty (tree_view, TRUE);
view->priv->image = NULL;
-
-
- /* Lock content toggle */
-
- hbox = gimp_item_tree_view_get_lock_box (view);
-
- view->priv->lock_content_toggle = gtk_check_button_new ();
- gtk_box_pack_start (GTK_BOX (hbox), view->priv->lock_content_toggle,
- FALSE, FALSE, 0);
- gtk_widget_show (view->priv->lock_content_toggle);
-
- g_signal_connect (view->priv->lock_content_toggle, "toggled",
- G_CALLBACK (gimp_item_tree_view_lock_content_toggled),
- view);
-
- gimp_help_set_help_data (view->priv->lock_content_toggle,
- _("Lock pixels"),
- NULL /* GIMP_HELP_LAYER_DIALOG_LOCK_ALPHA_BUTTON */);
-
- gtk_widget_style_get (GTK_WIDGET (view),
- "button-icon-size", &icon_size,
- NULL);
-
- image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_PAINTBRUSH, icon_size);
- gtk_container_add (GTK_CONTAINER (view->priv->lock_content_toggle), image);
- gtk_widget_show (image);
}
static GObject *
@@ -348,6 +324,9 @@ gimp_item_tree_view_constructor (GType type,
GimpItemTreeView *item_view;
GObject *object;
GtkTreeViewColumn *column;
+ GtkWidget *hbox;
+ GtkWidget *image;
+ GtkIconSize icon_size;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
@@ -451,6 +430,36 @@ gimp_item_tree_view_constructor (GType type,
GTK_BUTTON (item_view->priv->delete_button),
item_view_class->item_type);
+
+ /* Lock content toggle */
+
+ hbox = gimp_item_tree_view_get_lock_box (item_view);
+
+ item_view->priv->lock_content_toggle = gtk_check_button_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), item_view->priv->lock_content_toggle,
+ FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (hbox),
+ item_view->priv->lock_content_toggle, 0);
+ gtk_widget_show (item_view->priv->lock_content_toggle);
+
+ g_signal_connect (item_view->priv->lock_content_toggle, "toggled",
+ G_CALLBACK (gimp_item_tree_view_lock_content_toggled),
+ item_view);
+
+ gimp_help_set_help_data (item_view->priv->lock_content_toggle,
+ item_view_class->lock_content_tooltip,
+ item_view_class->lock_content_help_id);
+
+ gtk_widget_style_get (GTK_WIDGET (item_view),
+ "button-icon-size", &icon_size,
+ NULL);
+
+ image = gtk_image_new_from_stock (item_view_class->lock_content_stock_id,
+ icon_size);
+ gtk_container_add (GTK_CONTAINER (item_view->priv->lock_content_toggle),
+ image);
+ gtk_widget_show (image);
+
return object;
}
diff --git a/app/widgets/gimpitemtreeview.h b/app/widgets/gimpitemtreeview.h
index b5d8730..f29778c 100644
--- a/app/widgets/gimpitemtreeview.h
+++ b/app/widgets/gimpitemtreeview.h
@@ -100,6 +100,11 @@ struct _GimpItemTreeViewClass
/* undo descriptions */
const gchar *reorder_desc;
+
+ /* lock content button appearance */
+ const gchar *lock_content_stock_id;
+ const gchar *lock_content_tooltip;
+ const gchar *lock_content_help_id;
};
diff --git a/app/widgets/gimpvectorstreeview.c b/app/widgets/gimpvectorstreeview.c
index 03f40f7..18dda94 100644
--- a/app/widgets/gimpvectorstreeview.c
+++ b/app/widgets/gimpvectorstreeview.c
@@ -102,18 +102,20 @@ gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass)
iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_vectors;
iv_class->new_item = gimp_vectors_tree_view_item_new;
- iv_class->action_group = "vectors";
- iv_class->activate_action = "vectors-path-tool";
- iv_class->edit_action = "vectors-edit-attributes";
- iv_class->new_action = "vectors-new";
- iv_class->new_default_action = "vectors-new-last-values";
- iv_class->raise_action = "vectors-raise";
- iv_class->raise_top_action = "vectors-raise-to-top";
- iv_class->lower_action = "vectors-lower";
- iv_class->lower_bottom_action = "vectors-lower-to-bottom";
- iv_class->duplicate_action = "vectors-duplicate";
- iv_class->delete_action = "vectors-delete";
- iv_class->reorder_desc = _("Reorder path");
+ iv_class->action_group = "vectors";
+ iv_class->activate_action = "vectors-path-tool";
+ iv_class->edit_action = "vectors-edit-attributes";
+ iv_class->new_action = "vectors-new";
+ iv_class->new_default_action = "vectors-new-last-values";
+ iv_class->raise_action = "vectors-raise";
+ iv_class->raise_top_action = "vectors-raise-to-top";
+ iv_class->lower_action = "vectors-lower";
+ iv_class->lower_bottom_action = "vectors-lower-to-bottom";
+ iv_class->duplicate_action = "vectors-duplicate";
+ iv_class->delete_action = "vectors-delete";
+ iv_class->reorder_desc = _("Reorder path");
+ iv_class->lock_content_stock_id = GIMP_STOCK_TOOL_PATH;
+ iv_class->lock_content_tooltip = _("Lock path strokes");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]