gnome-mud r665 - in trunk: . src ui



Author: lharris
Date: Sat Jun 21 04:06:35 2008
New Revision: 665
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=665&view=rev

Log:
Les Harris: Removed libgnetwork, added libgnet support. Fixed include errors.


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/gnome-mud.c
   trunk/src/gnome-mud.h
   trunk/src/modules.c
   trunk/src/mud-connection-view.c
   trunk/src/mud-connection-view.h
   trunk/src/mud-parse-base.c
   trunk/src/mud-window-mconnect.c
   trunk/src/mud-window-mudedit.c
   trunk/src/mud-window-mudlist.c
   trunk/src/mud-window-profile.c
   trunk/src/mud-window.c
   trunk/ui/main.glade

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat Jun 21 04:06:35 2008
@@ -53,11 +53,13 @@
 GMODULE_REQUIRED=2.0.0
 GTK_REQUIRED=2.10.0
 LIBGLADE_REQUIRED=2.0.1
-LIBGNETWORK_REQUIRED=0.0.6
+dnl LIBGNETWORK_REQUIRED=0.0.6
+LIBGNET_REQUIRED=0.22
 VTE_REQUIRED=0.11.00
 PCRE_REQUIRED=6.0.0
+GCONF_REQUIRED=0.20
 
-PKG_CHECK_MODULES(GMUD, gtk+-2.0 >= $GTK_REQUIRED vte >= $VTE_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libgnetwork-1.0 >= $LIBGNETWORK_REQUIRED libpcre >= $PCRE_REQUIRED gmodule-2.0 >= $GMODULE_REQUIRED)
+PKG_CHECK_MODULES(GMUD, gtk+-2.0 >= $GTK_REQUIRED vte >= $VTE_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libpcre >= $PCRE_REQUIRED gmodule-2.0 >= $GMODULE_REQUIRED gnet-2.0 >= $LIBGNET_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
 AC_SUBST(GMUD_CFLAGS)
 AC_SUBST(GMUD_LIBS)
 

Modified: trunk/src/gnome-mud.c
==============================================================================
--- trunk/src/gnome-mud.c	(original)
+++ trunk/src/gnome-mud.c	Sat Jun 21 04:06:35 2008
@@ -26,6 +26,7 @@
 #include <gtk/gtkwindow.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <gnet.h>
 
 #ifdef USE_PYTHON
 //#include <Python.h>
@@ -96,6 +97,9 @@
 		return 1;
 	}
 
+    /* Initialize the Gnet library */
+    gnet_init();
+    
 	gtk_init(&argc, &argv);
 	
 	/* Start a GConf client */

Modified: trunk/src/gnome-mud.h
==============================================================================
--- trunk/src/gnome-mud.h	(original)
+++ trunk/src/gnome-mud.h	Sat Jun 21 04:06:35 2008
@@ -21,7 +21,7 @@
 
 #include <stdio.h>
 #include <vte/vte.h>
-#include <libgnetwork/gnetwork.h>
+//#include <libgnetwork/gnetwork.h>
 
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>

Modified: trunk/src/modules.c
==============================================================================
--- trunk/src/modules.c	(original)
+++ trunk/src/modules.c	Sat Jun 21 04:06:35 2008
@@ -30,6 +30,7 @@
 #include <gconf/gconf-client.h>
 #include <glib/gi18n.h>
 #include <gtk/gtkdialog.h>
+#include <string.h>
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
@@ -423,7 +424,10 @@
         g_message (_("Error getting plugin handle (%s): %s."), plugin_name, g_module_error());
         goto error;
     } else {
- 		if(!g_module_symbol(new_plugin->handle, "gnomemud_plugin_info", (gpointer *)&new_plugin->info))
+        void *data = &new_plugin->info;
+        gpointer *info = (gpointer *)data;
+        
+ 		if(!g_module_symbol(new_plugin->handle, "gnomemud_plugin_info", info))
         {
             g_message (_("Error, %s not an GNOME-Mud module: %s."), plugin_name, g_module_error());
             goto error;

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Sat Jun 21 04:06:35 2008
@@ -26,6 +26,8 @@
 #include <gtk/gtkmenu.h>
 #include <glib/gqueue.h>
 #include <vte/vte.h>
+#include <gnet.h>
+#include <string.h>
 
 #include "gnome-mud.h"
 #include "mud-connection-view.h"
@@ -64,6 +66,9 @@
 	
 	GQueue *history;
 	guint current_history_index;
+	
+	gchar *hostname;
+	guint port;
 };
 
 static void mud_connection_view_init                     (MudConnectionView *connection_view);
@@ -78,6 +83,7 @@
 static gboolean mud_connection_view_button_press_event   (GtkWidget *widget, GdkEventButton *event, MudConnectionView *view);
 static void mud_connection_view_popup                    (MudConnectionView *view, GdkEventButton *event);
 static void mud_connection_view_reread_profile           (MudConnectionView *view);
+static void mud_connection_view_network_event_cb(GConn *conn, GConnEvent *event, gpointer data);
 
 GType
 mud_connection_view_get_type (void)
@@ -371,9 +377,13 @@
             
     if(connection_view->priv->history)
         g_queue_free(connection_view->priv->history);
-        
-	gnetwork_connection_close(GNETWORK_CONNECTION(connection_view->connection));
-	g_object_unref(connection_view->connection);
+    
+    gnet_conn_disconnect(connection_view->connection);
+    gnet_conn_unref(connection_view->connection);
+    
+	//gnetwork_connection_close(GNETWORK_CONNECTION(connection_view->connection));
+	//g_object_unref(connection_view->connection);
+	
 	g_free(connection_view->priv);
     
 	parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -388,7 +398,7 @@
 	view->priv->connect_string = g_strdup(connect_string);
 }
 
