diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-06-08 16:55:08 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-20 03:56:11 +0800 |
commit | 569c3381242efcb5bc7966825023e890965c0b62 (patch) | |
tree | 9b595dba07ba89b94df9697f94987801f5f9c1d7 /libempathy-gtk/empathy-contact-search-dialog.c | |
parent | 82600285342927b40d8a7b72f0b559b4b14d01a3 (diff) | |
download | gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.tar gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.tar.gz gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.tar.bz2 gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.tar.lz gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.tar.xz gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.tar.zst gsoc2013-empathy-569c3381242efcb5bc7966825023e890965c0b62.zip |
Hide the request message entry if it can't be used
https://bugzilla.gnome.org/show_bug.cgi?id=656934
Diffstat (limited to 'libempathy-gtk/empathy-contact-search-dialog.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-search-dialog.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-contact-search-dialog.c b/libempathy-gtk/empathy-contact-search-dialog.c index 47bec719e..bfc42bbb0 100644 --- a/libempathy-gtk/empathy-contact-search-dialog.c +++ b/libempathy-gtk/empathy-contact-search-dialog.c @@ -74,6 +74,8 @@ struct _EmpathyContactSearchDialogPrivate GtkWidget *search_entry; /* GtkWidget *server_entry; */ GtkWidget *message; + GtkWidget *message_window; + GtkWidget *message_label; }; static void @@ -335,6 +337,21 @@ on_selection_changed (GtkTreeSelection *selection, gtk_widget_set_sensitive (priv->add_button, sel); } +static void +check_request_message_available (EmpathyContactSearchDialog *self, + TpConnection *conn) +{ + EmpathyContactSearchDialogPrivate *priv = GET_PRIVATE (self); + EmpathyContactManager *manager = empathy_contact_manager_dup_singleton (); + EmpathyContactListFlags flags; + + flags = empathy_contact_manager_get_flags_for_connection (manager, conn); + + gtk_widget_set_visible (priv->message_window, + flags & EMPATHY_CONTACT_LIST_MESSAGE_ADD); + gtk_widget_set_visible (priv->message_label, + flags & EMPATHY_CONTACT_LIST_MESSAGE_ADD); +} static void _account_chooser_changed (EmpathyAccountChooser *chooser, @@ -363,6 +380,9 @@ _account_chooser_changed (EmpathyAccountChooser *chooser, NULL, /* gtk_entry_get_text (GTK_ENTRY (priv->server_entry)), */ 0, on_searcher_created, self); + + /* Make the request message textview sensitive if it can be used */ + check_request_message_available (self, conn); } static void @@ -603,8 +623,9 @@ empathy_contact_search_dialog_init (EmpathyContactSearchDialog *self) gtk_box_pack_start (GTK_BOX (vbox), priv->notebook, TRUE, TRUE, 3); /* Request message textview */ - label = gtk_label_new (_("Your message introducing yourself:")); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + priv->message_label = gtk_label_new ( + _("Your message introducing yourself:")); + gtk_misc_set_alignment (GTK_MISC (priv->message_label), 0, 0.5); priv->message = gtk_text_view_new (); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->message), @@ -613,16 +634,17 @@ empathy_contact_search_dialog_init (EmpathyContactSearchDialog *self) gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->message)), _("Please let me see when you're online. Thanks!"), -1); - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), + priv->message_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type ( + GTK_SCROLLED_WINDOW (priv->message_window), GTK_SHADOW_ETCHED_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->message_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (scrolled_window), priv->message); + gtk_container_add (GTK_CONTAINER (priv->message_window), priv->message); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 3); - gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, FALSE, TRUE, 3); + gtk_box_pack_start (GTK_BOX (vbox), priv->message_label, FALSE, TRUE, 3); + gtk_box_pack_start (GTK_BOX (vbox), priv->message_window, FALSE, TRUE, 3); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area ( GTK_DIALOG (self))), vbox, TRUE, TRUE, 0); |