diff options
author | Milan Crha <mcrha@redhat.com> | 2007-10-11 22:09:51 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2007-10-11 22:09:51 +0800 |
commit | e20645bcc7d05e0cd251e7f422f9ac185cd003d3 (patch) | |
tree | 3109aaa2b777d93c91ddd3633b2b6c30b0c150f9 | |
parent | eeb89358f6f3aa8f211b33c23842a8deb08171a8 (diff) | |
download | gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.tar gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.tar.gz gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.tar.bz2 gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.tar.lz gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.tar.xz gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.tar.zst gsoc2013-evolution-e20645bcc7d05e0cd251e7f422f9ac185cd003d3.zip |
** Fix for bug #412360
2007-10-11 Milan Crha <mcrha@redhat.com>
** Fix for bug #412360
* e-msg-composer-hdrs.c: (entry_query_tooltip):
New callback to query tooltip over GtkEntry.
* e-msg-composer-hdrs.c: (connect_entry_for_tooltip):
New function to connect GtkEntry to previous function and let it works.
* e-msg-composer-hdrs.c: (create_addressbook_entry), (create_headers):
Connect entries for tooltips.
svn path=/trunk/; revision=34375
-rw-r--r-- | composer/ChangeLog | 11 | ||||
-rw-r--r-- | composer/e-msg-composer-hdrs.c | 45 |
2 files changed, 54 insertions, 2 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index e544968ed9..69262acb33 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,14 @@ +2007-10-11 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #412360 + + * e-msg-composer-hdrs.c: (entry_query_tooltip): + New callback to query tooltip over GtkEntry. + * e-msg-composer-hdrs.c: (connect_entry_for_tooltip): + New function to connect GtkEntry to previous function and let it works. + * e-msg-composer-hdrs.c: (create_addressbook_entry), (create_headers): + Connect entries for tooltips. + 2007-10-03 Matthew Barnes <mbarnes@redhat.com> * e-msg-cmposer.c: diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 144b9bd1b2..83a5cc3046 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -477,6 +477,44 @@ addressbook_entry_changed (GtkWidget *entry, g_signal_emit (hdrs, signals[HDRS_CHANGED], 0); } +static gboolean +entry_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data) +{ + const char *text; + + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE); + g_return_val_if_fail (tooltip != NULL, FALSE); + + if (keyboard_mode) + return FALSE; + + text = gtk_entry_get_text (GTK_ENTRY (widget)); + + if (!text || !*text) + return FALSE; + + gtk_tooltip_set_text (tooltip, text); + + return TRUE; +} + +/** + * connect_entry_for_tooltip + * This connects "tooltip" callback to entry. + * If entry has tooltip depends on the length of the text inside it. + * @param entry GtkEntry widget, to connect to. + **/ +static void +connect_entry_for_tooltip (GtkWidget *entry) +{ + g_return_if_fail (entry != NULL); + g_return_if_fail (GTK_IS_ENTRY (entry)); + + g_signal_connect (G_OBJECT (entry), "query-tooltip", G_CALLBACK (entry_query_tooltip), NULL); + gtk_widget_set_has_tooltip (entry, TRUE); +} + static GtkWidget * create_addressbook_entry (EMsgComposerHdrs *hdrs, const char *name) { @@ -490,8 +528,8 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs, const char *name) e_name_selector_model_add_section (name_selector_model, name, name, NULL); name_selector_entry = (ENameSelectorEntry *)e_name_selector_peek_section_list (priv->name_selector, name); - g_signal_connect (name_selector_entry, "changed", - G_CALLBACK (addressbook_entry_changed), hdrs); + g_signal_connect (name_selector_entry, "changed", G_CALLBACK (addressbook_entry_changed), hdrs); + connect_entry_for_tooltip (GTK_WIDGET (name_selector_entry)); e_name_selector_entry_set_contact_editor_func (name_selector_entry, e_contact_editor_new); e_name_selector_entry_set_contact_list_editor_func (name_selector_entry, e_contact_list_editor_new); @@ -649,6 +687,7 @@ create_headers (EMsgComposerHdrs *hdrs) priv->subject.entry = gtk_entry_new (); gtk_label_set_mnemonic_widget((GtkLabel *)priv->subject.label, priv->subject.entry); g_signal_connect(priv->subject.entry, "changed", G_CALLBACK(entry_changed), hdrs); + connect_entry_for_tooltip (priv->subject.entry); /* * To, CC, and Bcc @@ -684,6 +723,8 @@ create_headers (EMsgComposerHdrs *hdrs) g_signal_connect(priv->post_to.entry, "changed", G_CALLBACK (post_entry_changed_cb), hdrs); + + connect_entry_for_tooltip (priv->post_to.entry); } static void |