-static void
+/*static void
 mud_connection_view_received_cb(GNetworkConnection *cxn, gconstpointer data, gulong length, gpointer user_data)
 {
 	gint gag;
@@ -476,23 +486,37 @@
 {
 	g_print ("Client Connection: Error:\n\tDomain\t= %s\n\tCode\t= %d\n\tMessage\t= %s\n",
 			 g_quark_to_string (error->domain), error->code, error->message);
-}
+}*/
 
 void
 mud_connection_view_disconnect(MudConnectionView *view)
 {
 	g_assert(view != NULL);
 	
-	gnetwork_connection_close(GNETWORK_CONNECTION(view->connection));
+	gnet_conn_disconnect(view->connection);
+	mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
+	
+	//gnetwork_connection_close(GNETWORK_CONNECTION(view->connection));
 }
 
 void
 mud_connection_view_reconnect(MudConnectionView *view)
 {
+    gchar *buf;
+    
 	g_assert(view != NULL);
 	
-	gnetwork_connection_close(GNETWORK_CONNECTION(view->connection));
-	gnetwork_connection_open(GNETWORK_CONNECTION(view->connection));
+	gnet_conn_disconnect(view->connection);
+	mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
+	
+	buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"), 
+	    view->priv->hostname, view->priv->port);
+	mud_connection_view_add_text(view, buf, System);
+	
+	gnet_conn_connect(view->connection);
+	
+	//gnetwork_connection_close(GNETWORK_CONNECTION(view->connection));
+	//gnetwork_connection_open(GNETWORK_CONNECTION(view->connection));
 }
 
 void
@@ -509,7 +533,15 @@
 	for (command = g_list_first(commands); command != NULL; command = command->next)
 	{
 		text = g_strdup_printf("%s\r\n", (gchar *) command->data);
-		gnetwork_connection_send(GNETWORK_CONNECTION(view->connection), text, strlen(text));
+		
+		// Give plugins first crack at it.
+		mud_window_handle_plugins(view->priv->window, view->priv->id, 
+		    (gchar *)text, 0);
+		    
+		gnet_conn_write(view->connection, text, strlen(text));
+		
+		//gnetwork_connection_send(GNETWORK_CONNECTION(view->connection), text, strlen(text));
+		
 		if (view->priv->profile->preferences->EchoText)
 			mud_connection_view_add_text(view, text, Sent);
 		g_free(text);
@@ -722,12 +754,22 @@
    	GdkGeometry hints;
    	gint xpad, ypad;
    	gint char_width, char_height;
+   	gchar *buf;
 
 	g_assert(hostname != NULL);
 	g_assert(port > 0);
 	
 	view = g_object_new(MUD_TYPE_CONNECTION_VIEW, NULL);
-	view->connection = g_object_new(GNETWORK_TYPE_TCP_CONNECTION,
+	
+	view->priv->hostname = g_strdup(hostname);
+	view->priv->port = port;
+	
+	view->connection = gnet_conn_new(hostname, port, 
+	    mud_connection_view_network_event_cb, view);
+	gnet_conn_ref(view->connection);
+	gnet_conn_set_watch_error(view->connection, TRUE);
+	   
+	/*view->connection = g_object_new(GNETWORK_TYPE_TCP_CONNECTION,
 									"address", hostname,
 									"port", port,
 									"authentication-type", GNETWORK_SSL_AUTH_ANONYMOUS,
@@ -737,11 +779,12 @@
 	g_signal_connect(view->connection, "sent", G_CALLBACK(mud_connection_view_send_cb), view);
 	g_signal_connect(view->connection, "error", G_CALLBACK(mud_connection_view_error_cb), view);
 	g_signal_connect(view->connection, "notify::tcp-status", G_CALLBACK(mud_connection_view_notify_cb), view);
+	*/
 
 	mud_connection_view_set_profile(view, mud_profile_new(profile));
 	
 	// FIXME, move this away from here
-	gnetwork_connection_open(GNETWORK_CONNECTION(view->connection));
+	//gnetwork_connection_open(GNETWORK_CONNECTION(view->connection));
 
 	/* Let us resize the gnome-mud window */
 	vte_terminal_get_padding(VTE_TERMINAL(view->priv->terminal), &xpad, &ypad);
@@ -766,6 +809,12 @@
 	view->priv->tray = MUD_TRAY(tray);
 	
 	view->priv->log = mud_log_new(name);
+	
+	buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"), 
+	    view->priv->hostname, view->priv->port);
+	mud_connection_view_add_text(view, buf, System);
+	
+	gnet_conn_connect(view->connection);
 
 	return view;
 }
