aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-07-15 11:21:39 -0500
committerCody Russell <crussell@canonical.com>2010-07-15 11:21:39 -0500
commit272dafa2317a9ac6602cf595b7571ed5bb96decc (patch)
treed80d48d02f1c6c1f3c2206cfce2b61e76ba2dd48
parent32093b51ba9486b417083806465a2c0a0556bd0b (diff)
downloadayatana-ido-272dafa2317a9ac6602cf595b7571ed5bb96decc.tar.gz
ayatana-ido-272dafa2317a9ac6602cf595b7571ed5bb96decc.tar.bz2
ayatana-ido-272dafa2317a9ac6602cf595b7571ed5bb96decc.zip
Force IdoRange to style itself by name rather than by class. Otherwise they all have the style used by the last one created.
-rw-r--r--example/menus.c13
-rw-r--r--src/idorange.c7
2 files changed, 18 insertions, 2 deletions
diff --git a/example/menus.c b/example/menus.c
index e244c40..a2647bb 100644
--- a/example/menus.c
+++ b/example/menus.c
@@ -67,6 +67,19 @@ main (int argc, char *argv[])
menuitem = ido_entry_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ menuitem = ido_scale_menu_item_new_with_range ("Volume",
+ IDO_RANGE_STYLE_SMALL,
+ 65, 0, 100, 1);
+ ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (menuitem), IDO_SCALE_MENU_ITEM_STYLE_IMAGE);
+ image = ido_scale_menu_item_get_primary_image (IDO_SCALE_MENU_ITEM (menuitem));
+ gtk_image_set_from_stock (GTK_IMAGE (image), GTK_STOCK_NEW, GTK_ICON_SIZE_MENU);
+ image = ido_scale_menu_item_get_secondary_image (IDO_SCALE_MENU_ITEM (menuitem));
+ gtk_image_set_from_stock (GTK_IMAGE (image), GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+
+ g_signal_connect (menuitem, "slider-grabbed", G_CALLBACK (slider_grabbed), NULL);
+ g_signal_connect (menuitem, "slider-released", G_CALLBACK (slider_released), NULL);
+
/* Add the menubar */
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), root);
diff --git a/src/idorange.c b/src/idorange.c
index 315d7fd..ba5c2c8 100644
--- a/src/idorange.c
+++ b/src/idorange.c
@@ -141,6 +141,9 @@ ido_range_constructed (GObject *object)
"range-style", &style,
NULL);
+ g_snprintf (buf, sizeof (buf), "idorange-%p", range);
+ gtk_widget_set_name (GTK_WIDGET (range), buf);
+
if (style == IDO_RANGE_STYLE_SMALL)
{
gint width, height;
@@ -154,8 +157,8 @@ ido_range_constructed (GObject *object)
"style \"ido-range\" {\n"
" GtkRange::slider-width = %d\n"
" GtkScale::slider-length = %d\n"
- "} class \"IdoRange\" style \"ido-range\"\n",
- width, height);
+ "} widget \"*.idorange-%p\" style \"ido-range\"\n",
+ width, height, range);
gtk_rc_parse_string (buf);
}