[Setup-tool-hackers] Patch for adding a "Set Time .." item in thefoobar



Hello boc,

Enclosed you will find a patch against gnome-core HEAD that
adds a "Set Time .." item to the foobar. Please let me know
if you have any objections to comiting it so that i can fix
the patch.


Thanks,
Chema
Index: panel/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/ChangeLog,v
retrieving revision 1.1178
diff -u -5 -r1.1178 ChangeLog
--- panel/ChangeLog	2001/05/13 08:12:49	1.1178
+++ panel/ChangeLog	2001/05/14 07:49:12
@@ -1,5 +1,11 @@
+Sun May 13 02:45:01 2001  Chema Celorio  <chema@celorio.com>
+
+	* foobar-widget.c (append_clock_menu): look for time-admin, if it is
+	in path, add a menu item for "Set Time".
+	(set_time_cb): implement
+
 Sun May 13 01:13:46 2001  George Lebl <jirka@5z.com>
 
 	* session.c: when reading the main menu flags use the default flags
 	  function so that we also get the distribution menu if available
 
Index: panel/foobar-widget.c
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/foobar-widget.c,v
retrieving revision 1.55
diff -u -5 -r1.55 foobar-widget.c
--- panel/foobar-widget.c	2001/05/13 02:21:52	1.55
+++ panel/foobar-widget.c	2001/05/14 07:49:15
@@ -524,14 +525,25 @@
 	gtk_signal_connect (GTK_OBJECT (item), "activate",
 			    GTK_SIGNAL_FUNC (set_fooclock_format),
 			    (gpointer)format);
 }
 
+static void
+set_time_cb (GtkWidget *menu_item, char *path)
+{
+	char *v[2] = { path };
+	
+	if (gnome_execute_async (g_get_home_dir (), 1, v) < 0)
+		panel_error_dialog (_("Could not call time-admin\n"
+						  "Perhaps time-admin is not installed"));
+}
+
 static GtkWidget *
 append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar)
 {
 	GtkWidget *item, *menu, *menu2;
+	gchar *time_admin_path;
 	int i;
 	const char *cals[] = { 
 		N_("Today"),      "dayview",
 		N_("This Week"),  "weekview",
 		N_("This Month"), "monthview",
@@ -553,10 +565,19 @@
 	gtk_menu_append (GTK_MENU (menu), item);
 
 	add_menu_separator (menu);
 #endif
 
+	time_admin_path = gnome_is_program_in_path ("time-admin");
+	if (time_admin_path) {
+		item = gtk_menu_item_new_with_label (_("Set Time .."));
+		gtk_signal_connect (GTK_OBJECT (item), "activate",
+						GTK_SIGNAL_FUNC (set_time_cb), time_admin_path);
+		gtk_menu_append (GTK_MENU (menu), item);
+		add_menu_separator (menu);
+	}
+
 	for (i=0; cals[i]; i+=2)
 		append_gnomecal_item (menu, _(cals[i]), cals[i+1]);
 
 	add_menu_separator (menu);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]