Index: plugins/clock/clock.h =================================================================== --- plugins/clock/clock.h (Revision 27990) +++ plugins/clock/clock.h (Arbeitskopie) @@ -22,6 +22,7 @@ #include #include +#include #include G_BEGIN_DECLS @@ -80,6 +81,8 @@ guint show_meridiem : 1; guint true_binary : 1; guint flash_separators : 1; + + gchar *command; }; Index: plugins/clock/clock-dialog.c =================================================================== --- plugins/clock/clock-dialog.c (Revision 27990) +++ plugins/clock/clock-dialog.c (Arbeitskopie) @@ -166,14 +166,27 @@ static void -xfce_clock_dialog_tooltip_entry_changed (GtkEntry *entry, +xfce_clock_dialog_execute_command_changed (GtkEditable *editable, + ClockPlugin *clock) +{ + /* cleanup old command */ + g_free (clock->command); + + /* set new command */ + clock->command = gtk_editable_get_chars (editable, 0, -1); +} + + + +static void +xfce_clock_dialog_tooltip_entry_changed (GtkEditable *editable, ClockPlugin *clock) { /* cleanup old format */ g_free (clock->tooltip_format); /* set new format */ - clock->tooltip_format = g_strdup (gtk_entry_get_text (entry)); + clock->tooltip_format = gtk_editable_get_chars (editable, 0, -1); /* restart the tooltip timeout */ xfce_clock_tooltip_sync (clock); @@ -556,9 +569,31 @@ g_object_set_data (G_OBJECT (clock->plugin), I_("configure-dialog-bin"), bin); gtk_widget_show (frame); - /* add the potions */ + /* add the portions */ xfce_clock_dialog_options (clock); + /* execute command */ + frame = xfce_create_framebox (_("Execute Command on Click"), &bin); + gtk_box_pack_start (GTK_BOX (dialog_vbox), frame, FALSE, TRUE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new (FALSE, 8); + gtk_container_add (GTK_CONTAINER (bin), vbox); + gtk_widget_show (vbox); + + entry = gtk_entry_new (); + gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0); +#if GTK_CHECK_VERSION(2, 12, 0) + gtk_widget_set_tooltip_text(entry, _("Enter a command to be executed when clicking on the clock. Leave blank to disable.")); +#endif + if (clock->command) + { + gtk_widget_show (entry); + gtk_entry_set_text (GTK_ENTRY (entry), clock->command); + } + g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (xfce_clock_dialog_execute_command_changed), clock); + gtk_widget_show (entry); + /* show the dialog */ gtk_widget_show (dialog); } Index: plugins/clock/clock.c =================================================================== --- plugins/clock/clock.c (Revision 27990) +++ plugins/clock/clock.c (Arbeitskopie) @@ -588,6 +588,7 @@ clock->show_meridiem = xfce_rc_read_bool_entry (rc, "ShowMeridiem", FALSE); clock->true_binary = xfce_rc_read_bool_entry (rc, "TrueBinary", FALSE); clock->flash_separators = xfce_rc_read_bool_entry (rc, "FlashSeparators", FALSE); + clock->command = g_strdup(xfce_rc_read_entry (rc, "Command", "orage")); /* close the rc file */ xfce_rc_close (rc); @@ -628,6 +629,8 @@ xfce_rc_write_bool_entry (rc, "ShowMeridiem", clock->show_meridiem); xfce_rc_write_bool_entry (rc, "TrueBinary", clock->true_binary); xfce_rc_write_bool_entry (rc, "FlashSeparators", clock->flash_separators); + if (clock->command) + xfce_rc_write_entry (rc, "Command", clock->command); /* close the rc file */ xfce_rc_close (rc); @@ -664,6 +667,22 @@ +static gboolean +xfce_clock_plugin_button_pressed (ClockPlugin *clock, + GdkEventButton *event, + GtkWidget *widget) +{ + if (event->button == 1 && clock->command && *clock->command) + { + xfce_exec (clock->command, FALSE, FALSE, NULL); + return TRUE; + } + + return FALSE; +} + + + static void xfce_clock_plugin_construct (XfcePanelPlugin *plugin) { @@ -679,5 +698,6 @@ g_signal_connect_swapped (G_OBJECT (plugin), "free-data", G_CALLBACK (xfce_clock_plugin_free), clock); g_signal_connect_swapped (G_OBJECT (plugin), "configure-plugin", G_CALLBACK (xfce_clock_dialog_show), clock); g_signal_connect_swapped (G_OBJECT (plugin), "orientation-changed", G_CALLBACK (xfce_clock_plugin_set_orientation), clock); + g_signal_connect_swapped (G_OBJECT (plugin), "button-press-event", G_CALLBACK (xfce_clock_plugin_button_pressed), clock); }