gnome-mud r807 - in trunk: . src



Author: lharris
Date: Wed Mar 18 21:50:58 2009
New Revision: 807
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=807&view=rev

Log:
MudSubwindows no longer move on redisplay after a close.  Switching notebook pages now shows/hides subwindows based on the new view.

Modified:
   trunk/ChangeLog
   trunk/src/mud-connection-view.c
   trunk/src/mud-connection-view.h
   trunk/src/mud-subwindow.c
   trunk/src/mud-subwindow.h
   trunk/src/mud-window.c

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Wed Mar 18 21:50:58 2009
@@ -1647,6 +1647,58 @@
 }
 
 void
+mud_connection_view_hide_subwindows(MudConnectionView *view)
+{
+    GList *entry;
+    gboolean visible;
+
+    g_return_if_fail(IS_MUD_CONNECTION_VIEW(view));
+
+    entry = g_list_first(view->priv->subwindows);
+
+    while(entry)
+    {
+        MudSubwindow *sub = MUD_SUBWINDOW(entry->data);
+
+        g_object_get(sub, "visible", &visible, NULL);
+
+        if(visible)
+        {
+            g_object_set(sub, "view-hidden", TRUE, NULL);
+            mud_subwindow_hide(sub);
+        }
+
+        entry = g_list_next(entry);
+    }
+}
+
+void
+mud_connection_view_show_subwindows(MudConnectionView *view)
+{
+    GList *entry;
+    gboolean view_hidden;
+
+    g_return_if_fail(IS_MUD_CONNECTION_VIEW(view));
+
+    entry = g_list_first(view->priv->subwindows);
+
+    while(entry)
+    {
+        MudSubwindow *sub = MUD_SUBWINDOW(entry->data);
+
+        g_object_get(sub, "view-hidden", &view_hidden, NULL);
+
+        if(view_hidden)
+        {
+            g_object_set(sub, "view-hidden", FALSE, NULL);
+            mud_subwindow_show(sub);
+        }
+
+        entry = g_list_next(entry);
+    }
+}
+
+void
 mud_connection_view_add_text(MudConnectionView *view, gchar *message, enum MudConnectionColorType type)
 {
     gchar *encoding, *text;

Modified: trunk/src/mud-connection-view.h
==============================================================================
--- trunk/src/mud-connection-view.h	(original)
+++ trunk/src/mud-connection-view.h	Wed Mar 18 21:50:58 2009
@@ -131,6 +131,9 @@
 MudSubwindow *mud_connection_view_get_subwindow(MudConnectionView *view,
                                                 const gchar *identifier);
 
+void mud_connection_view_hide_subwindows(MudConnectionView *view);
+void mud_connection_view_show_subwindows(MudConnectionView *view);
+
 G_END_DECLS
 
 #endif /* MUD_CONNECTION_VIEW_H */

Modified: trunk/src/mud-subwindow.c
==============================================================================
--- trunk/src/mud-subwindow.c	(original)
+++ trunk/src/mud-subwindow.c	Wed Mar 18 21:50:58 2009
@@ -45,6 +45,7 @@
     guint old_height;
 
     gboolean visible;
+    gboolean view_hidden;
     gboolean input_enabled;
 
     GQueue *history;
@@ -80,6 +81,7 @@
     PROP_WIDTH,
     PROP_HEIGHT,
     PROP_VISIBLE,
+    PROP_VIEW_HIDDEN,
     PROP_INPUT,
     PROP_OLD_WIDTH,
     PROP_OLD_HEIGHT
@@ -241,6 +243,15 @@
                 TRUE,
                 G_PARAM_READWRITE));
 
+
+    g_object_class_install_property(object_class,
+            PROP_VIEW_HIDDEN,
+            g_param_spec_boolean("view-hidden",
+                "View Hidden",
+                "True if subwindow is hidden by the view.",
+                FALSE,
+                G_PARAM_READWRITE));
+
     g_object_class_install_property(object_class,
             PROP_INPUT,
             g_param_spec_boolean("input-enabled",
@@ -288,6 +299,7 @@
     self->priv->title = NULL;
     self->priv->identifier = NULL;
     self->priv->visible = TRUE;
+    self->priv->view_hidden = FALSE;
     self->priv->input_enabled = FALSE;
     self->priv->history = g_queue_new();
     self->priv->current_history_index = 0;
@@ -386,6 +398,13 @@
     vte_terminal_set_emulation(VTE_TERMINAL(self->priv->terminal),
                                "xterm");
 
+    vte_terminal_set_cursor_shape(VTE_TERMINAL(self->priv->terminal),
+                                  VTE_CURSOR_SHAPE_UNDERLINE);
+
+    vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(self->priv->terminal),
+                                       VTE_CURSOR_BLINK_OFF);
+
+
     gtk_box_pack_start(GTK_BOX(term_box),
                        self->priv->terminal,
                        TRUE,
@@ -457,6 +476,16 @@
                         &self->priv->pixel_width,
                         &self->priv->pixel_height);
 
+    vte_terminal_set_size(VTE_TERMINAL(self->priv->terminal),
+                          self->priv->width,
+                          self->priv->height);
+
+    mud_subwindow_set_size_force_grid(self,
+                                      VTE_TERMINAL(self->priv->terminal),
+                                      TRUE,
+                                      -1,
+                                      -1);
+
     return obj;
 }
 
