[ekiga/ds-gtk-application] Preferences Window: Transform it in a GmWindow as it should be.



commit 7f6b0af088e80ec0509941c62aac3cd2945a9dff
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Oct 26 17:41:01 2014 +0100

    Preferences Window: Transform it in a GmWindow as it should be.

 lib/engine/gui/gtk-frontend/ekiga-app.cpp          |    2 +-
 lib/engine/gui/gtk-frontend/preferences-window.cpp |   55 ++++----------------
 lib/engine/gui/gtk-frontend/preferences-window.h   |    6 ++-
 org.gnome.ekiga.gschema.xml.in.in                  |   13 +++++
 4 files changed, 28 insertions(+), 48 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.cpp b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
index 4b2ad37..2670bc7 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.cpp
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
@@ -878,7 +878,7 @@ gm_application_show_preferences_window (GmApplication *self)
 
   window = GTK_WINDOW (preferences_window_new (self));
   gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));
-  gtk_dialog_run (GTK_DIALOG (window));
+  gtk_window_present (window);
 }
 
 
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.cpp 
b/lib/engine/gui/gtk-frontend/preferences-window.cpp
index be83356..3d7cf0e 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.cpp
+++ b/lib/engine/gui/gtk-frontend/preferences-window.cpp
@@ -127,7 +127,7 @@ _PreferencesWindowPrivate::_PreferencesWindowPrivate ()
     boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (CONTACTS_SCHEMA));
 }
 
-G_DEFINE_TYPE (PreferencesWindow, preferences_window, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (PreferencesWindow, preferences_window, GM_TYPE_WINDOW);
 
 enum {
   COLUMN_STRING_RAW = 0,
@@ -373,16 +373,6 @@ static void  gm_prefs_window_update_devices_list (PreferencesWindow *self);
 /* Callbacks */
 
 /* DESCRIPTION  :  This callback is called when the user clicks
- *                 on the Close or Help buttons.
- * BEHAVIOR     :  Show help or destroy the window.
- * PRE          :  /
- */
-static void dialog_response_cb (GtkDialog *dialog,
-                                gint response_id,
-                                G_GNUC_UNUSED gpointer data);
-
-
-/* DESCRIPTION  :  This callback is called when the user clicks
  *                 on the refresh devices list button in the prefs.
  * BEHAVIOR     :  Redetects the devices and refreshes the menu.
  * PRE          :  /
@@ -1441,23 +1431,6 @@ gm_prefs_window_update_devices_list (PreferencesWindow *self)
 
 /* Callbacks */
 static void
-dialog_response_cb (GtkDialog *dialog,
-                    gint response_id,
-                    G_GNUC_UNUSED gpointer data)
-{
-  switch (response_id) {
-  case GTK_RESPONSE_HELP:
-    //help_callback (NULL, NULL);
-    std::cout << "FIXME" << std::endl << std::flush;
-    g_signal_stop_emission_by_name (dialog, "response");
-    break;
-  default:
-    gtk_widget_destroy (GTK_WIDGET (dialog));
-  }
-}
-
-
-static void
 refresh_devices_list_cb (G_GNUC_UNUSED GtkWidget *widget,
                          gpointer data)
 {
@@ -1749,40 +1722,32 @@ preferences_window_new (GmApplication *app)
 
   g_return_val_if_fail (GM_IS_APPLICATION (app), NULL);
 
-  GdkPixbuf *pixbuf = NULL;
   GtkWidget *container = NULL;
   boost::signals2::connection conn;
 
   Ekiga::ServiceCorePtr core = gm_application_get_core (app);
 
   /* The window */
-  self = (PreferencesWindow *) g_object_new (PREFERENCES_WINDOW_TYPE, NULL);
+  self = (PreferencesWindow *) g_object_new (PREFERENCES_WINDOW_TYPE,
+                                             "application", GTK_APPLICATION (app),
+                                             "key", USER_INTERFACE ".preferences-window",
+                                             "hide_on_delete", false,
+                                             "hide_on_esc", false, NULL);
+
   self->priv = new PreferencesWindowPrivate ();
   self->priv->audioinput_core = core->get<Ekiga::AudioInputCore> ("audioinput-core");
   self->priv->audiooutput_core = core->get<Ekiga::AudioOutputCore> ("audiooutput-core");
   self->priv->videoinput_core = core->get<Ekiga::VideoInputCore> ("videoinput-core");
   self->priv->app = app;
 
-  gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL);
-  gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
-
   self->priv->notebook = gtk_notebook_new ();
   gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->priv->notebook), TRUE);
   gtk_notebook_set_show_border (GTK_NOTEBOOK (self->priv->notebook), FALSE);
 