@@ -835,3 +884,72 @@
     
     return history_item;
 }
+
+static void
+mud_connection_view_network_event_cb(GConn *conn, GConnEvent *event, gpointer pview)
+{
+    gint gag;
+	gint pluggag;
+    MudConnectionView *view = MUD_CONNECTION_VIEW(pview);
+    g_assert(view != NULL);
+    
+    switch(event->type)
+    {
+        case GNET_CONN_ERROR:
+            mud_connection_view_add_text(view, _("*** Could not connect."), Error);
+        break;
+        
+        case GNET_CONN_CONNECT:
+            mud_connection_view_add_text(view, _("*** Connected.\n"), System);
+            gnet_conn_read(view->connection);
+        break;
+        
+        case GNET_CONN_CLOSE:
+            mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
+        break;
+        
+        case GNET_CONN_TIMEOUT:
+        break;
+        
+        case GNET_CONN_READ:
+	        if(!view->priv->connected)
+	        {
+		        view->priv->connected = TRUE;
+		        mud_tray_update_icon(view->priv->tray, online);
+	        }
+	
+	           gag = mud_parse_base_do_triggers(view->priv->parse, 
+	                event->buffer);
+	           mud_window_handle_plugins(view->priv->window, view->priv->id, 
+	                event->buffer, 1);
+	                
+	           pluggag = PluginGag;
+	           PluginGag = FALSE;
+	
+	        if(!gag && !pluggag)
+	        {
+		        vte_terminal_feed(VTE_TERMINAL(view->priv->terminal), 
+		            event->buffer, event->length);
+		        mud_log_write_hook(view->priv->log, event->buffer, event->length);
+	        }
+
+            if (view->priv->connect_hook) {
+                mud_connection_view_send (view, view->priv->connect_string);
+                g_free(view->priv->connect_string);
+                view->priv->connect_hook = FALSE;
+            }
+            
+            gnet_conn_read(view->connection);
+        break;
+        
+        case GNET_CONN_WRITE:
+        break;
+        
+        case GNET_CONN_READABLE:
+        break;
+        
+        case GNET_CONN_WRITABLE:
+        break;
+    }
+}
+

Modified: trunk/src/mud-connection-view.h
==============================================================================
--- trunk/src/mud-connection-view.h	(original)
+++ trunk/src/mud-connection-view.h	Sat Jun 21 04:06:35 2008
@@ -4,7 +4,8 @@
 G_BEGIN_DECLS
 
 #include <gtk/gtkwidget.h>
-#include <libgnetwork/gnetwork.h>
+//#include <libgnetwork/gnetwork.h>
+#include <gnet.h>
 
 
 #define MUD_TYPE_CONNECTION_VIEW               (mud_connection_view_get_type ())
@@ -24,7 +25,7 @@
 
 	MudConnectionViewPrivate *priv;
 
-	GNetworkTcpConnection *connection;
+	GConn *connection;
 };
 
 struct _MudConnectionViewClass

Modified: trunk/src/mud-parse-base.c
==============================================================================
--- trunk/src/mud-parse-base.c	(original)
+++ trunk/src/mud-parse-base.c	Sat Jun 21 04:06:35 2008
@@ -22,6 +22,8 @@
 
 #include <glib-object.h>
 #include <glib/gi18n.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "mud-regex.h" 
 #include "mud-parse-base.h"   

Modified: trunk/src/mud-window-mconnect.c
==============================================================================
--- trunk/src/mud-window-mconnect.c	(original)
+++ trunk/src/mud-window-mconnect.c	Sat Jun 21 04:06:35 2008
@@ -23,6 +23,7 @@
 #include <gconf/gconf-client.h>
 #include <glib/gi18n.h>
 #include <glade/glade-xml.h>
+#include <string.h>
 
 #include "gnome-mud.h"
 #include "mud-connection-view.h"

