gok r2512 - in branches/rm-dep: . gok



Author: gerdk
Date: Fri Jul 25 10:27:42 2008
New Revision: 2512
URL: http://svn.gnome.org/viewvc/gok?rev=2512&view=rev

Log:
2008-07-25  Gerd Kohlberger  <gerdk svn gnome org>

	* gok/gok-keyboard.c: Cleanup includes.
	Migrate to GtkAboutDialog (Patch by Chrisitan Kirbach, bug #435973)

	* gok/gok-keyboard.h: Use G_*_DECLS.



Modified:
   branches/rm-dep/ChangeLog
   branches/rm-dep/gok/gok-keyboard.c
   branches/rm-dep/gok/gok-keyboard.h

Modified: branches/rm-dep/gok/gok-keyboard.c
==============================================================================
--- branches/rm-dep/gok/gok-keyboard.c	(original)
+++ branches/rm-dep/gok/gok-keyboard.c	Fri Jul 25 10:27:42 2008
@@ -23,13 +23,14 @@
 #  include <config.h>
 #endif
 
+#include <math.h>
+#include <glib/gi18n.h>
+
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #define XK_LATIN1
 #include <X11/keysymdef.h> /* ugh, needed by link following hack */
-#include <assert.h>
-#include <gdk/gdk.h>
-#include <math.h>
+
 #include "gok-keyboard.h"
 #include "gok-mousecontrol.h"
 #include "callbacks.h"
@@ -59,7 +60,7 @@
 #define BUG_133323_LIVES
 
 /* TODO: i18n */
-#define CORE_KEYBOARD "Keyboard"
+#define CORE_KEYBOARD  "Keyboard"
 
 #define ALPHA_KEYBOARD "Alpha"
 
@@ -3628,15 +3629,9 @@
  *
  **/
 void
-gok_keyboard_about (GokKey *pKey) 
+gok_keyboard_about (GokKey *pKey)
 {
-	static GtkWidget *about = NULL, *hbox = NULL;
-	GdkPixbuf	 *pixbuf = NULL;
-	GError		 *error = NULL;
-	gchar		 *file = NULL;
-	
-	
-	static const gchar *authors [] = {
+	static const gchar *authors[] = {
 		"David Bolter <david bolter utoronto ca>",
 		"Bill Haneman <bill haneman sun com>",
 		"Chris Ridpath <chris ridpath utoronto ca>",
@@ -3644,64 +3639,22 @@
 		"Gnome Accessibility <gnome-accessibility-devel gnome org>",
 		NULL
 	};
-	
-	const gchar *documenters[] = {
-		NULL
-	};
-	
-	const gchar *translator_credits = _("translator-credits");
-	
-	if (about) {
-		gtk_window_set_screen (
-			GTK_WINDOW (about),
-			gtk_widget_get_screen (GTK_WIDGET (gok_main_get_main_window ())));
-		gtk_window_present (GTK_WINDOW (about));
-		return;
-	}
-		
-	file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR, 
-					  "gok.png", 
-					  FALSE, NULL);
-	if (file) {
-		pixbuf = gdk_pixbuf_new_from_file (file, &error);
-		if (error) {
-		    g_warning (G_STRLOC ": cannot open %s: %s", file, error->message);
-		    g_error_free (error);
-		}
-		g_free (file);
-	}
-	
-	about = gnome_about_new (
-		_("GOK"), VERSION,
-		"Copyright (C) 2001-2003 Sun Microsystems, Copyright (C) 2001-2003 University of Toronto", 
-		_("Dynamic virtual keyboards for the GNOME desktop"),
-		authors,
-		documenters,
-		strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL,
-		pixbuf);
-	
-	/* stealing a hack from gnumeric */
-	hbox = gtk_hbox_new (TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (hbox),
-		gnome_href_new ("http://www.gok.ca/credits.html";, _("Full Credits")),
-		FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox),
-				hbox, TRUE, FALSE, 0);
-	gtk_widget_show_all (hbox);
-		
-	if (pixbuf)
-		gdk_pixbuf_unref (pixbuf);
-			
-	gtk_window_set_wmclass (GTK_WINDOW (about), "gok", "GOK");
-	gtk_window_set_screen (GTK_WINDOW (about),
-				   gtk_widget_get_screen (GTK_WIDGET (gok_main_get_main_window ())));
-	g_signal_connect (about, "destroy",
-			  G_CALLBACK (gtk_widget_destroyed),
-			  &about);
-	/* make it 'normal' to avoid occluding GOK main window */
-	gtk_window_set_type_hint (GTK_WINDOW (about), GDK_WINDOW_TYPE_HINT_NORMAL);
-	gtk_window_set_position (GTK_WINDOW (about), GTK_WIN_POS_CENTER);
-	gtk_widget_show (about);
+
+	gtk_show_about_dialog (GTK_WINDOW (gok_main_get_main_window ()),
+		"program-name", _("GOK"),
+		"version", VERSION,
+		"copyright", "Copyright (C) 2001-2008 Sun Microsystems\n"
+			     "Copyright (C) 2001-2008 University of Toronto",
+		"comments", _("Dynamic virtual keyboards for the GNOME desktop"),
+		"authors", authors,
+		"translator-credits", _("translator-credits"),
+		"website", "http://www.gok.ca/credits.html";,
+		"website-label", _("Full Credits"),
+		"logo-icon-name", "gok",
+		"title", _("About GOK"),
+		/* avoid occluding GOK main window */
+		"window-position", GTK_WIN_POS_CENTER,
+		NULL);
 }
 
 /**

Modified: branches/rm-dep/gok/gok-keyboard.h
==============================================================================
--- branches/rm-dep/gok/gok-keyboard.h	(original)
+++ branches/rm-dep/gok/gok-keyboard.h	Fri Jul 25 10:27:42 2008
@@ -22,24 +22,17 @@
 #ifndef __GOKKEYBOARD_H__
 #define __GOKKEYBOARD_H__
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <gnome.h>
+#include <gtk/gtk.h>
 #include <libxml/xmlmemory.h>
-#include <glib.h>
-#include <X11/Xlib.h>
 #include <X11/XKBlib.h>
 #include <X11/extensions/XKBgeom.h>
+
 #include "gok-spy.h"
 #include "gok-key.h"
 #include "gok-chunker.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
-	
 /* keyboards can be assigned a both layout type and a shape type, eventually
 	there will be implementations for the various combinations */
 
@@ -214,8 +207,6 @@
 gboolean gok_keyboard_update_dynamic_keys (GokKeyboard *pKeyboard, GokSpyUIFlags change_mask, GokSpyUIFlags flags);
 gint gok_keyboard_set_predictions (GokKeyboard *pKeyboard, gchar **list, gchar *add_word);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* #ifndef __GOKKEYBOARD_H__ */



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