[gnome-builder] prefs: add helper to get preferences widget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] prefs: add helper to get preferences widget
- Date: Thu, 5 May 2016 14:40:43 +0000 (UTC)
commit 3a62c33e00978e8b901a5e30fe55b739c7b5838d
Author: Christian Hergert <chergert redhat com>
Date: Thu May 5 17:38:33 2016 +0300
prefs: add helper to get preferences widget
libide/ide-preferences.c | 14 ++++++++++++++
libide/ide-preferences.h | 5 +++++
libide/preferences/ide-preferences-perspective.c | 12 ++++++++++++
3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-preferences.c b/libide/ide-preferences.c
index 0d13d91..8548eec 100644
--- a/libide/ide-preferences.c
+++ b/libide/ide-preferences.c
@@ -228,3 +228,17 @@ ide_preferences_set_page (IdePreferences *self,
IDE_PREFERENCES_GET_IFACE (self)->set_page (self, page_name, map);
}
+
+/**
+ * ide_preferences_get_widget:
+ *
+ * Returns: (transfer none) (nullable): A #GtkWidget or %NULL.
+ */
+GtkWidget *
+ide_preferences_get_widget (IdePreferences *self,
+ guint widget_id)
+{
+ g_return_val_if_fail (IDE_IS_PREFERENCES (self), NULL);
+
+ IDE_PREFERENCES_GET_IFACE (self)->get_widget (self, widget_id);
+}
diff --git a/libide/ide-preferences.h b/libide/ide-preferences.h
index 3e08465..53a9947 100644
--- a/libide/ide-preferences.h
+++ b/libide/ide-preferences.h
@@ -108,6 +108,9 @@ struct _IdePreferencesInterface
gboolean (*remove_id) (IdePreferences *self,
guint widget_id);
+
+ GtkWidget *(*get_widget) (IdePreferences *self,
+ guint widget_id);
};
void ide_preferences_add_page (IdePreferences *self,
@@ -186,6 +189,8 @@ gboolean ide_preferences_remove_id (IdePreferences *self,
void ide_preferences_set_page (IdePreferences *self,
const gchar *page_name,
GHashTable *map);
+GtkWidget *ide_preferences_get_widget (IdePreferences *self,
+ guint widget_id);
G_END_DECLS
diff --git a/libide/preferences/ide-preferences-perspective.c
b/libide/preferences/ide-preferences-perspective.c
index 09c9fdc..39a8bb3 100644
--- a/libide/preferences/ide-preferences-perspective.c
+++ b/libide/preferences/ide-preferences-perspective.c
@@ -860,6 +860,17 @@ ide_preferences_perspective_set_page (IdePreferences *preferences,
gtk_widget_set_visible (GTK_WIDGET (self->back_button), FALSE);
}
+static GtkWidget *
+ide_preferences_perspective_get_widget (IdePreferences *preferences,
+ guint widget_id)
+{
+ IdePreferencesPerspective *self = (IdePreferencesPerspective *)preferences;
+
+ g_assert (IDE_IS_PREFERENCES_PERSPECTIVE (self));
+
+ return g_hash_table_lookup (self->widgets, GINT_TO_POINTER (widget_id));
+}
+
static void
ide_preferences_iface_init (IdePreferencesInterface *iface)
{
@@ -874,6 +885,7 @@ ide_preferences_iface_init (IdePreferencesInterface *iface)
iface->add_custom = ide_preferences_perspective_add_custom;
iface->set_page = ide_preferences_perspective_set_page;
iface->remove_id = ide_preferences_perspective_remove_id;
+ iface->get_widget = ide_preferences_perspective_get_widget;
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]