[gnome-builder] preferences: allow activating an IdePreferencesBin



commit cbea93970e7360166cb6fbfd356bbab91f71732b
Author: Christian Hergert <chergert redhat com>
Date:   Sat Feb 18 14:08:06 2017 -0800

    preferences: allow activating an IdePreferencesBin
    
    This will pass the activation on down to the child if it supports
    activation.

 libide/preferences/ide-preferences-bin.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libide/preferences/ide-preferences-bin.c b/libide/preferences/ide-preferences-bin.c
index dbfc1c4..8466579 100644
--- a/libide/preferences/ide-preferences-bin.c
+++ b/libide/preferences/ide-preferences-bin.c
@@ -44,6 +44,13 @@ enum {
   LAST_PROP
 };
 
+enum {
+  PREFERENCE_ACTIVATED,
+  N_SIGNALS
+};
+
+static guint signals [N_SIGNALS];
+
 static GParamSpec *properties [LAST_PROP];
 static GHashTable *settings_cache;
 
@@ -247,6 +254,15 @@ ide_preferences_bin_destroy (GtkWidget *widget)
 }
 
 static void
+ide_preferences_bin_activated (GtkWidget *widget)
+{
+  GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
+
+  if (child)
+    gtk_widget_activate (child);
+}
+
+static void
 ide_preferences_bin_finalize (GObject *object)
 {
   IdePreferencesBin *self = (IdePreferencesBin *)object;
@@ -370,6 +386,13 @@ ide_preferences_bin_class_init (IdePreferencesBinClass *klass)
 
   g_object_class_install_properties (object_class, LAST_PROP, properties);
 
+  signals [PREFERENCE_ACTIVATED] = widget_class->activate_signal =
+    g_signal_new_class_handler ("preference-activated",
+                                G_TYPE_FROM_CLASS (klass),
+                                G_SIGNAL_RUN_LAST,
+                                G_CALLBACK (ide_preferences_bin_activated),
+                                NULL, NULL, NULL, G_TYPE_NONE, 0);
+
   gtk_widget_class_set_css_name (widget_class, "preferencesbin");
 
   settings_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);


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