[gedit] Bring back explicit setter for the status menu button label
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Bring back explicit setter for the status menu button label
- Date: Sat, 11 May 2013 19:36:36 +0000 (UTC)
commit 411c8a2c4dc636bed57941727992ba73678c23e7
Author: Paolo Borelli <pborelli gnome org>
Date: Sat May 11 21:35:18 2013 +0200
Bring back explicit setter for the status menu button label
Unforrtunately the setter in gtk does not go through the property and
thus it reconstructs the button content without the arrow.
gedit/gedit-status-menu-button.c | 29 ++++++++++++++++-------------
gedit/gedit-status-menu-button.h | 5 +++++
gedit/gedit-window.c | 4 ++--
3 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/gedit/gedit-status-menu-button.c b/gedit/gedit-status-menu-button.c
index a36e212..8478147 100644
--- a/gedit/gedit-status-menu-button.c
+++ b/gedit/gedit-status-menu-button.c
@@ -49,19 +49,6 @@ gedit_status_menu_button_finalize (GObject *object)
}
static void
-gedit_status_menu_button_set_label (GeditStatusMenuButton *button,
- const gchar *label)
-{
- gtk_label_set_markup (GTK_LABEL (button->priv->label), label);
-}
-
-static const gchar *
-gedit_status_menu_button_get_label (GeditStatusMenuButton *button)
-{
- return gtk_label_get_label (GTK_LABEL (button->priv->label));
-}
-
-static void
gedit_status_menu_button_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -159,4 +146,20 @@ gedit_status_menu_button_new (void)
return g_object_new (GEDIT_TYPE_STATUS_MENU_BUTTON, NULL);
}
+/* we cannot rely on gtk_button_set_label since it manually replaces
+ * the internal child instead of just setting the property :( */
+
+void
+gedit_status_menu_button_set_label (GeditStatusMenuButton *button,
+ const gchar *label)
+{
+ gtk_label_set_markup (GTK_LABEL (button->priv->label), label);
+}
+
+const gchar *
+gedit_status_menu_button_get_label (GeditStatusMenuButton *button)
+{
+ return gtk_label_get_label (GTK_LABEL (button->priv->label));
+}
+
/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-status-menu-button.h b/gedit/gedit-status-menu-button.h
index d66bb85..18db854 100644
--- a/gedit/gedit-status-menu-button.h
+++ b/gedit/gedit-status-menu-button.h
@@ -58,6 +58,11 @@ GType gedit_status_menu_button_get_type (void) G_GNUC_CONST;
GtkWidget *gedit_status_menu_button_new (void);
+void gedit_status_menu_button_set_label (GeditStatusMenuButton *button,
+ const gchar *label);
+
+const gchar *gedit_status_menu_button_get_label (GeditStatusMenuButton *button);
+
G_END_DECLS
#endif /* __GEDIT_STATUS_MENU_BUTTON_H__ */
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 2708514..8eb9289 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2438,7 +2438,7 @@ tab_width_changed (GObject *object,
new_tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (object));
label = g_strdup_printf (_("Tab Width: %u"), new_tab_width);
- gtk_button_set_label (GTK_BUTTON (window->priv->tab_width_combo), label);
+ gedit_status_menu_button_set_label (GEDIT_STATUS_MENU_BUTTON (window->priv->tab_width_combo), label);
g_free (label);
for (item = items; item; item = item->next)
@@ -2487,7 +2487,7 @@ language_changed (GObject *object,
else
label = _("Plain Text");
- gtk_button_set_label (GTK_BUTTON (window->priv->language_combo), label);
+ gedit_status_menu_button_set_label (GEDIT_STATUS_MENU_BUTTON (window->priv->language_combo), label);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]