[ekiga] Pushed the hide-on-delete code from src/gui/callbacks.* to lib/gui/gmwindow.*



commit a1ddc4bef43e410ed125d6a39bbb4af6848d48fd
Author: Julien Puydt <jpuydt gnome org>
Date:   Wed Oct 21 11:40:44 2009 +0200

    Pushed the hide-on-delete code from src/gui/callbacks.* to lib/gui/gmwindow.*
    
    ... and renamed for coherence. The lib/gui/gmwindow.* code looks a little
    messy now though... but at least everything is at the same place.

 lib/gui/gmwindow.c      |   17 +++++++++++++++++
 lib/gui/gmwindow.h      |    5 +++++
 src/gui/accounts.cpp    |    3 +--
 src/gui/callbacks.cpp   |    9 ---------
 src/gui/callbacks.h     |    9 ---------
 src/gui/main_window.cpp |    8 ++------
 src/gui/preferences.cpp |    4 +---
 7 files changed, 26 insertions(+), 29 deletions(-)
---
diff --git a/lib/gui/gmwindow.c b/lib/gui/gmwindow.c
index a18bd79..ce471a8 100644
--- a/lib/gui/gmwindow.c
+++ b/lib/gui/gmwindow.c
@@ -289,6 +289,15 @@ gm_window_get_type ()
  */
 
 static gboolean
+delete_event_cb (GtkWidget* window,
+		 G_GNUC_UNUSED gpointer data)
+{
+  gm_window_hide (window);
+
+  return TRUE;
+}
+
+static gboolean
 gm_window_delete_event (GtkWidget *w,
                         G_GNUC_UNUSED gpointer data)
 {
@@ -652,6 +661,14 @@ gm_window_hide (GtkWidget* w)
   g_free (conf_key_size);
 }
 
+void
+gm_window_hide_on_delete (GtkWidget* window)
+{
+  g_return_if_fail (GTK_IS_OBJECT (window));
+
+  g_signal_connect (GTK_OBJECT (window), "delete-event",
+		    G_CALLBACK (delete_event_cb), NULL);
+}
 
 /* Stolen from GDK */
 #ifndef WIN32
diff --git a/lib/gui/gmwindow.h b/lib/gui/gmwindow.h
index 914b0e8..e0702bc 100644
--- a/lib/gui/gmwindow.h
+++ b/lib/gui/gmwindow.h
@@ -148,6 +148,11 @@ void gm_window_show (GtkWidget* window);
  */
 void gm_window_hide (GtkWidget* window);
 
+/** Make the window only be hidden on delete
+ * @param window is a GtkWindow
+ */
+void gm_window_hide_on_delete (GtkWidget* window);
+
 G_END_DECLS
 
 #endif
diff --git a/src/gui/accounts.cpp b/src/gui/accounts.cpp
index 879560c..14a3c0f 100644
--- a/src/gui/accounts.cpp
+++ b/src/gui/accounts.cpp
@@ -704,8 +704,7 @@ gm_accounts_window_new (Ekiga::ServiceCore &core)
 			    G_CALLBACK (gm_window_hide),
 			    (gpointer) window);
 
-  g_signal_connect (GTK_OBJECT (window), "delete-event",
-		    G_CALLBACK (delete_window_cb), NULL);
+  gm_window_hide_on_delete (window);
 
   gtk_widget_show_all (GTK_WIDGET (GTK_DIALOG (window)->vbox));
 
diff --git a/src/gui/callbacks.cpp b/src/gui/callbacks.cpp
index 2929d1a..7a6d879 100644
--- a/src/gui/callbacks.cpp
+++ b/src/gui/callbacks.cpp
@@ -67,15 +67,6 @@
 
 
 /* The callbacks */
-gboolean
-delete_window_cb (GtkWidget *widget,
-                  G_GNUC_UNUSED GdkEvent *event,
-                  G_GNUC_UNUSED gpointer data)
-{
-  gm_window_hide (GTK_WIDGET (widget));
-
-  return TRUE;
-}
 
 void
 about_callback (G_GNUC_UNUSED GtkWidget *widget, 
diff --git a/src/gui/callbacks.h b/src/gui/callbacks.h
index 323413c..b26d1c1 100644
--- a/src/gui/callbacks.h
+++ b/src/gui/callbacks.h
@@ -42,15 +42,6 @@
 
 #include "common.h"
 
-
-/* DESCRIPTION  :  Simple wrapper that will call gnomemeeting_hide_window.
- * BEHAVIOR     :  Calls gnomemeeting_window_hide.
- * PRE          :  /
- */
-gboolean delete_window_cb (GtkWidget *widget,
-                           GdkEvent *event,
-                           gpointer data);
-
 /* DESCRIPTION  :  This callback is called when the user chooses to open
  *                 the about window.
  * BEHAVIOR     :  Open the about window.
diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp
index 651d5b7..5ce721c 100644
--- a/src/gui/main_window.cpp
+++ b/src/gui/main_window.cpp
@@ -1671,9 +1671,7 @@ gm_mw_video_settings_window_new (EkigaMainWindow *mw)
 			    G_CALLBACK (gm_window_hide),
 			    (gpointer) window);
 
-  g_signal_connect (GTK_OBJECT (window), 
-		    "delete-event", 
-		    G_CALLBACK (delete_window_cb), NULL);
+  gm_window_hide_on_delete (window);
 
   return window;
 }
@@ -1786,9 +1784,7 @@ gm_mw_audio_settings_window_new (EkigaMainWindow *mw)
 			    G_CALLBACK (gm_window_hide),
 			    (gpointer) window);
 
-  g_signal_connect (GTK_OBJECT (window),
-		    "delete-event", 
-		    G_CALLBACK (delete_window_cb), NULL);
+  gm_window_hide_on_delete (window);
 
   g_signal_connect (G_OBJECT (window), "show", 
                     G_CALLBACK (audio_volume_window_shown_cb), mw);
diff --git a/src/gui/preferences.cpp b/src/gui/preferences.cpp
index bafcd84..4492cbb 100644
--- a/src/gui/preferences.cpp
+++ b/src/gui/preferences.cpp
@@ -1413,9 +1413,7 @@ gm_prefs_window_new (Ekiga::ServiceCore *core)
 			    G_CALLBACK (gm_window_hide),
 			    (gpointer) window);
 
-  g_signal_connect (GTK_OBJECT (window), 
-		    "delete-event", 
-		    G_CALLBACK (delete_window_cb), NULL);
+  gm_window_hide_on_delete (window);
 
   boost::signals::connection conn;
   boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core = core->get<Ekiga::VideoInputCore> ("videoinput-core");



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