/** @brief Main menu widgets */
GtkItemFactory *mainmenufactory;
-static void about_popup_got_version(void *v, const char *value);
+static void about_popup_got_version(void *v,
+ const char *error,
+ const char *value);
/** @brief Called when the quit option is activated
*
/** @brief Called when version arrives, displays about... popup */
static void about_popup_got_version(void attribute((unused)) *v,
+ const char attribute((unused)) *error,
const char *value) {
GtkWidget *w;
char *server_version_string;
char *short_version_string;
GtkWidget *hbox, *vbox, *title;
+ if(!value)
+ value = "[error]";
byte_xasprintf(&server_version_string, "Server version %s", value);
byte_xasprintf(&short_version_string, "Disobedience %s",
disorder_short_version_string);
}
/** @brief Called with current user's rights string */
-static void menu_got_rights(void attribute((unused)) *v, const char *value) {
+static void menu_got_rights(void attribute((unused)) *v,
+ const char *error,
+ const char *value) {
rights_type r;
- if(parse_rights(value, &r, 0))
+ 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) {
+/** @brief Called after a fresh login */
+static void menu_logged_in(const char attribute((unused)) *event,
+ void attribute((unused)) *eventdata,
+ void attribute((unused)) *callbackdata) {
users_set_sensitive(0); /* until we know better */
disorder_eclient_userinfo(client, menu_got_rights, config->username, "rights",
0);
assert(selectall_widget != 0);
assert(selectnone_widget != 0);
assert(properties_widget != 0);
- register_reset(menu_reset);
- menu_reset();
+ event_register("logged-in", menu_logged_in, 0);
+ menu_logged_in(0, 0, 0);
m = gtk_item_factory_get_widget(mainmenufactory,
"<GdisorderMain>");
set_tool_colors(m);