gimp r24853 - in trunk: . app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24853 - in trunk: . app/widgets
- Date: Sun, 10 Feb 2008 20:50:22 +0000 (GMT)
Author: mitch
Date: Sun Feb 10 20:50:21 2008
New Revision: 24853
URL: http://svn.gnome.org/viewvc/gimp?rev=24853&view=rev
Log:
2008-02-10 Michael Natterer <mitch gimp org>
* app/widgets/gimpeditor.c: add button-relief style property which
defaults to NONE.
Modified:
trunk/ChangeLog
trunk/app/widgets/gimpeditor.c
Modified: trunk/app/widgets/gimpeditor.c
==============================================================================
--- trunk/app/widgets/gimpeditor.c (original)
+++ trunk/app/widgets/gimpeditor.c Sun Feb 10 20:50:21 2008
@@ -40,6 +40,7 @@
#define DEFAULT_CONTENT_SPACING 2
#define DEFAULT_BUTTON_SPACING 2
#define DEFAULT_BUTTON_ICON_SIZE GTK_ICON_SIZE_MENU
+#define DEFAULT_BUTTON_RELIEF GTK_RELIEF_NONE
enum
@@ -79,7 +80,8 @@
gboolean show);
static gboolean gimp_editor_get_show_button_bar (GimpDocked *docked);
-static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor);
+static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor,
+ GtkReliefStyle *button_relief);
G_DEFINE_TYPE_WITH_CODE (GimpEditor, gimp_editor, GTK_TYPE_VBOX,
@@ -166,6 +168,13 @@
GTK_TYPE_ICON_SIZE,
DEFAULT_BUTTON_ICON_SIZE,
GIMP_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_enum ("button-relief",
+ NULL, NULL,
+ GTK_TYPE_RELIEF_STYLE,
+ DEFAULT_BUTTON_RELIEF,
+ GIMP_PARAM_READABLE));
}
static void
@@ -459,18 +468,20 @@
GCallback extended_callback,
gpointer callback_data)
{
- GtkWidget *button;
- GtkWidget *image;
- GtkIconSize button_icon_size;
+ GtkWidget *button;
+ GtkWidget *image;
+ GtkIconSize button_icon_size;
+ GtkReliefStyle button_relief;
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
g_return_val_if_fail (stock_id != NULL, NULL);
- button_icon_size = gimp_editor_ensure_button_box (editor);
+ button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
button = g_object_new (GIMP_TYPE_BUTTON,
"use-stock", TRUE,
NULL);
+ gtk_button_set_relief (GTK_BUTTON (button), button_relief);
gtk_box_pack_start (GTK_BOX (editor->button_box), button, TRUE, TRUE, 0);
gtk_widget_show (button);
@@ -489,7 +500,6 @@
image = gtk_image_new_from_stock (stock_id, button_icon_size);
gtk_container_add (GTK_CONTAINER (button), image);
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_widget_show (image);
return button;
@@ -502,17 +512,18 @@
GCallback callback,
gpointer callback_data)
{
- GtkWidget *hbox;
- GtkWidget *first_button;
- GtkIconSize button_icon_size;
- GList *children;
- GList *list;
+ GtkWidget *hbox;
+ GtkWidget *first_button;
+ GtkIconSize button_icon_size;
+ GtkReliefStyle button_relief;
+ GList *children;
+ GList *list;
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
g_return_val_if_fail (g_type_is_a (enum_type, G_TYPE_ENUM), NULL);
g_return_val_if_fail (stock_prefix != NULL, NULL);
- button_icon_size = gimp_editor_ensure_button_box (editor);
+ button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
hbox = gimp_enum_stock_box_new (enum_type, stock_prefix, button_icon_size,
callback, callback_data,
@@ -526,6 +537,8 @@
g_object_ref (button);
+ gtk_button_set_relief (GTK_BUTTON (button), button_relief);
+
gtk_container_remove (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (editor->button_box), button,
TRUE, TRUE, 0);
@@ -592,6 +605,7 @@
GtkWidget *old_child;
GtkWidget *image;
GtkIconSize button_icon_size;
+ GtkReliefStyle button_relief;
gchar *stock_id;
gchar *tooltip;
const gchar *help_id;
@@ -611,7 +625,7 @@
g_return_val_if_fail (action != NULL, NULL);
- button_icon_size = gimp_editor_ensure_button_box (editor);
+ button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
if (GTK_IS_TOGGLE_ACTION (action))
{
@@ -621,9 +635,10 @@
else
{
button = gimp_button_new ();
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
}
+ gtk_button_set_relief (GTK_BUTTON (button), button_relief);
+
g_object_get (action,
"stock-id", &stock_id,
"tooltip", &tooltip,
@@ -733,10 +748,11 @@
gimp_editor_set_box_style (GimpEditor *editor,
GtkBox *box)
{
- GtkIconSize button_icon_size;
- gint button_spacing;
- GList *children;
- GList *list;
+ GtkIconSize button_icon_size;
+ gint button_spacing;
+ GtkReliefStyle button_relief;
+ GList *children;
+ GList *list;
g_return_if_fail (GIMP_IS_EDITOR (editor));
g_return_if_fail (GTK_IS_BOX (box));
@@ -744,6 +760,7 @@
gtk_widget_style_get (GTK_WIDGET (editor),
"button-icon-size", &button_icon_size,
"button-spacing", &button_spacing,
+ "button-relief", &button_relief,
NULL);
gtk_box_set_spacing (box, button_spacing);
@@ -756,6 +773,8 @@
{
GtkWidget *child;
+ gtk_button_set_relief (GTK_BUTTON (list->data), button_relief);
+
child = gtk_bin_get_child (GTK_BIN (list->data));
if (GTK_IS_IMAGE (child))
@@ -776,7 +795,8 @@
/* private functions */
static GtkIconSize
-gimp_editor_ensure_button_box (GimpEditor *editor)
+gimp_editor_ensure_button_box (GimpEditor *editor,
+ GtkReliefStyle *button_relief)
{
GtkIconSize button_icon_size;
gint button_spacing;
@@ -784,6 +804,7 @@
gtk_widget_style_get (GTK_WIDGET (editor),
"button-icon-size", &button_icon_size,
"button-spacing", &button_spacing,
+ "button-relief", button_relief,
NULL);
if (! editor->button_box)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]