On Thu, 2001-12-13 at 17:32, iain wrote: > > > + const char *cals[] = { > > + N_("Today..."), N_("View the calendar for today."), > > "gnome-day.png", "dayview", > > + N_("This Week..."), N_("View the calendar for this week."), > > "gnome-week.png", "weekview", > > + N_("This Month..."), N_("View the calendar for this month."), > > "gnome-month.png", "monthview", > > + NULL > > + }; > > ... isn't needed here, because the menu item represents "view this > (day,week,etc)" and by clicking on the item, thats what happens. After > you click it, you don't need to do anything else to view this > day,week,etc. > > iain Iain - Thanks for your input. I have attached a new screenshot and diff with the inappropriate "..."s removed. Thanks, Dennis (Note: I have not updated my previously posted links. My internet provider has shutdown their ftp server, and they doesn't know when they will be able to brink it back up.)
Attachment:
foobar-clock-new.png
Description: PNG image
Index: foobar-widget.c =================================================================== RCS file: /cvs/gnome/gnome-core/panel/foobar-widget.c,v retrieving revision 1.105 diff -u -u -p -r1.105 foobar-widget.c --- foobar-widget.c 2001/12/12 01:21:20 1.105 +++ foobar-widget.c 2001/12/14 05:02:46 @@ -35,6 +35,7 @@ #include "drawer-widget.h" #include "gnome-run.h" #include "multiscreen-stuff.h" +#include "panel-gconf.h" #define ICON_SIZE 20 @@ -314,13 +315,29 @@ append_folder_menu (GtkWidget *menu_bar, #endif static void -append_gnomecal_item (GtkWidget *menu, const char *label, const char *flag) +append_gnomecal_items (GtkWidget *menu) { - GtkWidget *item = gtk_image_menu_item_new_with_label (label); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (gnomecal_client), - (char *)flag); + GtkWidget *item; + int i; + + const char *cals[] = { + N_("Today"), N_("View the calendar for today."), "gnome-day.png", "dayview", + N_("This Week"), N_("View the calendar for this week."), "gnome-week.png", "weekview", + N_("This Month"), N_("View the calendar for this month."), "gnome-month.png", "monthview", + NULL + }; + + for (i=0; cals[i]; i+=4) { + item = pixmap_menu_item_new (cals[i], cals[i+2]); + gtk_tooltips_set_tip (panel_tooltips, item, + cals[i+1], + NULL); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (G_OBJECT (item), "activate", + G_CALLBACK (gnomecal_client), + (char *)cals[i+3]); + } } static void @@ -390,27 +407,48 @@ set_fooclock_format (GtkWidget *w, char } static void -append_format_item (GtkWidget *menu, const char *format) +append_format_items (GtkWidget *menu) { char hour[256]; GtkWidget *item; + GSList *group = NULL; struct tm *das_tm; time_t das_time = 0; - - das_tm = localtime (&das_time); - if (strftime (hour, sizeof(hour), _(format), das_tm) == 0) { - /* according to docs, if the string does not fit, the - * contents of tmp2 are undefined, thus just use - * ??? */ - strcpy(hour, "???"); - } - hour[sizeof(hour)-1] = '\0'; /* just for sanity */ + char *s = panel_gconf_global_config_get_string ("clock-format"); + int i; + + const char *formats[] = { + N_("%H:%M"), + N_("%H:%M:%S"), + N_("%l:%M %p"), + N_("%l:%M:%S %p"), + NULL + }; + + for (i = 0; formats[i]; i++) + { + das_tm = localtime (&das_time); + if (strftime (hour, sizeof(hour), _(formats[i]), das_tm) == 0) { + /* according to docs, if the string does not fit, the + * contents of tmp2 are undefined, thus just use + * ??? */ + strcpy(hour, "???"); + } + hour[sizeof(hour)-1] = '\0'; /* just for sanity */ - item = gtk_image_menu_item_new_with_label (hour); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - g_signal_connect (G_OBJECT (item), "activate", + item = gtk_radio_menu_item_new_with_label (group, hour); + group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (set_fooclock_format), - (char *)format); + (char *)formats[i]); + + if (s && !strcmp (s, formats[i])) { + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + } + } + g_free (s); } static void @@ -429,50 +467,33 @@ append_clock_menu (FoobarWidget *foo, Gt { GtkWidget *item, *menu, *menu2; gchar *time_admin_path; - int i; - const char *cals[] = { - N_("Today"), "dayview", - N_("This Week"), "weekview", - N_("This Month"), "monthview", - NULL - }; - - const char *formats[] = { - N_("%H:%M"), - N_("%H:%M:%S"), - N_("%l:%M %p"), - N_("%l:%M:%S %p"), - NULL - }; menu = gtk_menu_new (); - + append_gnomecal_items (menu); + #if 0 /* put back when evolution can do this */ - item = gtk_image_menu_item_new_with_label (_("Add appointement...")); + item = gtk_image_menu_item_new_with_label (_("Add Appointment...")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); +#endif add_menu_separator (menu); -#endif - /* FIXME: wtf is time-admin???? */ + /* check for time-admin (part of ximian-setup-tools) */ time_admin_path = g_find_program_in_path ("time-admin"); if (time_admin_path != NULL) { - item = gtk_image_menu_item_new_with_label (_("Set Time")); + item = pixmap_menu_item_new (_("Set Time..."), "gnome-set-time.png"); + gtk_tooltips_set_tip (panel_tooltips, item, + _("Adjust the date and time."), + NULL); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (set_time_cb), - time_admin_path); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - add_menu_separator (menu); + time_admin_path); } - for (i=0; cals[i]; i+=2) - append_gnomecal_item (menu, _(cals[i]), cals[i+1]); - - add_menu_separator (menu); - menu2 = gtk_menu_new (); - for (i=0; formats[i]; i++) - append_format_item (menu2, formats[i]); + append_format_items (menu2); add_tearoff (GTK_MENU_SHELL (menu2));