gnome-mud r813 - in trunk: . src src/handlers



Author: lharris
Date: Thu Mar 19 07:43:00 2009
New Revision: 813
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=813&view=rev

Log:
Freeze on Close fixed.

Modified:
   trunk/ChangeLog
   trunk/src/handlers/mud-telnet-naws.c
   trunk/src/mud-connection-view.c
   trunk/src/mud-window.c

Modified: trunk/src/handlers/mud-telnet-naws.c
==============================================================================
--- trunk/src/handlers/mud-telnet-naws.c	(original)
+++ trunk/src/handlers/mud-telnet-naws.c	Thu Mar 19 07:43:00 2009
@@ -41,6 +41,9 @@
 
     /* Private Instance Members */
     gulong resized_signal;
+    gulong delete_signal;
+    MudWindow *window;
+    GtkWidget *main_window;
 };
 
 /* Property Identifiers */
@@ -82,6 +85,10 @@
                                        gint height,
                                        MudTelnetNaws *self);
 
+static gboolean mud_telnet_naws_delete_event_cb(GtkWidget *widget,
+	                             		GdkEvent *event,
+			                        MudTelnetNaws *self);
+
 /* Private Methods */
 static void mud_telnet_naws_send(MudTelnetNaws *self, gint width, gint height);
 
@@ -142,6 +149,7 @@
     self->priv->enabled = FALSE;
 
     self->priv->resized_signal = 0;
+    self->priv->delete_signal = 0;
 }
 
 static GObject *
@@ -174,17 +182,16 @@
 mud_telnet_naws_finalize (GObject *object)
 {
     MudTelnetNaws *self;
-    MudConnectionView *view;
-    MudWindow *window;
+    GtkWidget *main_window;
     GObjectClass *parent_class;
 
     self = MUD_TELNET_NAWS(object);
 
-    g_object_get(self->priv->telnet, "parent-view", &view, NULL);
-    g_object_get(view, "window", &window, NULL);
-
     if(self->priv->resized_signal != 0)
-        g_signal_handler_disconnect(window, self->priv->resized_signal);
+        g_signal_handler_disconnect(self->priv->window, self->priv->resized_signal);
+
+    if(self->priv->delete_signal != 0)
+        g_signal_handler_disconnect(self->priv->main_window, self->priv->delete_signal);
 
     parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
     parent_class->finalize(object);
@@ -247,7 +254,6 @@
 mud_telnet_naws_enable(MudTelnetHandler *handler)
 {
     MudTelnetNaws *self;
-    MudWindow *window;
     MudConnectionView *view;
     VteTerminal *terminal;
 
@@ -261,14 +267,22 @@
 
     g_object_get(view,
                  "terminal", &terminal, 
-                 "window", &window,
+                 "window", &self->priv->window,
                  NULL);
 
+    g_object_get(self->priv->window, "window", &self->priv->main_window, NULL);
+
     self->priv->resized_signal = 
-        g_signal_connect(window,
+        g_signal_connect(self->priv->window,
                          "resized",
                          G_CALLBACK(mud_telnet_naws_resized_cb),
                          self);
+
+    self->priv->delete_signal =
+        g_signal_connect(self->priv->main_window,
+                         "delete-event",
+                         G_CALLBACK(mud_telnet_naws_delete_event_cb),
+                         self);
     
     mud_telnet_naws_send(self,
                          terminal->column_count,
@@ -281,8 +295,7 @@
 mud_telnet_naws_disable(MudTelnetHandler *handler)
 {
     MudTelnetNaws *self;
-    MudWindow *window;
-    MudConnectionView *view;
+    GtkWidget *main_window;
 
     self = MUD_TELNET_NAWS(handler);
 
@@ -290,12 +303,17 @@
 
     self->priv->enabled = FALSE;
 
-    g_object_get(self->priv->telnet, "parent-view", &view, NULL);
-    g_object_get(view,
-                 "window", &window,
-                 NULL);
+    if(self->priv->resized_signal != 0)
+    {
+        g_signal_handler_disconnect(self->priv->window, self->priv->resized_signal);
+        self->priv->resized_signal = 0;
+    }
 
-    g_signal_handler_disconnect(window, self->priv->resized_signal);
+    if(self->priv->delete_signal != 0)
+    {
+        g_signal_handler_disconnect(self->priv->main_window, self->priv->delete_signal);
+        self->priv->delete_signal = 0;
+    }
 
     g_log("Telnet", G_LOG_LEVEL_INFO, "%s", "NAWS Disabled");
 }
@@ -328,6 +346,9 @@
                  "parent-view", &view,
                  NULL);
 
+    if(!IS_MUD_CONNECTION_VIEW(view))
+        return;
+
     if(view->connection &&
        gnet_conn_is_connected(view->connection) &&
        self->priv->enabled)
@@ -355,3 +376,17 @@
                             w1, w0, h1, h0);
 }
 
+static gboolean
+mud_telnet_naws_delete_event_cb(GtkWidget *widget,
+	            		GdkEvent *event,
+			        MudTelnetNaws *self)
+{
+    if(self->priv->resized_signal != 0)
+    {
+        g_signal_handler_disconnect(self->priv->window, self->priv->resized_signal);
+        self->priv->resized_signal = 0;
+    }
+
+    return FALSE;
+}
+

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Thu Mar 19 07:43:00 2009
@@ -662,7 +662,7 @@
     
     if(connection_view->telnet)
         g_object_unref(connection_view->telnet);
-   
+  
     g_object_unref(connection_view->log);
     g_object_unref(connection_view->parse);
     g_object_unref(connection_view->profile);

Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c	(original)
+++ trunk/src/mud-window.c	Thu Mar 19 07:43:00 2009
@@ -389,6 +389,7 @@
     while(entry != NULL)
     {
         g_object_unref(entry->data);
+
         entry = g_slist_next(entry);
     }
 
@@ -765,17 +766,20 @@
                             GtkAllocation *allocation,
                             MudWindow *self)
 {
-    if(self->priv->width != allocation->width ||
-       self->priv->height != allocation->height)
+    if(GTK_WIDGET_MAPPED(self->window))
     {
-        self->priv->width = allocation->width;
-        self->priv->height = allocation->height;
+        if(self->priv->width != allocation->width ||
+                self->priv->height != allocation->height)
+        {
+            self->priv->width = allocation->width;
+            self->priv->height = allocation->height;
 
-        g_signal_emit(self,
-                      mud_window_signal[RESIZED],
-                      0,
-                      self->priv->width,
-                      self->priv->height);
+            g_signal_emit(self,
+                    mud_window_signal[RESIZED],
+                    0,
+                    self->priv->width,
+                    self->priv->height);
+        }
     }
 }
 



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