pidgin/pidgin

Parents e57d4b9303ee
Children f88830d41330
Properly set the sensitive state of the "enable account" menu item based on whether or not any accounts are disabled.

Testing Done:
* verified disabled with all accounts enabled at start up
* disabled all accounts
* enabled all accounts

Reviewed at https://reviews.imfreedom.org/r/214/
--- a/pidgin/pidginaccountactionsmenu.c Thu Nov 12 20:14:37 2020 -0600
+++ b/pidgin/pidginaccountactionsmenu.c Fri Nov 13 22:19:28 2020 -0600
@@ -1,5 +1,6 @@
/*
- * pidgin
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
*
* Pidgin is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
@@ -16,8 +17,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include "pidginaccountactionsmenu.h"
--- a/pidgin/pidginaccountactionsmenu.h Thu Nov 12 20:14:37 2020 -0600
+++ b/pidgin/pidginaccountactionsmenu.h Fri Nov 13 22:19:28 2020 -0600
@@ -1,5 +1,6 @@
/*
- * pidgin
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
*
* Pidgin is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
@@ -16,8 +17,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
--- a/pidgin/pidginaccountsmenu.c Thu Nov 12 20:14:37 2020 -0600
+++ b/pidgin/pidginaccountsmenu.c Fri Nov 13 22:19:28 2020 -0600
@@ -1,5 +1,6 @@
/*
- * pidgin
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
*
* Pidgin is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
@@ -16,8 +17,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include "pidginaccountsmenu.h"
@@ -32,6 +32,7 @@
struct _PidginAccountsMenu {
GtkMenu parent;
+ GtkWidget *enable_account;
GtkWidget *disabled_menu;
GtkWidget *separator;
@@ -87,6 +88,10 @@
if(found) {
g_clear_pointer(&data, gtk_widget_destroy);
g_hash_table_remove(menu->disabled_items, account);
+
+ if(g_hash_table_size(menu->disabled_items) == 0) {
+ gtk_widget_set_sensitive(menu->enable_account, FALSE);
+ }
}
item = pidgin_accounts_menu_create_account_menu_item(menu, account);
@@ -126,6 +131,11 @@
g_hash_table_insert(menu->disabled_items,
g_object_ref(G_OBJECT(account)),
item);
+
+ /* We know there's at least one item in the menu, so make sure it is
+ * sensitive.
+ */
+ gtk_widget_set_sensitive(menu->enable_account, TRUE);
}
static void
@@ -238,6 +248,8 @@
);
gtk_widget_class_bind_template_child(widget_class, PidginAccountsMenu,
+ enable_account);
+ gtk_widget_class_bind_template_child(widget_class, PidginAccountsMenu,
disabled_menu);
gtk_widget_class_bind_template_child(widget_class, PidginAccountsMenu,
separator);
--- a/pidgin/pidginaccountsmenu.h Thu Nov 12 20:14:37 2020 -0600
+++ b/pidgin/pidginaccountsmenu.h Fri Nov 13 22:19:28 2020 -0600
@@ -1,5 +1,6 @@
/*
- * pidgin
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
*
* Pidgin is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
@@ -16,8 +17,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
--- a/pidgin/resources/Accounts/menu.ui Thu Nov 12 20:14:37 2020 -0600
+++ b/pidgin/resources/Accounts/menu.ui Fri Nov 13 22:19:28 2020 -0600
@@ -40,8 +40,9 @@
</object>
</child>
<child>
- <object class="GtkMenuItem">
+ <object class="GtkMenuItem" id="enable_account">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Enable Account</property>
<property name="use_underline">True</property>