gnome-games r8206 - trunk/dependencies/ggz-gtk



Author: thomashpa
Date: Mon Oct 27 20:39:34 2008
New Revision: 8206
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8206&view=rev

Log:
Remove libgnome dependency from ggz-gtk

Modified:
   trunk/dependencies/ggz-gtk/chat.c
   trunk/dependencies/ggz-gtk/client.c
   trunk/dependencies/ggz-gtk/login.c

Modified: trunk/dependencies/ggz-gtk/chat.c
==============================================================================
--- trunk/dependencies/ggz-gtk/chat.c	(original)
+++ trunk/dependencies/ggz-gtk/chat.c	Mon Oct 27 20:39:34 2008
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h> /* For strcasecmp */
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
@@ -53,8 +54,6 @@
 #endif
 
 #include <glib.h>
-#include <gnome.h>
-#include <libgnome/libgnome.h>
 
 #include "chat.h"
 #include "client.h"
@@ -634,11 +633,11 @@
 
 	/* Check for URLs */
 	if (!strncasecmp (word, "ftp.", 4))
-		return WORD_URL;
+		return WORD_HOST;
 	if (!strncasecmp (word, "ftp://";, 6))
 		return WORD_URL;
 	if (!strncasecmp (word, "www.", 4))
-		return WORD_URL;
+		return WORD_HOST;
 	if (!strncasecmp (word, "http://";, 7))
 		return WORD_URL;
 	if (!strncasecmp (word, "https://";, 8))
@@ -707,6 +706,7 @@
         GdkEventButton *event)
 {
 	GError *err = NULL;
+	char *url;
 
 	switch(chat_checkurl(xtext, word))
 	{
@@ -714,8 +714,12 @@
 			login_goto_server(word);
 			break;
 		case WORD_HOST:
+			url = g_strconcat ("http://";, word, NULL);
+			gtk_show_uri (NULL, url, GDK_CURRENT_TIME, &err);
+			g_free (url);
+			break;
 		case WORD_URL:
-			 gnome_url_show (word, &err);
+			gtk_show_uri (NULL, word, GDK_CURRENT_TIME, &err);
 			break;
 		default:
 			break;

Modified: trunk/dependencies/ggz-gtk/client.c
==============================================================================
--- trunk/dependencies/ggz-gtk/client.c	(original)
+++ trunk/dependencies/ggz-gtk/client.c	Mon Oct 27 20:39:34 2008
@@ -37,8 +37,8 @@
 
 #include <ggz.h> /* For list functions */
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <gnome.h>
 #include <ggzcore.h>
 
 #include "about.h"
@@ -279,7 +279,41 @@
 client_contents_activate			(GtkMenuItem	*menuitem,
 					 	 gpointer	 data)
 {
-	gnome_help_display (embedded_game_help_file, "network-games", NULL);
+	GtkWidget *window;
+	GdkScreen *screen;
+	GError *error = NULL;
+	char *help_string;
+	char *game_name;
+	char *ptr;
+
+	game_name = g_strdup (embedded_game_help_file);
+	ptr = g_strrstr (game_name, ".xml");
+	if (ptr != NULL)
+		*ptr = 0;
+
+	window = gtk_widget_get_toplevel (GTK_WIDGET (menuitem));
+	screen = gtk_widget_get_screen (GTK_WIDGET (window));
+
+	help_string = g_strconcat("ghelp:", game_name, "?", "network-games", NULL);
+
+	gtk_show_uri (NULL, help_string, gtk_get_current_event_time (), &error);
+
+	if (error != NULL)
+	{
+		GtkWidget *d;
+		d = gtk_message_dialog_new (GTK_WINDOW (window), 
+                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
+                                    "%s", _("Unable to open help file"));
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
+                                                  "%s", error->message);
+		g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+		gtk_window_present (GTK_WINDOW (d));
+
+		g_error_free (error);
+	}
+	g_free (game_name);
+	g_free (help_string);
 }
 
 

Modified: trunk/dependencies/ggz-gtk/login.c
==============================================================================
--- trunk/dependencies/ggz-gtk/login.c	(original)
+++ trunk/dependencies/ggz-gtk/login.c	Mon Oct 27 20:39:34 2008
@@ -36,8 +36,8 @@
 #include <unistd.h>
 
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <gnome.h>
 
 #include <ggz.h>
 #include <ggzcore.h>
@@ -308,7 +308,41 @@
 
 static void login_help_button_clicked(GtkButton * button, gpointer data)
 {
-	gnome_help_display (embedded_game_help_file, "network-games", NULL);
+	GtkWidget *window;
+	GdkScreen *screen;
+	GError *error = NULL;
+	char *help_string;
+	char *game_name;
+	char *ptr;
+
+	game_name = g_strdup (embedded_game_help_file);
+	ptr = g_strrstr (game_name, ".xml");
+	if (ptr != NULL)
+		*ptr = 0;
+
+	window = gtk_widget_get_toplevel (GTK_WIDGET (button));
+	screen = gtk_widget_get_screen (GTK_WIDGET (window));
+
+	help_string = g_strconcat("ghelp:", game_name, "?", "network-games", NULL);
+
+	gtk_show_uri (NULL, help_string, gtk_get_current_event_time (), &error);
+
+	if (error != NULL)
+	{
+		GtkWidget *d;
+		d = gtk_message_dialog_new (GTK_WINDOW (window), 
+                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
+                                    "%s", _("Unable to open help file"));
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
+                                                  "%s", error->message);
+		g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+		gtk_window_present (GTK_WINDOW (d));
+
+		g_error_free (error);
+	}
+	g_free (game_name);
+	g_free (help_string);
 }
 
 static void login_start_session(void)



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