-  container = gtk_dialog_get_content_area (GTK_DIALOG (self));
-  gtk_box_pack_start (GTK_BOX (container), self->priv->notebook, TRUE, TRUE, 0);
-  gtk_widget_show_all (GTK_WIDGET (container));
-
-  g_signal_connect (G_OBJECT (self), "response",
-                    G_CALLBACK (dialog_response_cb), NULL);
+  gtk_container_add (GTK_CONTAINER (self), self->priv->notebook);
+  gtk_widget_show_all (GTK_WIDGET (self->priv->notebook));
 
-  gtk_window_set_title (GTK_WINDOW (self), _("Ekiga Preferences"));
-  pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (self),
-                                          GTK_STOCK_PREFERENCES,
-                                          GTK_ICON_SIZE_MENU);
-  gtk_window_set_icon (GTK_WINDOW (self), pixbuf);
-  g_object_unref (pixbuf);
+  gtk_window_set_title (GTK_WINDOW (self), _("Preferences"));
   gtk_widget_realize (GTK_WIDGET (self));
 
   /* Stuff */
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.h 
b/lib/engine/gui/gtk-frontend/preferences-window.h
index 619207f..c4df4ff 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.h
+++ b/lib/engine/gui/gtk-frontend/preferences-window.h
@@ -48,6 +48,8 @@
 #include "audiooutput-core.h"
 #include "videoinput-core.h"
 
+#include "gmwindow.h"
+
 #include "ekiga-app.h"
 
 typedef struct _PreferencesWindow PreferencesWindow;
@@ -57,14 +59,14 @@ typedef struct _PreferencesWindowClass PreferencesWindowClass;
 /* GObject thingies */
 struct _PreferencesWindow
 {
-  GtkDialog parent;
+  GmWindow parent;
 
   PreferencesWindowPrivate *priv;
 };
 
 struct _PreferencesWindowClass
 {
-  GtkDialogClass parent;
+  GmWindowClass parent;
 };
 
 
diff --git a/org.gnome.ekiga.gschema.xml.in.in b/org.gnome.ekiga.gschema.xml.in.in
index 08c1102..e48b74e 100644
--- a/org.gnome.ekiga.gschema.xml.in.in
+++ b/org.gnome.ekiga.gschema.xml.in.in
@@ -197,6 +197,7 @@
     <child name="audio-settings-window" schema="org gnome  
PACKAGE_NAME@.general.user-interface.audio-settings-window"/>
     <child name="video-settings-window" schema="org gnome  
PACKAGE_NAME@.general.user-interface.video-settings-window"/>
     <child name="accounts-window" schema="org gnome  PACKAGE_NAME@.general.user-interface.accounts-window"/>
+    <child name="preferences-window" schema="org gnome  
PACKAGE_NAME@.general.user-interface.preferences-window"/>
     <child name="video-display" schema="org gnome  PACKAGE_NAME@.general.user-interface.video-display"/>
   </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org gnome  
PACKAGE_NAME@.general.user-interface.call-window" 
path="/org/gnome/@PACKAGE_NAME@/general/user-interface/call-window/">
@@ -300,6 +301,18 @@
       <_description>Size of the accounts window</_description>
     </key>
   </schema>
+  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org gnome  
PACKAGE_NAME@.general.user-interface.preferences-window" 
path="/org/gnome/@PACKAGE_NAME@/general/user-interface/preferences-window/">
+    <key name="position" type="s">
+      <default>'0,0'</default>
+      <_summary>Position on the screen of the preferences window</_summary>
+      <_description>Position on the screen of the preferences window</_description>
+    </key>
+    <key name="size" type="s">
+      <default>'470,250'</default>
+      <_summary>Size of the preferences window</_summary>
+      <_description>Size of the preferences window</_description>
+    </key>
+  </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org gnome  
PACKAGE_NAME@.general.user-interface.video-display" 
path="/org/gnome/@PACKAGE_NAME@/general/user-interface/video-display/">
     <key name="stay-on-top" type="b">
       <default>true</default>


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