]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
ported to GtkAboutDialog by Pedro Villavicencio Garrido
authorDaniel Carbonell Fraj <bocata@src.gnome.org>
Fri, 1 Apr 2005 19:04:26 +0000 (19:04 +0000)
committerDaniel Carbonell Fraj <bocata@src.gnome.org>
Fri, 1 Apr 2005 19:04:26 +0000 (19:04 +0000)
ChangeLog
src/commands.c
src/commands.h

index 95960000e24d75cbdf359ee463321b873f74f979..b17b2661ceb2b067d98800975963c5a02a5d4414 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-26  Pedro Villavicencio Garrido  <pvillavi@gnome.org> 
+
+       * src/commands.c (about_command): use GtkAboutDialog instead 
+       of deprecated GnomeAbout.
+       (handle_links): added for handle the links in the about dialog.
+       * src/commands.h (handle_links): added to the function list.
+
 2005-03-29  Alexander Shopov  <ash@contact.bg>
 
        * configure.in: Added "bg" (Bulgarian) to ALL_LINGUAS
index 280b0a964075d1cef852106ef1c105091bec8b1b..212ca1f65936767d398bd60222ae69484e3d042f 100644 (file)
@@ -265,56 +265,70 @@ void commands_checkstate ()
     else partyline_status (_("Not connected"));
 }
 
+enum {
+       LINK_TYPE_EMAIL,
+       LINK_TYPE_URL
+};
+/* handle the links */
+
+void handle_links (GtkAboutDialog *about G_GNUC_UNUSED, const gchar *link, gpointer data)
+{
+    gchar *new_link;
+
+    switch (GPOINTER_TO_INT (data)) {
+    case LINK_TYPE_EMAIL:
+           new_link = g_strdup_printf ("mailto: %s", link);
+           break;
+    case LINK_TYPE_URL:
+           new_link = g_strdup (link);
+           break;
+    default:
+           g_assert_not_reached ();
+    }
 
+    if (!gnome_url_show (new_link, NULL)){
+           g_warning ("Unable to follow link %s\n", link);
+    }
+    
+    g_free (new_link);
+}
 /* about... */
 
 void about_command (void)
 {
-    GtkWidget *hbox;
     GdkPixbuf *logo;
-    static GtkWidget *about = NULL;
-
-    if (!GTK_IS_WINDOW (about))
-    {
-      const char *authors[] = {"Ka-shu Wong <kswong@zip.com.au>",
-                               "James Antill <james@and.org>",
-                              "Jordi Mallach <jordi@sindominio.net>",
-                              "Dani Carbonell <bocata@panete.net>",
-                               NULL};
-      const char *documenters[] = {"Jordi Mallach <jordi@sindominio.net>",
-                                   NULL};
-      /* Translators: translate as your names & emails */
-      const char *translators = _("translator_credits");
-
-      logo = gdk_pixbuf_new_from_file (PIXMAPSDIR "/gtetrinet.png", NULL);
+  
+    const char *authors[] = {"Ka-shu Wong <kswong@zip.com.au>",
+                            "James Antill <james@and.org>",
+                            "Jordi Mallach <jordi@sindominio.net>",
+                            "Dani Carbonell <bocata@panete.net>",
+                            NULL};
+    const char *documenters[] = {"Jordi Mallach <jordi@sindominio.net>",
+                                NULL};
+    /* Translators: translate as your names & emails */
+    const char *translators = _("translator_credits");
+
+    logo = gdk_pixbuf_new_from_file (PIXMAPSDIR "/gtetrinet.png", NULL);
     
-      about = gnome_about_new (APPNAME, APPVERSION,
-                               "\xc2\xa9 1999, 2000, 2001, 2002, 2003 Ka-shu Wong",
-                               _("A Tetrinet client for GNOME.\n"),
-                               authors,
-                               documenters,
-                             strcmp (translators, "translator_credits") != 0 ?
-                                      translators : NULL,
-                             logo);
-
-      if (logo != NULL)
-                 g_object_unref (logo);
-
-      hbox = gtk_hbox_new (TRUE, 0);
-      gtk_box_pack_start (GTK_BOX (hbox),
-                 gnome_href_new ("http://gtetrinet.sourceforge.net/", _("GTetrinet Home Page")),
-                 FALSE, FALSE, 0);
-      gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox),
-                         hbox, TRUE, FALSE, 0);
-      gtk_widget_show_all (hbox);
-
-      g_signal_connect(G_OBJECT(about), "destroy",
-                      G_CALLBACK(gtk_widget_destroyed), &about);
-
-      gtk_widget_show (about);
-    }
-    else
-    {
-      gtk_window_present (GTK_WINDOW (about));
-    }
+    gtk_about_dialog_set_email_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
+                                    GINT_TO_POINTER (LINK_TYPE_EMAIL), NULL);
+    
+    gtk_about_dialog_set_url_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
+                                  GINT_TO_POINTER (LINK_TYPE_URL), NULL);
+  
+    gtk_show_about_dialog (NULL,
+                          "name", APPNAME, 
+                          "version", APPVERSION,
+                          "copyright", "Copyright \xc2\xa9 2004, 2005 Jordi Mallach, Dani Carbonell\nCopyright \xc2\xa9 1999, 2000, 2001, 2002, 2003 Ka-shu Wong",
+                          "comments", _("A Tetrinet client for GNOME.\n"),
+                          "authors", authors,
+                          "documenters", documenters,
+                          "translator-credits", strcmp (translators, "translator_credits") != 0 ? translators : NULL,
+                          "logo", logo,
+                          "website", "http://gtetrinet.sf.net",
+                          "website-label", "GTetrinet Home Page",
+                          NULL);
+    
+    if (logo != NULL)
+           g_object_unref (logo);
 }
index 0aee2fd88ecb63dff6e2de12bc44e4ae4f800981..6560587ec00b9f24186b353d8a0c5d21ddbd4ea5 100644 (file)
@@ -20,3 +20,4 @@ void show_connect_button (void);
 void show_disconnect_button (void);
 
 void commands_checkstate (void);
+void handle_links (GtkAboutDialog *about G_GNUC_UNUSED, const gchar *link, gpointer data);