diff options
author | Federico Mena Quintero <federico@nuclecu.unam.mx> | 1998-08-25 03:59:25 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-08-25 03:59:25 +0800 |
commit | 4d075f28b587361a5014edd4946f30d9ae113e9f (patch) | |
tree | c73583c453f4981d652e010f2c620e2997934e4f /calendar/menus.c | |
parent | abdba7c651a0a04809c8a8a20c72188fbd62d2b9 (diff) | |
download | gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.tar gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.tar.gz gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.tar.bz2 gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.tar.lz gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.tar.xz gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.tar.zst gsoc2013-evolution-4d075f28b587361a5014edd4946f30d9ae113e9f.zip |
Changed the Properties menu item to Preferences. These are global
1998-08-24 Federico Mena Quintero <federico@nuclecu.unam.mx>
* main.c: Changed the Properties menu item to Preferences. These
are global application preferences, not a single calendar's
properties.
* prop.c (prop_apply): Save the week_starts_on_monday flag to the
configuration file.
(properties): Added a check button for weeks starting on Monday.
(properties): Beautified the Preferences dialog.
* month-view.c (month_view_init):
* goto.c (create_days): Set the month item to start weeks on
Monday if appropriate.
* main.c (init_calendar): A boolean is not an hour, so don't
range_check_hour() on it.
(init_calendar): Added a global week_starts_on_monday flag.
* main.h: Added global week_starts_on_monday flag.
svn path=/trunk/; revision=336
Diffstat (limited to 'calendar/menus.c')
-rw-r--r-- | calendar/menus.c | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/calendar/menus.c b/calendar/menus.c deleted file mode 100644 index c42a52a981..0000000000 --- a/calendar/menus.c +++ /dev/null @@ -1,147 +0,0 @@ -#include <gtk/gtk.h> -#include <strings.h> - -#include "gncal.h" - - -static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * - path); -static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar -key, gchar modifiers, gchar * path); -void menus_init(void); -void menus_create(GtkMenuEntry * entries, int nmenu_entries); - - -/* this is the GtkMenuEntry structure used to create new menus. The - * first member is the menu definition string. The second, the - * default accelerator key used to access this menu function with - * the keyboard. The third is the callback function to call when - * this menu item is selected (by the accelerator key, or with the - * mouse.) The member is the data to pass to your callback function. - */ - -static GtkMenuEntry menu_items[] = -{ - {"<Main>/File/Exit", "<control>Q", menu_file_quit, NULL}, - {"<Main>/Help/About", NULL, menu_help_about, NULL}, - -}; - -static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); - -static int initialize = TRUE; -static GtkMenuFactory *factory = NULL; -static GtkMenuFactory *subfactory[1]; -static GHashTable *entry_ht = NULL; - -void get_main_menu(GtkWidget ** menubar, GtkAcceleratorTable ** table) -{ - if (initialize) - menus_init(); - - if (menubar) - *menubar = subfactory[0]->widget; - if (table) - *table = subfactory[0]->table; -} - -void menus_init(void) -{ - if (initialize) { - initialize = FALSE; - - factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR); - subfactory[0] = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR); - - gtk_menu_factory_add_subfactory(factory, subfactory[0], "<Main>"); - menus_create(menu_items, nmenu_items); - } -} - -void menus_create(GtkMenuEntry * entries, int nmenu_entries) -{ - char *accelerator; - int i; - - if (initialize) - menus_init(); - - if (entry_ht) - for (i = 0; i < nmenu_entries; i++) { - accelerator = g_hash_table_lookup(entry_ht, entries[i].path); - if (accelerator) { - if (accelerator[0] == '\0') - entries[i].accelerator = NULL; - else - entries[i].accelerator = accelerator; - } - } - gtk_menu_factory_add_entries(factory, entries, nmenu_entries); - - - for (i = 0; i < nmenu_entries; i++) - if (entries[i].widget) { - gtk_signal_connect(GTK_OBJECT(entries[i].widget), "install_accelerator", - (GtkSignalFunc) menus_install_accel, - entries[i].path); - gtk_signal_connect(GTK_OBJECT(entries[i].widget), "remove_accelerator", - (GtkSignalFunc) menus_remove_accel, - entries[i].path); - } -} - -static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar -key, gchar modifiers, gchar * path) -{ - char accel[64]; - char *t1, t2[2]; - - accel[0] = '\0'; - if (modifiers & GDK_CONTROL_MASK) - strcat(accel, "<control>"); - if (modifiers & GDK_SHIFT_MASK) - strcat(accel, "<shift>"); - if (modifiers & GDK_MOD1_MASK) - strcat(accel, "<alt>"); - - t2[0] = key; - t2[1] = '\0'; - strcat(accel, t2); - - if (entry_ht) { - t1 = g_hash_table_lookup(entry_ht, path); - g_free(t1); - } else - entry_ht = g_hash_table_new(g_string_hash, g_string_equal); - - g_hash_table_insert(entry_ht, path, g_strdup(accel)); - - return TRUE; -} - -static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * - path) -{ - char *t; - - if (entry_ht) { - t = g_hash_table_lookup(entry_ht, path); - g_free(t); - - g_hash_table_insert(entry_ht, path, g_strdup("")); - } -} - -void menus_set_sensitive(char *path, int sensitive) -{ - GtkMenuPath *menu_path; - - if (initialize) - menus_init(); - - menu_path = gtk_menu_factory_find(factory, path); - if (menu_path) - gtk_widget_set_sensitive(menu_path->widget, sensitive); - else - g_warning("Unable to set sensitivity for menu which doesn't exist: %s", path); -} |