@@ -502,12 +531,6 @@
 
             if(new_boolean != self->priv->input_enabled)
                 self->priv->input_enabled = new_boolean;
-
-            if(self->priv->entry)
-                if(self->priv->input_enabled)
-                    gtk_widget_show(self->priv->entry);
-                else
-                    gtk_widget_hide(self->priv->entry);
             break;
 
         case PROP_VISIBLE:
@@ -517,6 +540,13 @@
                 self->priv->visible = new_boolean;
             break;
 
+        case PROP_VIEW_HIDDEN:
+            new_boolean = g_value_get_boolean(value);
+
+            if(new_boolean != self->priv->view_hidden)
+                self->priv->view_hidden = new_boolean;
+            break;
+
         case PROP_HEIGHT:
             new_uint = g_value_get_uint(value);
 
@@ -625,6 +655,10 @@
             g_value_set_boolean(value, self->priv->visible);
             break;
 
+        case PROP_VIEW_HIDDEN:
+            g_value_set_boolean(value, self->priv->view_hidden);
+            break;
+
         case PROP_INPUT:
             g_value_set_boolean(value, self->priv->input_enabled);
             break;
@@ -670,6 +704,9 @@
             &self->priv->parent_view->profile->preferences->Foreground,
             &self->priv->parent_view->profile->preferences->Background,
             self->priv->parent_view->profile->preferences->Colors, C_MAX);
+
+    vte_terminal_set_color_cursor(VTE_TERMINAL(self->priv->terminal),
+            &self->priv->parent_view->profile->preferences->Background);
 }
 
 static void
@@ -815,8 +852,18 @@
 			      GdkEvent *event,
 			      MudSubwindow *self)
 {
+    GdkWindow *wm_window;
+    GdkRectangle rect;
+
+    wm_window = gtk_widget_get_window(self->priv->window);
+    gdk_window_get_frame_extents(wm_window, &rect);
+
+    self->priv->x = rect.x;
+    self->priv->y = rect.y;
+
     gtk_widget_hide(self->priv->window);
     self->priv->visible = FALSE;
+    self->priv->view_hidden = FALSE;
 
     return TRUE;
 }
@@ -828,13 +875,6 @@
 {
     MudSubwindow *self = MUD_SUBWINDOW(user_data);
 
-    if(event->x != self->priv->x ||
-       event->y != self->priv->y)
-    {
-        self->priv->x = event->x;
-        self->priv->y = event->y;
-    }
-
     gtk_widget_grab_focus(self->priv->entry);
 
     return FALSE;
@@ -961,11 +1001,38 @@
 {
     g_return_if_fail(MUD_IS_SUBWINDOW(self));
 
-    gtk_widget_show(self->priv->window);
-    gtk_window_move(GTK_WINDOW(self->priv->window),
-                    self->priv->x,
-                    self->priv->y);
-    self->priv->visible = TRUE;
+    if(!self->priv->view_hidden)
+    {
+        gtk_widget_show(self->priv->window);
+        gtk_window_move(GTK_WINDOW(self->priv->window),
+                self->priv->x,
+                self->priv->y);
+        self->priv->visible = TRUE;
+    }
+    else
+        self->priv->view_hidden = TRUE;
+}
+
+
+void
+mud_subwindow_hide(MudSubwindow *self)
+{
+    GdkWindow *wm_window;
+    GdkRectangle rect;
+
+    g_return_if_fail(MUD_IS_SUBWINDOW(self));
+
+    if(self->priv->visible)
+    {
+        wm_window = gtk_widget_get_window(self->priv->window);
+        gdk_window_get_frame_extents(wm_window, &rect);
+
+        self->priv->x = rect.x;
+        self->priv->y = rect.y;
+
+        self->priv->visible = FALSE;
+        gtk_widget_hide(self->priv->window);
+    }
 }
 
 void

Modified: trunk/src/mud-subwindow.h
==============================================================================
--- trunk/src/mud-subwindow.h	(original)
+++ trunk/src/mud-subwindow.h	Wed Mar 18 21:50:58 2009
@@ -51,6 +51,8 @@
 
 GType mud_subwindow_get_type (void);
 
+void mud_subwindow_show(MudSubwindow *self);
+void mud_subwindow_hide(MudSubwindow *self);
 void mud_subwindow_enable_input(MudSubwindow *self, gboolean enable);
 void mud_subwindow_set_title(MudSubwindow *self, const gchar *title);
 void mud_subwindow_set_size(MudSubwindow *self, guint width, guint height);

Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c	(original)
+++ trunk/src/mud-window.c	Wed Mar 18 21:50:58 2009
@@ -602,11 +602,17 @@
     gboolean connected;
     gboolean logging;
 
+    if(IS_MUD_CONNECTION_VIEW(self->priv->current_view))
+        mud_connection_view_hide_subwindows(self->priv->current_view);
+
     self->priv->current_view =
         g_object_get_data(
                 G_OBJECT(gtk_notebook_get_nth_page(notebook, arg)),
                 "connection-view");
 
+    if(IS_MUD_CONNECTION_VIEW(self->priv->current_view))
+        mud_connection_view_show_subwindows(self->priv->current_view);
+
     if (self->priv->nr_of_tabs != 0)
     {
         g_object_get(self->priv->current_view,



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