[Goodies-commits] r4884 - in xfce4-datetime-plugin/trunk: . panel-plugin

Diego Ongaro ongardie at xfce.org
Tue Jun 3 21:30:18 CEST 2008


Author: ongardie
Date: 2008-06-03 19:30:18 +0000 (Tue, 03 Jun 2008)
New Revision: 4884

Modified:
   xfce4-datetime-plugin/trunk/ChangeLog
   xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c
Log:
Add help button that opens web site (Bug #4099).

Thanks to Nick Schermer's r2263 of the xfce4-battery-plugin.


Modified: xfce4-datetime-plugin/trunk/ChangeLog
===================================================================
--- xfce4-datetime-plugin/trunk/ChangeLog	2008-06-02 06:23:27 UTC (rev 4883)
+++ xfce4-datetime-plugin/trunk/ChangeLog	2008-06-03 19:30:18 UTC (rev 4884)
@@ -1,3 +1,9 @@
+2008-06-03	Diego Ongaro <ongardie at gmail.com>
+
+	* panel-plugin/datetime-dialog.c: Add help button that opens web site
+	(Bug #4099). Thanks to Nick Schermer's r2263 of the
+	xfce4-battery-plugin.
+
 2008-05-31	Diego Ongaro <ongardie at gmail.com>
 
 	* panel-plugin/datetime.c: Steve Tyler's updated comments, etc (Bug #4117)

Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c	2008-06-02 06:23:27 UTC (rev 4883)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c	2008-06-03 19:30:18 UTC (rev 4884)
@@ -34,6 +34,8 @@
 #include "datetime.h"
 #include "datetime-dialog.h"
 
+#define PLUGIN_WEBSITE  "http://goodies.xfce.org/projects/panel-plugins/xfce4-datetime-plugin"
+
 /* Layouts */
 static const char *layout_strs[] = {
   N_("Date only"),
@@ -265,16 +267,29 @@
  * user closed the properties dialog
  */
 static void
-datetime_dialog_response(GtkWidget *dlg, int foo, t_datetime *dt)
+datetime_dialog_response(GtkWidget *dlg, int response, t_datetime *dt)
 {
+  gboolean result;
+
   if(dt == NULL)
     return;
 
-  g_object_set_data(G_OBJECT(dt->plugin), "dialog", NULL);
+  if (response == GTK_RESPONSE_HELP)
+  {
+      /* show help */
+      result = g_spawn_command_line_async("exo-open --launch WebBrowser " PLUGIN_WEBSITE, NULL);
 
-  gtk_widget_destroy(dlg);
-  xfce_panel_plugin_unblock_menu(dt->plugin);
-  datetime_write_rc_file(dt->plugin, dt);
+      if (G_UNLIKELY(result == FALSE))
+          g_warning(_("Unable to open the following url: %s"), PLUGIN_WEBSITE);
+  }
+  else
+  {
+    g_object_set_data(G_OBJECT(dt->plugin), "dialog", NULL);
+
+    gtk_widget_destroy(dlg);
+    xfce_panel_plugin_unblock_menu(dt->plugin);
+    datetime_write_rc_file(dt->plugin, dt);
+  }
 }
 
 /*
@@ -307,7 +322,9 @@
   dlg = xfce_titled_dialog_new_with_buttons(_("Datetime properties"),
       NULL, /* or: GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(plugin))), */
       GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-      GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL);
+      GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+      GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+      NULL);
 
   g_object_set_data(G_OBJECT(plugin), "dialog", dlg);
 




More information about the Goodies-commits mailing list