Modified: trunk/src/mud-window-mudedit.c
==============================================================================
--- trunk/src/mud-window-mudedit.c	(original)
+++ trunk/src/mud-window-mudedit.c	Sat Jun 21 04:06:35 2008
@@ -24,6 +24,8 @@
 #include <glib/gi18n.h>
 #include <glib-object.h>
 #include <glade/glade-xml.h>
+#include <string.h>
+#include <stdlib.h>
 
 #include "gnome-mud.h"
 #include "gconf-helper.h"

Modified: trunk/src/mud-window-mudlist.c
==============================================================================
--- trunk/src/mud-window-mudlist.c	(original)
+++ trunk/src/mud-window-mudlist.c	Sat Jun 21 04:06:35 2008
@@ -23,6 +23,7 @@
 #include <gconf/gconf-client.h>
 #include <glade/glade-xml.h>
 #include <glib/gi18n.h>
+#include <string.h>
 
 #include "gnome-mud.h"
 #include "mud-connection-view.h"

Modified: trunk/src/mud-window-profile.c
==============================================================================
--- trunk/src/mud-window-profile.c	(original)
+++ trunk/src/mud-window-profile.c	Sat Jun 21 04:06:35 2008
@@ -23,6 +23,7 @@
 #include <gconf/gconf-client.h>
 #include <glade/glade-xml.h>
 #include <glib/gi18n.h>
+#include <string.h>
 
 #include "gnome-mud.h"
 #include "mud-connection-view.h"

Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c	(original)
+++ trunk/src/mud-window.c	Sat Jun 21 04:06:35 2008
@@ -40,6 +40,7 @@
 #include <gtk/gtkimagemenuitem.h>
 #include <vte/vte.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "gnome-mud.h"
 #include "mud-connection-view.h"
@@ -365,17 +366,51 @@
 static void
 mud_window_about_cb(GtkWidget *widget, MudWindow *window)
 {
-	GtkWidget *dialog;
-	GladeXML *glade;
-	
-	glade = glade_xml_new(GLADEDIR "/main.glade", "about_window", NULL);
-	dialog = glade_xml_get_widget(glade, "about_window");
-
-	gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION);
-	gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dialog), "GNOME-Mud Homepage");
-	gtk_dialog_run(GTK_DIALOG(dialog));
-	
-	g_object_unref(glade);	
+    static const gchar * const authors[] = {
+        "Robin Ericsson <lobbin localhost nu>",
+        "Jordi Mallach <jordi sindominio net>",
+        "Daniel Patton <seven-nation army com>",
+        "Les Harris <me lesharris com>",
+        NULL
+    };
+    
+    static const gchar * const documenters[] = {
+        "Jordi Mallach <jordi sindominio net>",
+        "Petter E. Stokke <gibreel project23 no>",
+        NULL
+    };
+    
+    static const gchar * const artists[] = {
+        "Daniel Taylor <DanTaylor web de>",
+        "Andreas Nilsson <andreasn gnome org>",
+        NULL
+    };
+    
+    static const gchar copyright[] = "Copyright \xc2\xa9 1998-2008 Robin Ericsson";
+    
+    static const gchar comments[] = N_("A Multi-User Dungeon (MUD) client for GNOME");
+    
+    GdkPixbuf *logo;
+    
+    logo = gdk_pixbuf_new_from_file_at_size(GMPIXMAPSDIR "/gnome-mud.svg", 
+        128, 128, NULL);
+    
+    gtk_show_about_dialog(GTK_WINDOW(window->priv->window),
+        "artists", artists,
+        "authors", authors,
+        "comments", _(comments),
+        "copyright", copyright,
+        "documenters", documenters,
+        "logo", logo,
+        "translator-credits", _("translator-credits"),
+        "version", VERSION,
+        "website", "http://amcl.sourceforge.net/";,
+        "name", "gnome-mud",
+        NULL);
+        
+    if(logo)
+        g_object_unref(logo);
+    
 }
 
 static void

Modified: trunk/ui/main.glade
==============================================================================
--- trunk/ui/main.glade	(original)
+++ trunk/ui/main.glade	Sat Jun 21 04:06:35 2008
@@ -608,7 +608,7 @@
   <property name="authors">Robin Ericsson &lt;lobbin localhost nu&gt;
 Jordi Mallach &lt;jordi sindominio net&gt;
 Daniel Patton &lt;seven-nation army com&gt;
-Les Harris &lt;hl harris comcast net&gt;</property>
+Les Harris &lt;me lesharris com&gt;</property>
   <property name="documenters">Jordi Mallach &lt;jordi sindominio net&gt;
 Petter E. Stokke &lt;gibreel project23 no&gt;</property>
   <property name="artists">Daniel Taylor &lt;DanTaylor web de&gt;



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