+/** @brief Set 'Manage Users' menu item sensitivity */
+void users_set_sensitive(int sensitive) {
+ GtkWidget *w = gtk_item_factory_get_widget(mainmenufactory,
+ "<GdisorderMain>/Server/Manage users");
+ gtk_widget_set_sensitive(w, sensitive);
+}
+
+/** @brief Called with current user's rights string */
+static void menu_got_rights(void attribute((unused)) *v,
+ const char *error,
+ const char *value) {
+ rights_type r;
+
+ if(error) {
+ popup_protocol_error(0, error);
+ r = 0;
+ } else {
+ if(parse_rights(value, &r, 0))
+ r = 0;
+ }
+ users_set_sensitive(!!(r & RIGHT_ADMIN));
+}
+
+/** @brief Called when we need to reset state */
+static void menu_reset(void) {
+ users_set_sensitive(0); /* until we know better */
+ disorder_eclient_userinfo(client, menu_got_rights, config->username, "rights",
+ 0);
+}
+