aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2004-04-23 08:40:25 +0800
committerHans Petter <hansp@src.gnome.org>2004-04-23 08:40:25 +0800
commitbfc49c80227b6d165d726019711af83fe3338068 (patch)
tree8e921263abc039f05c762b8dde85be7ffb075e35 /addressbook/gui
parent976cdd5eb9d8ad0800761ce883efe9289edf9c54 (diff)
downloadgsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.tar
gsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.tar.gz
gsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.tar.bz2
gsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.tar.lz
gsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.tar.xz
gsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.tar.zst
gsoc2013-evolution-bfc49c80227b6d165d726019711af83fe3338068.zip
Correct the dialog's title.
2004-04-22 Hans Petter Jansson <hpj@ximian.com> * gui/contact-editor/contact-editor.glade: Correct the dialog's title. * gui/contact-editor/e-contact-editor.c (init_email_record_location): Connect to entry's activate signal. (init_phone_record_type): Ditto. (init_im_record_location): Ditto. (init_address_field): Ditto. (set_entry_changed_signal_field): Remove unnecessary checks. (set_urlentry_changed_signal_field): Ditto. (set_entry_changed_signals): Ditto. (set_entry_activate_signal_field): Implement. (set_urlentry_activate_signal_field): Implement. (set_entry_activate_signals): Implement. (e_contact_editor_init): Call set_entry_activate_signals (). svn path=/trunk/; revision=25590
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade3
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c137
2 files changed, 84 insertions, 56 deletions
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index 3d83326d7a..2035b08339 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -5,7 +5,7 @@
<widget class="GtkDialog" id="contact editor">
<property name="visible">True</property>
- <property name="title" translatable="yes">dialog1</property>
+ <property name="title" translatable="yes">Contact Editor</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -52,6 +52,7 @@
<widget class="GtkButton" id="button-ok">
<property name="visible">True</property>
<property name="can_default">True</property>
+ <property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index b5aead2397..194249339e 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -101,6 +101,8 @@ static gboolean e_contact_editor_is_valid (EABEditor *editor);
static gboolean e_contact_editor_is_changed (EABEditor *editor);
static GtkWindow* e_contact_editor_get_window (EABEditor *editor);
+static void save_contact (EContactEditor *ce, gboolean should_close);
+static void entry_activated (EContactEditor *editor);
static void enable_writable_fields(EContactEditor *editor);
static void set_editable(EContactEditor *editor);
static void fill_in_info(EContactEditor *editor);
@@ -308,6 +310,7 @@ init_email_record_location (EContactEditor *editor, gint record)
g_signal_connect (location_option_menu, "changed", G_CALLBACK (widget_changed), editor);
g_signal_connect (email_entry, "changed", G_CALLBACK (widget_changed), editor);
+ g_signal_connect_swapped (email_entry, "activate", G_CALLBACK (entry_activated), editor);
location_menu = gtk_menu_new ();
@@ -814,6 +817,7 @@ init_phone_record_type (EContactEditor *editor, gint record)
g_signal_connect (phone_type_option_menu, "changed", G_CALLBACK (widget_changed), editor);
g_signal_connect (phone_entry, "changed", G_CALLBACK (widget_changed), editor);
+ g_signal_connect_swapped (phone_entry, "activate", G_CALLBACK (entry_activated), editor);
phone_type_menu = gtk_menu_new ();
@@ -856,6 +860,7 @@ init_im_record_location (EContactEditor *editor, gint record)
g_signal_connect (location_option_menu, "changed", G_CALLBACK (widget_changed), editor);
g_signal_connect (name_entry, "changed", G_CALLBACK (widget_changed), editor);
+ g_signal_connect_swapped (name_entry, "activate", G_CALLBACK (entry_activated), editor);
location_menu = gtk_menu_new ();
@@ -1073,6 +1078,7 @@ init_address_field (EContactEditor *editor, gint record, const gchar *widget_fie
g_free (entry_name);
g_signal_connect (entry, "changed", G_CALLBACK (widget_changed), editor);
+ g_signal_connect_swapped (entry, "activate", G_CALLBACK (entry_activated), editor);
}
static void
@@ -1490,87 +1496,107 @@ widget_changed (GtkWidget *widget, EContactEditor *editor)
}
static void
-set_entry_changed_signal_field(EContactEditor *editor, char *id)
+set_entry_changed_signal_field (EContactEditor *editor, char *id)
{
GtkWidget *widget = glade_xml_get_widget(editor->gui, id);
- if (widget && GTK_IS_ENTRY(widget))
- g_signal_connect(widget, "changed",
- G_CALLBACK (field_changed), editor);
+
+ g_signal_connect (widget, "changed", G_CALLBACK (field_changed), editor);
}
static void
set_urlentry_changed_signal_field (EContactEditor *editor, char *id)
{
+ GtkWidget *widget = glade_xml_get_widget (editor->gui, id);
+ GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget));
+
+ g_signal_connect (entry, "changed", G_CALLBACK (field_changed), editor);
+}
+
+static void
+entry_activated (EContactEditor *editor)
+{
+ save_contact (editor, TRUE);
+}
+
+static void
+set_entry_activate_signal_field (EContactEditor *editor, char *id)
+{
GtkWidget *widget = glade_xml_get_widget(editor->gui, id);
- if (widget && E_IS_URL_ENTRY(widget)) {
- GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget));
- g_signal_connect (entry, "changed",
- G_CALLBACK (field_changed), editor);
- }
+
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (entry_activated), editor);
}
static void
-set_entry_changed_signals(EContactEditor *editor)
+set_urlentry_activate_signal_field (EContactEditor *editor, char *id)
{
- GtkWidget *widget;
+ GtkWidget *widget = glade_xml_get_widget (editor->gui, id);
+ GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget));
- widget = glade_xml_get_widget(editor->gui, "entry-fullname");
- if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (name_entry_changed), editor);
- }
+ g_signal_connect_swapped (entry, "activate", G_CALLBACK (entry_activated), editor);
+}
- widget = glade_xml_get_widget(editor->gui, "entry-file-as");
- if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (file_as_entry_changed), editor);
- }
+/* This sort of sucks. We should really maintain a list of general entry widgets
+ * and special case just the ones that don't fit the pattern */
- widget = glade_xml_get_widget(editor->gui, "entry-company");
- if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (company_entry_changed), editor);
- }
+static void
+set_entry_activate_signals (EContactEditor *editor)
+{
+ set_urlentry_activate_signal_field (editor, "entry-blog");
+ set_urlentry_activate_signal_field (editor, "entry-caluri");
+ set_urlentry_activate_signal_field (editor, "entry-fburl");
+ set_urlentry_activate_signal_field (editor, "entry-videourl");
+
+ set_entry_activate_signal_field (editor, "entry-fullname");
+ set_entry_activate_signal_field (editor, "entry-company");
+ set_entry_activate_signal_field (editor, "entry-categories");
+ set_entry_activate_signal_field (editor, "entry-jobtitle");
+ set_entry_activate_signal_field (editor, "entry-manager");
+ set_entry_activate_signal_field (editor, "entry-assistant");
+ set_entry_activate_signal_field (editor, "entry-department");
+ set_entry_activate_signal_field (editor, "entry-profession");
+ set_entry_activate_signal_field (editor, "entry-nickname");
+}
+
+static void
+set_entry_changed_signals (EContactEditor *editor)
+{
+ GtkWidget *widget;
+
+ widget = glade_xml_get_widget (editor->gui, "entry-fullname");
+ g_signal_connect (widget, "changed", G_CALLBACK (name_entry_changed), editor);
+ widget = glade_xml_get_widget (editor->gui, "entry-file-as");
+ g_signal_connect (widget, "changed", G_CALLBACK (file_as_entry_changed), editor);
+ widget = glade_xml_get_widget (editor->gui, "entry-company");
+ g_signal_connect (widget, "changed", G_CALLBACK (company_entry_changed), editor);
set_urlentry_changed_signal_field (editor, "entry-blog");
set_urlentry_changed_signal_field (editor, "entry-caluri");
set_urlentry_changed_signal_field (editor, "entry-fburl");
set_urlentry_changed_signal_field (editor, "entry-videourl");
- set_entry_changed_signal_field(editor, "entry-categories");
- set_entry_changed_signal_field(editor, "entry-jobtitle");
- set_entry_changed_signal_field(editor, "entry-manager");
- set_entry_changed_signal_field(editor, "entry-assistant");
- set_entry_changed_signal_field(editor, "entry-department");
- set_entry_changed_signal_field(editor, "entry-profession");
- set_entry_changed_signal_field(editor, "entry-nickname");
+ set_entry_changed_signal_field (editor, "entry-categories");
+ set_entry_changed_signal_field (editor, "entry-jobtitle");
+ set_entry_changed_signal_field (editor, "entry-manager");
+ set_entry_changed_signal_field (editor, "entry-assistant");
+ set_entry_changed_signal_field (editor, "entry-department");
+ set_entry_changed_signal_field (editor, "entry-profession");
+ set_entry_changed_signal_field (editor, "entry-nickname");
widget = glade_xml_get_widget(editor->gui, "text-comments");
- if (widget && GTK_IS_TEXT_VIEW(widget)) {
+ {
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
- g_signal_connect (buffer, "changed",
- G_CALLBACK (widget_changed), editor);
- }
- widget = glade_xml_get_widget(editor->gui, "dateedit-birthday");
- if (widget && E_IS_DATE_EDIT(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
- }
- widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary");
- if (widget && E_IS_DATE_EDIT(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ g_signal_connect (buffer, "changed", G_CALLBACK (widget_changed), editor);
}
-
+ widget = glade_xml_get_widget (editor->gui, "dateedit-birthday");
+ g_signal_connect (widget, "changed", G_CALLBACK (widget_changed), editor);
+ widget = glade_xml_get_widget (editor->gui, "dateedit-anniversary");
+ g_signal_connect (widget, "changed", G_CALLBACK (widget_changed), editor);
widget = glade_xml_get_widget (editor->gui, "image-chooser");
- if (widget && E_IS_IMAGE_CHOOSER (widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (image_chooser_changed), editor);
- }
+ g_signal_connect (widget, "changed", G_CALLBACK (image_chooser_changed), editor);
}
static void
-full_name_clicked(GtkWidget *button, EContactEditor *editor)
+full_name_clicked (GtkWidget *button, EContactEditor *editor)
{
GtkDialog *dialog = GTK_DIALOG(e_contact_editor_fullname_new(editor->name));
int result;
@@ -1578,7 +1604,7 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
g_object_set (dialog,
"editable", editor->fullname_editable,
NULL);
- gtk_widget_show(GTK_WIDGET(dialog));
+ gtk_widget_show (GTK_WIDGET(dialog));
result = gtk_dialog_run (dialog);
gtk_widget_hide (GTK_WIDGET (dialog));
@@ -1609,7 +1635,7 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
}
static void
-categories_clicked(GtkWidget *button, EContactEditor *editor)
+categories_clicked (GtkWidget *button, EContactEditor *editor)
{
char *categories = NULL;
GtkDialog *dialog;
@@ -1930,7 +1956,8 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
e_contact_editor->app = glade_xml_get_widget (gui, "contact editor");
- set_entry_changed_signals(e_contact_editor);
+ set_entry_changed_signals (e_contact_editor);
+ set_entry_activate_signals (e_contact_editor);
init_email (e_contact_editor);
init_phone (e_contact_editor);