]> gitweb.michael.orlitzky.com - xfce4-hdaps.git/commitdiff
Replaced the XfceAboutDialog with a GtkAboutDialog.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 25 Mar 2010 02:43:30 +0000 (22:43 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 25 Mar 2010 02:43:30 +0000 (22:43 -0400)
Replaced libxfcegui4 with libxfce4ui.

panel-plugin/xfce4-hdaps-dialogs.c

index 7878e418089081a930df3fcf584a955efc162df6..d57b8f4070bd4dddd0253970f8b84fc48f5392de 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <string.h>
 #include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include "xfce4-hdaps-dialogs.h"
 #include "hdaps.h"
@@ -188,35 +188,61 @@ void hdaps_configure(XfcePanelPlugin *plugin,
 
 
 
+
+/* URL handler used on the About dialog. */
+static void hdaps_url_handler(GtkAboutDialog *about,
+                             const gchar *link,
+                             gpointer data) {
+    gchar *cmd;
+
+    cmd = g_strdup_printf("%s %s","xdg-open", link);
+
+    /* Stolen from xfce4-power-manager. */
+    if (!g_spawn_command_line_async(cmd, NULL)) {
+      g_free(cmd);
+      cmd = g_strdup_printf("%s %s","xfbrowser4", link);
+      g_spawn_command_line_async(cmd, NULL);
+    }
+    g_free(cmd);
+}
+
+
+/* Email address handler used on the About dialog. */
+static void hdaps_mailto_handler(GtkAboutDialog *about,
+                                const gchar *link,
+                                gpointer data) {
+    gchar *cmd = g_strdup_printf( "%s %s", "xdg-email", link);
+
+    g_spawn_command_line_async(cmd, NULL);
+    g_free(cmd);
+}
+
+
 void hdaps_about(XfcePanelPlugin *plugin) {
   GdkPixbuf *icon;
-  GtkWidget *dialog;
-  XfceAboutInfo *about;
-
-  /* Send NULL as our license, since GPL >= 3 is not
-     supported yet. I don't particularly care if people
-     want to re-license under GPL2, but I also don't want
-     to cause any unnecessary confusion. */
-  about = xfce_about_info_new("xfce4-hdaps",
-                             VERSION,
-                             _("An HDAPS Plugin for XFCE4"),
-                             XFCE_COPYRIGHT_TEXT("2010", "Michael Orlitzky"),
-                             NULL);
-  
-  xfce_about_info_set_homepage(about, PLUGIN_WEBSITE);
-  
-  xfce_about_info_add_credit(about,
-                            "Michael Orlitzky",
-                            "michael@orlitzky.com",
-                            _("A Reasonable Man"));
+
+  const gchar *authors[] = { "Michael Orlitzky <michael@orlitzky.com>", NULL };
+  const gchar *copyright = "Copyright \302\251 2010 Michael Orlitzky";
+
+  gtk_about_dialog_set_url_hook(hdaps_url_handler, NULL, NULL);
+  gtk_about_dialog_set_email_hook(hdaps_mailto_handler, NULL, NULL);
 
   icon = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
-                                 "xfce4-hdaps",
+                                 PACKAGE_NAME,
                                  48, 0, NULL);
   
-  dialog = xfce_about_dialog_new_with_values(NULL, about, icon);
-  xfce_about_info_free(about);
-  gtk_dialog_run(GTK_DIALOG(dialog));
-  gtk_widget_destroy(dialog);
+  gtk_show_about_dialog(NULL,
+                       "authors", authors,
+                       "copyright", copyright,
+                       "destroy-with-parent", TRUE,
+                       "license", LICENSE_GPL3,
+                       "logo", icon,
+                       "logo-icon-name", PACKAGE_NAME,
+                       "name", PACKAGE_NAME,
+                       "version", PACKAGE_VERSION,
+                       "website", PLUGIN_WEBSITE,
+                       "website-label", "xfce4-hdaps homepage",
+                       NULL);
+
   g_object_unref(G_OBJECT(icon));
 }