From f0ffaaf3e333ddae3d1b04bf7ce4ac64898a4d84 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 24 Mar 2010 22:43:30 -0400 Subject: [PATCH] Replaced the XfceAboutDialog with a GtkAboutDialog. Replaced libxfcegui4 with libxfce4ui. --- panel-plugin/xfce4-hdaps-dialogs.c | 76 ++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/panel-plugin/xfce4-hdaps-dialogs.c b/panel-plugin/xfce4-hdaps-dialogs.c index 7878e41..d57b8f4 100644 --- a/panel-plugin/xfce4-hdaps-dialogs.c +++ b/panel-plugin/xfce4-hdaps-dialogs.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #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 ", 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)); } -- 2.44.2