[goffice] GOOptionMenu: leak fix.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOOptionMenu: leak fix.
- Date: Thu, 21 Mar 2013 03:07:54 +0000 (UTC)
commit 85a4ec6f53491a1b7974782399813f4b2249a052
Author: Morten Welinder <terra gnome org>
Date: Wed Mar 20 22:59:22 2013 -0400
GOOptionMenu: leak fix.
ChangeLog | 4 ++++
goffice/gtk/go-optionmenu.c | 17 ++++++++++++++++-
goffice/gtk/go-optionmenu.h | 1 +
3 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f54ffeb..f032fc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-03-20 Morten Welinder <terra gnome org>
+ * goffice/gtk/go-optionmenu.c (go_option_menu_set_history): Plug
+ leak.
+ (go_option_menu_get_menu): New function.
+
* goffice/gtk/go-font-sel.c: Add color group.
(go_font_sel_set_color): Add is_default argument and make this
public.
diff --git a/goffice/gtk/go-optionmenu.c b/goffice/gtk/go-optionmenu.c
index eff224b..7e33545 100644
--- a/goffice/gtk/go-optionmenu.c
+++ b/goffice/gtk/go-optionmenu.c
@@ -246,6 +246,19 @@ handle_menu_signals (GOOptionMenu *option_menu, gboolean connect)
}
}
+/**
+ * go_option_menu_get_menu:
+ * @option_menu: #GOOptionMenu
+ *
+ * Returns: (transfer none): The currently set menu.
+ */
+GtkWidget *
+go_option_menu_get_menu (GOOptionMenu *option_menu)
+{
+ g_return_val_if_fail (GO_IS_OPTION_MENU (option_menu), NULL);
+ return (GtkWidget*)(option_menu->menu);
+}
+
void
go_option_menu_set_menu (GOOptionMenu *option_menu,
GtkWidget *menu)
@@ -310,7 +323,9 @@ go_option_menu_set_history (GOOptionMenu *option_menu, GSList *selection)
while (1) {
int n = GPOINTER_TO_INT (selection->data);
- GtkMenuItem *item = g_list_nth_data (gtk_container_get_children (GTK_CONTAINER
(menu)), n);
+ GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
+ GtkMenuItem *item = g_list_nth_data (children, n);
+ g_list_free (children);
selection = selection->next;
if (selection)
menu = GTK_MENU_SHELL (gtk_menu_item_get_submenu (item));
diff --git a/goffice/gtk/go-optionmenu.h b/goffice/gtk/go-optionmenu.h
index de2d30f..83357e4 100644
--- a/goffice/gtk/go-optionmenu.h
+++ b/goffice/gtk/go-optionmenu.h
@@ -75,6 +75,7 @@ struct _GOOptionMenuClass
GType go_option_menu_get_type (void) G_GNUC_CONST;
GtkWidget* go_option_menu_new (void);
+GtkWidget *go_option_menu_get_menu (GOOptionMenu *option_menu);
void go_option_menu_set_menu (GOOptionMenu *option_menu,
GtkWidget *menu);
void go_option_menu_set_history (GOOptionMenu *option_menu,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]