gnome-mud r806 - in trunk: . src src/zmp



Author: lharris
Date: Wed Mar 18 20:05:13 2009
New Revision: 806
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=806&view=rev

Log:
Fixed subwindow.set-input support.

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/zmp/zmp-subwindow.c

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Wed Mar 18 20:05:13 2009
@@ -1553,6 +1553,22 @@
     }
 }
 
+void
+mud_connection_view_enable_subwindow_input(MudConnectionView *view,
+                                           const gchar *identifier,
+                                           gboolean enable)
+{
+    g_return_if_fail(IS_MUD_CONNECTION_VIEW(view));
+
+    if(mud_connection_view_has_subwindow(view, identifier))
+    {
+        MudSubwindow *sub =
+            mud_connection_view_get_subwindow(view, identifier);
+
+        mud_subwindow_enable_input(sub, enable);
+    }
+}
+
 
 void
 mud_connection_view_show_subwindow(MudConnectionView *view,

Modified: trunk/src/mud-connection-view.h
==============================================================================
--- trunk/src/mud-connection-view.h	(original)
+++ trunk/src/mud-connection-view.h	Wed Mar 18 20:05:13 2009
@@ -118,6 +118,10 @@
 void mud_connection_view_set_output(MudConnectionView *view,
                                     const gchar *identifier);
 
+void mud_connection_view_enable_subwindow_input(MudConnectionView *view,
+                                                const gchar *identifier,
+                                                gboolean enable);
+
 void mud_connection_view_show_subwindow(MudConnectionView *view,
                                         const gchar *identifier);
 

Modified: trunk/src/mud-subwindow.c
==============================================================================
--- trunk/src/mud-subwindow.c	(original)
+++ trunk/src/mud-subwindow.c	Wed Mar 18 20:05:13 2009
@@ -246,7 +246,7 @@
             g_param_spec_boolean("input-enabled",
                 "Input Enabled",
                 "True if subwindow accepts input.",
-                TRUE,
+                FALSE,
                 G_PARAM_READWRITE));
 
     /* Register Signals */
@@ -288,7 +288,7 @@
     self->priv->title = NULL;
     self->priv->identifier = NULL;
     self->priv->visible = TRUE;
-    self->priv->input_enabled = TRUE;
+    self->priv->input_enabled = FALSE;
     self->priv->history = g_queue_new();
     self->priv->current_history_index = 0;
     self->priv->width = 0;
@@ -1000,3 +1000,19 @@
     gtk_window_set_title(GTK_WINDOW(self->priv->window), title);
 }
 
+void
+mud_subwindow_enable_input(MudSubwindow *self,
+                           gboolean enable)
+{
+    g_return_if_fail(MUD_IS_SUBWINDOW(self));
+
+    self->priv->input_enabled = enable;
+
+    if(enable)
+        gtk_widget_show(self->priv->entry);
+    else
+        gtk_widget_hide(self->priv->entry);
+
+    mud_subwindow_set_size(self, self->priv->width, self->priv->height);
+}
+

Modified: trunk/src/mud-subwindow.h
==============================================================================
--- trunk/src/mud-subwindow.h	(original)
+++ trunk/src/mud-subwindow.h	Wed Mar 18 20:05:13 2009
@@ -51,6 +51,7 @@
 
 GType mud_subwindow_get_type (void);
 
+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);
 void mud_subwindow_reread_profile(MudSubwindow *self);

Modified: trunk/src/zmp/zmp-subwindow.c
==============================================================================
--- trunk/src/zmp/zmp-subwindow.c	(original)
+++ trunk/src/zmp/zmp-subwindow.c	Wed Mar 18 20:05:13 2009
@@ -76,6 +76,7 @@
 static void zmp_subwindow_open(MudTelnetZmp *self, gint argc, gchar **argv);
 static void zmp_subwindow_close(MudTelnetZmp *self, gint argc, gchar **argv);
 static void zmp_subwindow_select(MudTelnetZmp *self, gint argc, gchar **argv);
+static void zmp_subwindow_set_input(MudTelnetZmp *self, gint argc, gchar **argv);
 static void zmp_subwindow_do_input(MudSubwindow *sub,
                                    const gchar *input,
                                    ZmpSubwindow *self);
@@ -239,15 +240,16 @@
     mud_zmp_register(zmp, mud_zmp_new_command("subwindow.",
                                               "subwindow.select",
                                               zmp_subwindow_select));
+    mud_zmp_register(zmp, mud_zmp_new_command("subwindow.",
+                                              "subwindow.set-input",
+                                              zmp_subwindow_set_input));
 
     /* If the server sends us these, its a broken server.
      * We send these commands to the server. */
     mud_zmp_register(zmp, mud_zmp_new_command("subwindow.",
                                               "subwindow.size",
                                               NULL));
-    mud_zmp_register(zmp, mud_zmp_new_command("subwindow.",
-                                              "subwindow.set-input",
-                                              NULL));
+
 }
 
 /* ZmpSubwindow Commands */
@@ -361,29 +363,41 @@
 }
 
 static void
+zmp_subwindow_set_input(MudTelnetZmp *self,
+                        gint argc,
+                        gchar **argv)
+{
+    MudConnectionView *view;
+    MudTelnet *telnet;
+    ZmpMain *zmp_main;
+    guint enable;
+
+    if(argc != 3)
+        return;
+
+    g_object_get(self, "telnet", &telnet, NULL);
+    g_object_get(telnet, "parent-view", &view, NULL);
+
+    enable = (guint)atol(argv[2]);
+
+    mud_connection_view_enable_subwindow_input(view,
+                                               argv[1],
+                                               enable);
+
+}
+
+static void
 zmp_subwindow_do_input(MudSubwindow *sub,
                        const gchar *input,
                        ZmpSubwindow *self)
 {
     MudConnectionView *view;
-    gchar *identifier;
 
     g_object_get(sub,
-                 "identifier", &identifier,
                  "parent-view", &view,
                  NULL);
 
-    mud_zmp_send_command(self->priv->parent, 2,
-                         "subwindow.set-input",
-                         identifier);
-
     mud_connection_view_send(view, input);
-
-    mud_zmp_send_command(self->priv->parent, 2,
-                         "subwindow.set-input",
-                         "main");
-
-    g_free(identifier);
 }
 
 static void



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