changeset 8938:88ec59dec95a

[gaim-migrate @ 9708] Make the Tools->Privacy menu item be insensitive if there are no accounts online that support privacy. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 15 May 2004 22:39:09 +0000
parents fd1a4ff1f7ed
children 19885cb8a24c
files src/gtkblist.c src/gtkprivacy.c src/gtkprivacy.h
diffstat 3 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Sat May 15 21:56:17 2004 +0000
+++ b/src/gtkblist.c	Sat May 15 22:39:09 2004 +0000
@@ -2892,6 +2892,9 @@
 
 	widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
 	gtk_widget_set_sensitive(widget, gaim_roomlist_is_showable());
+
+	widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
+	gtk_widget_set_sensitive(widget, gaim_gtk_privacy_is_showable());
 }
 
 /* this is called on all sorts of signals, and we have no reason to pass
--- a/src/gtkprivacy.c	Sat May 15 21:56:17 2004 +0000
+++ b/src/gtkprivacy.c	Sat May 15 22:39:09 2004 +0000
@@ -347,6 +347,22 @@
 	return (prpl_info->set_permit_deny != NULL);
 }
 
+gboolean
+gaim_gtk_privacy_is_showable()
+{
+	GList *c;
+	GaimConnection *gc;
+
+	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
+		gc = c->data;
+
+		if (check_account_func(gaim_connection_get_account(gc)))
+			return TRUE;
+	}
+
+	return FALSE;
+}
+
 static GaimGtkPrivacyDialog *
 privacy_dialog_new(void)
 {
--- a/src/gtkprivacy.h	Sat May 15 21:56:17 2004 +0000
+++ b/src/gtkprivacy.h	Sat May 15 22:39:09 2004 +0000
@@ -33,6 +33,14 @@
 void gaim_gtk_privacy_init(void);
 
 /**
+ * Determine if showing the privacy dialog is a valid action.
+ *
+ * @return TRUE if there are accounts online that support privacy.
+ *         Otherwise return FALSE.
+ */
+gboolean gaim_gtk_privacy_is_showable(void);
+
+/**
  * Shows the privacy dialog.
  */
 void gaim_gtk_privacy_dialog_show(void);