[goffice] GOOptionMenu: minor opdates.



commit 4a82fe76f7fcc8d10eef2d611df757c841bc91f1
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 12 22:47:24 2013 -0400

    GOOptionMenu: minor opdates.

 ChangeLog                   |    4 ++++
 goffice/gtk/go-optionmenu.c |    5 ++---
 goffice/gtk/go-optionmenu.h |    4 ++++
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index be645a5..5fbe8f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-03-12  Morten Welinder  <terra gnome org>
 
+       * goffice/gtk/go-optionmenu.c (go_option_menu_position): Simplify
+       and make it work for menu items that aren't check items.
+       (go_option_menu_select_item): Make public.
+
        * goffice/utils/go-glib-extras.c (go_slist_create): Constify.
 
 2013-03-10  Morten Welinder  <terra gnome org>
diff --git a/goffice/gtk/go-optionmenu.c b/goffice/gtk/go-optionmenu.c
index 00b4f51..224d5f8 100644
--- a/goffice/gtk/go-optionmenu.c
+++ b/goffice/gtk/go-optionmenu.c
@@ -90,7 +90,7 @@ go_option_menu_update_contents (GOOptionMenu *option_menu)
        gtk_label_set_text (option_menu->button_label, text);
 }
 
-static void
+void
 go_option_menu_select_item (GOOptionMenu *option_menu, GtkMenuItem *item)
 {
        if (item == option_menu->selected)
@@ -144,8 +144,7 @@ go_option_menu_position (GtkMenu  *menu,
        while (children) {
                GtkWidget *child = children->data;
 
-               if (GTK_IS_CHECK_MENU_ITEM (child) &&
-                   gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (child))) {
+               if (child == (GtkWidget*)option_menu->selected) {
                        gtk_widget_get_preferred_size (child, &requisition, NULL);
                        menu_ypos -= requisition.height / 2;
                        break;
diff --git a/goffice/gtk/go-optionmenu.h b/goffice/gtk/go-optionmenu.h
index 5dbf376..de2d30f 100644
--- a/goffice/gtk/go-optionmenu.h
+++ b/goffice/gtk/go-optionmenu.h
@@ -81,6 +81,10 @@ void       go_option_menu_set_history (GOOptionMenu *option_menu,
                                       GSList *selection);
 GtkWidget *go_option_menu_get_history (GOOptionMenu *option_menu);
 
+void       go_option_menu_select_item (GOOptionMenu *option_menu,
+                                      GtkMenuItem *item);
+
+
 G_END_DECLS
 
 #endif /* _GO_OPTIONMENU_H_ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]