[gnome-flashback/wip/segeiger/statusicon: 3/4] input-sources: add signal current-source-changed to GfInputSourceManager



commit 12b0070c0e2f40b7cb5432d1f8716da36c825a16
Author: Sebastian Geiger <sbastig gmx net>
Date:   Wed Sep 30 14:53:45 2015 +0200

    input-sources: add signal current-source-changed to GfInputSourceManager

 .../libinput-sources/gf-input-source-manager.c     |   19 +++++++++++++++++++
 .../libinput-sources/gf-input-source-manager.h     |    7 +++++--
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.c 
b/gnome-flashback/libinput-sources/gf-input-source-manager.c
index 943413d..55a43e3 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.c
@@ -73,11 +73,14 @@ struct _GfInputSourceManager
   GList                 *mru_sources_backup;
 
   GtkWidget             *popup;
+
+  GfInputSource         *current_source;
 };
 
 enum
 {
   SIGNAL_SOURCES_CHANGED,
+  SIGNAL_CURRENT_SOURCE_CHANGED,
 
   LAST_SIGNAL
 };
@@ -457,6 +460,11 @@ current_input_source_changed (GfInputSourceManager *manager,
           break;
         }
     }
+
+  manager->current_source = new_source;
+
+  g_signal_emit (manager, signals[SIGNAL_CURRENT_SOURCE_CHANGED], 0,
+                 new_source);
 }
 
 static void
@@ -1004,6 +1012,11 @@ gf_input_source_manager_class_init (GfInputSourceManagerClass *manager_class)
     g_signal_new ("sources-changed", G_TYPE_FROM_CLASS (manager_class),
                   G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
 
+  signals[SIGNAL_CURRENT_SOURCE_CHANGED] =
+      g_signal_new ("current-source-changed", G_TYPE_FROM_CLASS (manager_class),
+                    G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1,
+                    GF_TYPE_INPUT_SOURCE);
+
   properties[PROP_IBUS_MANAGER] =
     g_param_spec_object ("ibus-manager", "IBus Manager",
                          "An instance of GfIBusManager",
@@ -1043,3 +1056,9 @@ gf_input_source_manager_reload (GfInputSourceManager *manager)
 
   sources_changed_cb (manager->settings, manager);
 }
+
+GfInputSource *gf_input_source_manager_get_current_source (
+    GfInputSourceManager *manager)
+{
+  return manager->current_source;
+}
diff --git a/gnome-flashback/libinput-sources/gf-input-source-manager.h 
b/gnome-flashback/libinput-sources/gf-input-source-manager.h
index 73dddde..67e87ae 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-manager.h
+++ b/gnome-flashback/libinput-sources/gf-input-source-manager.h
@@ -20,13 +20,16 @@
 
 #include <glib-object.h>
 #include "gf-ibus-manager.h"
+#include "gf-input-source.h"
 
 #define GF_TYPE_INPUT_SOURCE_MANAGER gf_input_source_manager_get_type ()
 G_DECLARE_FINAL_TYPE (GfInputSourceManager, gf_input_source_manager,
                       GF, INPUT_SOURCE_MANAGER, GObject)
 
-GfInputSourceManager *gf_input_source_manager_new    (GfIBusManager        *manager);
+GfInputSourceManager *gf_input_source_manager_new                (GfIBusManager        *manager);
 
-void                  gf_input_source_manager_reload (GfInputSourceManager *manager);
+void                  gf_input_source_manager_reload             (GfInputSourceManager *manager);
+
+GfInputSource        *gf_input_source_manager_get_current_source (GfInputSourceManager *manager);
 
 #endif


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