diff options
author | Sankar P <psankar@novell.com> | 2005-10-18 15:12:15 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2005-10-18 15:12:15 +0800 |
commit | e751338e4953544b113b19ed0ea8eeebfb0b111d (patch) | |
tree | fdfcc479482c69ed07ee40ed1bf336d0abe02946 /mail/em-composer-prefs.c | |
parent | 789a6ed0cde0f8b797540118ef840d2a172cbabb (diff) | |
download | gsoc2013-evolution-e751338e4953544b113b19ed0ea8eeebfb0b111d.tar.gz gsoc2013-evolution-e751338e4953544b113b19ed0ea8eeebfb0b111d.tar.zst gsoc2013-evolution-e751338e4953544b113b19ed0ea8eeebfb0b111d.zip |
- Enhances Signature-Preferences. - Added shortcuts for common operations.
2005-10-18 Sankar P <psankar@novell.com>
- Enhances Signature-Preferences.
- Added shortcuts for common operations.
-- Delete on Del key
-- Edit on Dbl.Click
- Prevents adding duplicate and NULL signatures
* mail-signature-editor.c (menu_file_save_cb) (mail_signature_editor)
(sig_name_changed) (menu_file_save_close_cb) (delete_event_cb) (do_exit):
Modified the functions for handling the above scenarios.
* mail.error.xml:
Added error strings for duplicate and NULL signatures.
* em-composer-prefs.c (em_composer_prefs_construct) (sig_delete_cb) (sig_add_cb):
Modified the functions so as to handle the keyboard accelarators
and to grab focus to the list on deletion/insertion of signatures.
* em-composer-prefs.c (signature_key_press)(sig_tree_event_cb):
Added new functions to handle the
keypress events on the signatures list tree.
Fixes #269749
svn path=/trunk/; revision=30519
Diffstat (limited to 'mail/em-composer-prefs.c')
-rw-r--r-- | mail/em-composer-prefs.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 5675ddc3b4..7e80c38284 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -41,6 +41,8 @@ #include <libedataserver/e-iconv.h> #include <misc/e-gui-utils.h> +#include <gdk/gdkkeysyms.h> + #include <gtk/gtkentry.h> #include <gtk/gtktreemodel.h> #include <gtk/gtkliststore.h> @@ -336,19 +338,21 @@ em_composer_prefs_new_signature (GtkWindow *parent, gboolean html) mail_signature_editor (sig, parent, TRUE); } -static void +static void sig_delete_cb (GtkWidget *widget, EMComposerPrefs *prefs) { GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; ESignature *sig; - + selection = gtk_tree_view_get_selection (prefs->sig_list); + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, 1, &sig, -1); mail_config_remove_signature (sig); } + gtk_widget_grab_focus ((GtkWidget *)prefs->sig_list); } static void @@ -365,6 +369,7 @@ sig_add_cb (GtkWidget *widget, EMComposerPrefs *prefs) parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; em_composer_prefs_new_signature ((GtkWindow *) parent, send_html); + gtk_widget_grab_focus ((GtkWidget *)prefs->sig_list); } static void @@ -815,6 +820,29 @@ emcp_free(EConfig *ec, GSList *items, void *data) g_slist_free(items); } +static void +signature_key_press (GtkTreeView *tree_view, GdkEventKey *event, EMComposerPrefs *prefs) +{ + /* No need to care about anything other than DEL key */ + if (event->keyval == GDK_Delete) + sig_delete_cb ((GtkWidget *)tree_view, prefs); + + return ; +} + +static gboolean +sig_tree_event_cb (GtkTreeView *tree_view, GdkEvent *event, EMComposerPrefs *prefs) +{ + gboolean ret = FALSE; + + if (event->type == GDK_2BUTTON_PRESS) { + sig_edit_cb ((GtkWidget *)tree_view, prefs); + ret = TRUE; + } + + return ret; +} + static void em_composer_prefs_construct (EMComposerPrefs *prefs) { @@ -949,10 +977,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) g_signal_connect (prefs->sig_add_script, "clicked", G_CALLBACK (sig_add_script_cb), prefs); prefs->sig_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureEdit")); - g_signal_connect (prefs->sig_edit, "clicked", G_CALLBACK (sig_edit_cb), prefs); + g_signal_connect (prefs->sig_edit, "pressed", G_CALLBACK (sig_edit_cb), prefs); prefs->sig_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureDelete")); - g_signal_connect (prefs->sig_delete, "clicked", G_CALLBACK (sig_delete_cb), prefs); + g_signal_connect (prefs->sig_delete, "pressed", G_CALLBACK (sig_delete_cb), prefs); prefs->sig_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "listSignatures")); model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); @@ -964,6 +992,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) selection = gtk_tree_view_get_selection (prefs->sig_list); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); g_signal_connect (selection, "changed", G_CALLBACK (sig_selection_changed), prefs); + g_signal_connect (prefs->sig_list, "event", G_CALLBACK (sig_tree_event_cb), prefs); sig_fill_list (prefs); @@ -979,6 +1008,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) e_config_set_target((EConfig *)ec, (EConfigTarget *)target); toplevel = e_config_create_widget((EConfig *)ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); + + g_signal_connect (prefs->sig_list, "key-press-event", G_CALLBACK(signature_key_press), prefs); } GtkWidget * |