From 956cd913f1542ec212f2cc14a28da5b4f7d2e525 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Wed, 5 Dec 2007 05:40:12 +0000 Subject: ** Added a preference to disable Magic Spacebar. 2007-12-05 Srinivasa Ragavan ** Added a preference to disable Magic Spacebar. * em-folder-browser.c: (html_scroll), (emfb_list_key_press): Check the cfg before invoking Magic Spacebar * em-mailer-prefs.c: (em_mailer_prefs_construct): Preference window handling * em-mailer-prefs.h: * evolution-mail.schemas.in: * mail-config.c: (gconf_magic_spacebar_changed), (mail_config_init), (mail_config_get_enable_magic_spacebar): Add it part of MC. * mail-config.glade: * mail-config.h: svn path=/trunk/; revision=34650 --- mail/ChangeLog | 14 ++++++++++++++ mail/em-folder-browser.c | 8 ++++---- mail/em-mailer-prefs.c | 5 +++++ mail/em-mailer-prefs.h | 1 + mail/evolution-mail.schemas.in | 13 +++++++++++++ mail/mail-config.c | 19 ++++++++++++++++++- mail/mail-config.glade | 19 +++++++++++++++++++ mail/mail-config.h | 1 + 8 files changed, 75 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 6db1ea2833..46e50e28ae 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2007-12-05 Srinivasa Ragavan + + ** Added a preference to disable Magic Spacebar. + + * em-folder-browser.c: (html_scroll), (emfb_list_key_press): Check the cfg + before invoking Magic Spacebar + * em-mailer-prefs.c: (em_mailer_prefs_construct): Preference window handling + * em-mailer-prefs.h: + * evolution-mail.schemas.in: + * mail-config.c: (gconf_magic_spacebar_changed), + (mail_config_init), (mail_config_get_enable_magic_spacebar): Add it part of MC. + * mail-config.glade: + * mail-config.h: + 2007-12-04 David Turner ** Fix for bug #347329 diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 5253101c67..87bf65fd49 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -409,7 +409,7 @@ html_scroll (GtkHTML *html, EMFolderBrowser *emfb) { - if (html->binding_handled || orientation != GTK_ORIENTATION_VERTICAL) + if (html->binding_handled || orientation != GTK_ORIENTATION_VERTICAL || !mail_config_get_enable_magic_spacebar ()) return; if (scroll_type == GTK_SCROLL_PAGE_FORWARD) { @@ -1169,7 +1169,7 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, switch (ev->key.keyval) { case GDK_space: - if (!emfb->view.preview->caret_mode) { + if (!emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) { state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-forward"); if (!state) { folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); @@ -1182,7 +1182,7 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE); break; case GDK_BackSpace: - if (!emfb->view.preview->caret_mode) { + if (!emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) { state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-backward"); if (!state) { folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, CAMEL_MESSAGE_SEEN); @@ -1198,7 +1198,7 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, return FALSE; } - if (!folder_choose && !emfb->view.preview->caret_mode) { + if (!folder_choose && !emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) { //check for unread messages. if yes .. rewindback to the folder EMFolderTree *emft = g_object_get_data((GObject*)emfb, "foldertree"); switch (ev->key.keyval) { diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c index 9746e620bb..2a4e81117d 100644 --- a/mail/em-mailer-prefs.c +++ b/mail/em-mailer-prefs.c @@ -927,6 +927,11 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) "/apps/evolution/mail/display/force_message_limit", G_CALLBACK (toggle_button_toggled)); + prefs->magic_spacebar = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "magic_spacebar_checkbox")); + toggle_button_init (prefs, prefs->magic_spacebar, FALSE, + "/apps/evolution/mail/display/magic_spacebar", + G_CALLBACK (toggle_button_toggled)); + prefs->mlimit_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "mlimit_spin")); spin_button_init (prefs, prefs->mlimit_count, "/apps/evolution/mail/display/message_text_part_limit", diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h index 163d6f9406..647da6e571 100644 --- a/mail/em-mailer-prefs.h +++ b/mail/em-mailer-prefs.h @@ -80,6 +80,7 @@ struct _EMMailerPrefs { struct _GtkOptionMenu *charset; struct _GtkToggleButton *citation_highlight; struct _GtkColorButton *citation_color; + struct _GtkToggleButton *magic_spacebar; /* Deleting Mail */ struct _GtkToggleButton *empty_trash; diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index a60d34d8ce..8affc57671 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -183,6 +183,19 @@ + + /schemas/apps/evolution/mail/display/magic_spacebar + /apps/evolution/mail/display/magic_spacebar + evolution-mail + bool + true + + Enable or disable magic space bar + Enable this to use Space bar key to scroll in message preview, message list and folders. + + + + /schemas/apps/evolution/mail/display/mark_citations /apps/evolution/mail/display/mark_citations diff --git a/mail/mail-config.c b/mail/mail-config.c index eda95c7982..f10ac3e868 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -110,7 +110,8 @@ typedef struct { guint mlimit_notify_id; gboolean mlimit; gint mlimit_size; - + guint magic_spacebar_notify_id; + gboolean magic_spacebar; GPtrArray *mime_types; guint mime_types_notify_id; @@ -359,6 +360,13 @@ gconf_mlimit_changed (GConfClient *client, guint cnxn_id, config->mlimit = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/force_message_limit", NULL); } +static void +gconf_magic_spacebar_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + config->magic_spacebar = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/magic_spacebar", NULL); +} + static void gconf_mime_types_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) @@ -399,6 +407,8 @@ mail_config_init (void) gconf_mlimit_changed, NULL, NULL, NULL); config->mlimit_size_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/message_text_part_limit", gconf_mlimit_size_changed, NULL, NULL, NULL); + config->magic_spacebar_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/magic_spacebar", + gconf_magic_spacebar_changed, NULL, NULL, NULL); config->spell_notify_id = gconf_client_notify_add (config->gconf, "/GNOME/Spell", gconf_style_changed, NULL, NULL, NULL); config->mark_citations__notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/mark_citations", @@ -424,6 +434,7 @@ mail_config_init (void) config->address_count = gconf_client_get_int (config->gconf, "/apps/evolution/mail/display/address_count", NULL); config->mlimit = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/force_message_limit", NULL); config->mlimit_size = gconf_client_get_int (config->gconf, "/apps/evolution/mail/display/message_text_part_limit", NULL); + config->magic_spacebar = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/magic_spacebar", NULL); config->accounts = e_account_list_new (config->gconf); config->signatures = e_signature_list_new (config->gconf); } @@ -574,6 +585,12 @@ mail_config_get_message_limit (void) return config->mlimit_size; } +gboolean +mail_config_get_enable_magic_spacebar () +{ + return config->magic_spacebar; +} + const char * mail_config_get_label_color_by_name (const char *name) { diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 265082d962..4c6cc805c9 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -5103,6 +5103,25 @@ For example: "Work" or "Personal" + + + True + True + Enable Magic S_pacebar + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + True diff --git a/mail/mail-config.h b/mail/mail-config.h index 33b7deea36..ede7291dc4 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -136,6 +136,7 @@ void mail_config_remove_account (struct _EAccount *account); void mail_config_set_default_account (struct _EAccount *account); int mail_config_get_address_count (void); int mail_config_get_message_limit (void); +gboolean mail_config_get_enable_magic_spacebar (); void mail_config_remove_account_proxies (struct _EAccount *account); void mail_config_prune_proxies (void); -- cgit