[ekiga/ds-gsettings3] ExtWindow: Ported to GSettings.



commit e924312bb1c8c5ba4d27d6732111f61ace01cd0e
Author: Damien Sandras <dsandras beip be>
Date:   Sun Nov 17 15:13:12 2013 +0100

    ExtWindow: Ported to GSettings.

 lib/engine/gui/gtk-frontend/ext-window.cpp |   43 +++++++++++++++++++++------
 1 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/ext-window.cpp b/lib/engine/gui/gtk-frontend/ext-window.cpp
index 89ffbbf..38a9e29 100644
--- a/lib/engine/gui/gtk-frontend/ext-window.cpp
+++ b/lib/engine/gui/gtk-frontend/ext-window.cpp
@@ -27,7 +27,7 @@
  */
 
 #include "ext-window.h"
-#include "gmconf.h"
+#include "ekiga-settings.h"
 
 #ifndef WIN32
 #include <gdk/gdkx.h>
@@ -44,6 +44,7 @@ struct _EkigaExtWindowPrivate {
 #endif
   GtkWidget *video, *zin, *zout;
   boost::shared_ptr<Ekiga::VideoOutputCore> vocore;
+  boost::shared_ptr<Ekiga::Settings> video_display_settings;
 };
 
 static void
@@ -57,26 +58,42 @@ static void
 zoom_in (G_GNUC_UNUSED GtkWidget *widget, gpointer user_data)
 {
   guint zoom;
+  EkigaExtWindow *ew = EKIGA_EXT_WINDOW (user_data);
 
-  zoom = gm_conf_get_int (VIDEO_DISPLAY_KEY "ext_zoom");
+  zoom = ew->priv->video_display_settings->get_int ( "ext_zoom");
   if (zoom < 200)
     zoom = zoom * 2;
-  gm_conf_set_int (VIDEO_DISPLAY_KEY "ext_zoom", zoom);
+  ew->priv->video_display_settings->set_int ("ext_zoom", zoom);
 
-  set_zoom_buttons_sensitive (EKIGA_EXT_WINDOW (user_data), zoom);
+  set_zoom_buttons_sensitive (ew, zoom);
 }
 
 static void
 zoom_out (G_GNUC_UNUSED GtkWidget *widget, gpointer user_data)
 {
   guint zoom;
+  EkigaExtWindow *ew = EKIGA_EXT_WINDOW (user_data);
 
-  zoom = gm_conf_get_int (VIDEO_DISPLAY_KEY "ext_zoom");
+  zoom = ew->priv->video_display_settings->get_int ( "ext_zoom");
   if (zoom > 50)
     zoom = (guint) zoom / 2;
-  gm_conf_set_int (VIDEO_DISPLAY_KEY "ext_zoom", zoom);
+  ew->priv->video_display_settings->set_int ("ext_zoom", zoom);
 
-  set_zoom_buttons_sensitive (EKIGA_EXT_WINDOW (user_data), zoom);
+  set_zoom_buttons_sensitive (ew, zoom);
+}
+
+static void
+stay_on_top_changed_cb (GSettings *settings,
+                        gchar *key,
+                        gpointer self)
+
+{
+  bool val = false;
+
+  g_return_if_fail (self != NULL);
+
+  val = g_settings_get_boolean (settings, key);
+  gdk_window_set_keep_above (GDK_WINDOW (gtk_widget_get_window (GTK_WIDGET (self))), val);
 }
 
 static void
@@ -169,9 +186,10 @@ focus_in_event (GtkWidget *widget, GdkEventFocus *event)
 static void
 show (GtkWidget *widget)
 {
+  EkigaExtWindow *ew = EKIGA_EXT_WINDOW (widget);
   GdkWindow *w = gtk_widget_get_window (widget);
 
-  if (w && gm_conf_get_bool (VIDEO_DISPLAY_KEY "stay_on_top"))
+  if (w && ew->priv->video_display_settings->get_bool ("stay-on-top"))
     gdk_window_set_keep_above (w, true);
 
   GTK_WIDGET_CLASS (ekiga_ext_window_parent_class)->show (widget);
@@ -250,9 +268,14 @@ ext_window_new (boost::shared_ptr<Ekiga::VideoOutputCore> &vocore)
   EkigaExtWindow *ew =
     EKIGA_EXT_WINDOW (g_object_new (EKIGA_TYPE_EXT_WINDOW, NULL));
 
-  g_signal_connect (ew, "delete-event", G_CALLBACK (gtk_true), NULL);
-
   ew->priv->vocore = vocore;
+  ew->priv->video_display_settings =
+    boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (VIDEO_DISPLAY_SCHEMA));
+
+  g_signal_connect (ew, "delete-event", G_CALLBACK (gtk_true), NULL);
+  g_signal_connect (ew->priv->video_display_settings->get_g_settings (),
+                    "changed",
+                    G_CALLBACK (stay_on_top_changed_cb), ew);
 
   return GTK_WIDGET (ew);
 }


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