aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorDevashish Sharma <dsharma@src.gnome.org>2006-03-10 13:40:11 +0800
committerDevashish Sharma <dsharma@src.gnome.org>2006-03-10 13:40:11 +0800
commit426460951a1229aa0a2566f3e454776de5c20fab (patch)
treed56db2adbe3fec7f8b4c4e11c549d09a9aae5f5c /addressbook/gui/contact-editor
parent5218b4b764b105767511a07cd24b06501f052a3c (diff)
downloadgsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.tar
gsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.tar.gz
gsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.tar.bz2
gsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.tar.lz
gsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.tar.xz
gsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.tar.zst
gsoc2013-evolution-426460951a1229aa0a2566f3e454776de5c20fab.zip
Fix for Bug #333855
svn path=/trunk/; revision=31678
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c96
1 files changed, 49 insertions, 47 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 5bd9d1e09f..bbd81018cf 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2551,40 +2551,19 @@ source_selected (GtkWidget *source_option_menu, ESource *source, EContactEditor
(EBookCallback) new_target_cb, editor);
}
-static gboolean
-full_name_key_press_event( GtkWidget *widget, GdkEventKey *event, EContactEditor *editor)
-{
- if (event->keyval == GDK_Return) {
- gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_OK);
- return TRUE;
- }
- return FALSE;
-}
-
static void
-full_name_clicked (GtkWidget *button, EContactEditor *editor)
+full_name_response (GtkDialog *dialog, int response, EContactEditor *editor)
{
- GtkDialog *dialog = GTK_DIALOG (e_contact_editor_fullname_new (editor->name));
- gboolean fullname_supported;
- int result;
-
- fullname_supported = is_field_supported (editor, E_CONTACT_FULL_NAME);
+ EContactName *name;
+ GtkWidget *fname_widget;
+ int style = 0;
+ gboolean editable = FALSE;
- g_object_set (dialog,
- "editable", fullname_supported & editor->target_editable,
+ g_object_get (dialog,
+ "editable", &editable,
NULL);
- g_signal_connect (GTK_WIDGET (dialog), "key-press-event", G_CALLBACK (full_name_key_press_event), editor);
-
- gtk_widget_show (GTK_WIDGET(dialog));
- result = gtk_dialog_run (dialog);
- gtk_widget_hide (GTK_WIDGET (dialog));
-
- if (fullname_supported && editor->target_editable && result == GTK_RESPONSE_OK) {
- EContactName *name;
- GtkWidget *fname_widget;
- int style = 0;
-
+ if (editable && response == GTK_RESPONSE_OK) {
g_object_get (dialog,
"name", &name,
NULL);
@@ -2606,11 +2585,45 @@ full_name_clicked (GtkWidget *button, EContactEditor *editor)
file_as_set_style(editor, style);
}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+static gint
+full_name_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+ if (widget) {
+ if (GTK_IS_WIDGET (widget))
+ gtk_widget_destroy(widget);
+ }
+ return TRUE;
}
static void
-response (GtkDialog *dialog, int response, EContactEditor *editor)
+full_name_clicked (GtkWidget *button, EContactEditor *editor)
+{
+ GtkDialog *dialog = GTK_DIALOG (e_contact_editor_fullname_new (editor->name));
+ gboolean fullname_supported;
+
+
+ fullname_supported = is_field_supported (editor, E_CONTACT_FULL_NAME);
+
+ g_object_set (dialog,
+ "editable", fullname_supported & editor->target_editable,
+ NULL);
+
+ g_signal_connect(dialog, "response",
+ G_CALLBACK (full_name_response), editor);
+
+ /* Close the fullname dialog if the editor is closed */
+ g_signal_connect_swapped (EAB_EDITOR (editor), "editor_closed",
+ G_CALLBACK (full_name_editor_delete_event_cb), GTK_WIDGET (dialog));
+
+ gtk_widget_show (GTK_WIDGET(dialog));
+}
+
+
+static void
+categories_response (GtkDialog *dialog, int response, EContactEditor *editor)
{
const char *categories;
GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
@@ -2625,22 +2638,13 @@ response (GtkDialog *dialog, int response, EContactEditor *editor)
gtk_widget_hide(GTK_WIDGET(dialog));
}
-static gboolean
-categories_key_press_event( GtkWidget *widget, GdkEventKey *event, EContactEditor *editor)
-{
- if (event->keyval == GDK_Return) {
- gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_OK);
- return TRUE;
- }
- return FALSE;
-}
-
static gint
-editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+categories_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
{
- if (widget)
+ if (widget) {
if (GTK_IS_WIDGET (widget))
gtk_widget_destroy(widget);
+ }
return TRUE;
}
@@ -2662,14 +2666,12 @@ categories_clicked (GtkWidget *button, EContactEditor *editor)
return;
}
- g_signal_connect (GTK_WIDGET (dialog), "key-press-event", G_CALLBACK (categories_key_press_event), editor);
-
g_signal_connect(dialog, "response",
- G_CALLBACK (response), editor);
+ G_CALLBACK (categories_response), editor);
/* Close the category dialog if the editor is closed*/
g_signal_connect_swapped (EAB_EDITOR (editor), "editor_closed",
- G_CALLBACK (editor_delete_event_cb), GTK_WIDGET (dialog));
+ G_CALLBACK (categories_editor_delete_event_cb), GTK_WIDGET (dialog));
gtk_widget_show(GTK_WIDGET(dialog));
g_free (categories);