(de-)sensitized.
Only look up user details to edit if a user is selected.
#define MODE_ADD 1
#define MODE_EDIT 2
#define MODE_ADD 1
#define MODE_EDIT 2
+#define mode(X) do { \
+ users_mode = MODE_##X; \
+ fprintf(stderr, "%s:%d: %s(): mode -> %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, #X); \
+} while(0)
+
static const char *users_email, *users_rights, *users_password;
/** @brief qsort() callback for username comparison */
static const char *users_email, *users_rights, *users_password;
/** @brief qsort() callback for username comparison */
const int bit = leftmost_bit(r);
const GtkWidget *all = users_details_rights[bit];
const int sensitive = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(all));
const int bit = leftmost_bit(r);
const GtkWidget *all = users_details_rights[bit];
const int sensitive = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(all));
gtk_widget_set_sensitive(users_details_rights[bit + 1], sensitive);
gtk_widget_set_sensitive(users_details_rights[bit + 2], sensitive);
}
gtk_widget_set_sensitive(users_details_rights[bit + 1], sensitive);
gtk_widget_set_sensitive(users_details_rights[bit + 2], sensitive);
}
assert(!"reached");
}
gtk_widget_set_sensitive(users_apply_button, apply_sensitive);
assert(!"reached");
}
gtk_widget_set_sensitive(users_apply_button, apply_sensitive);
gtk_widget_set_sensitive(users_delete_button, !!users_selected);
}
gtk_widget_set_sensitive(users_delete_button, !!users_selected);
}
DETAIL_EDITABLE|DETAIL_VISIBLE,
DETAIL_EDITABLE|DETAIL_VISIBLE);
/* Remember we're adding a user */
DETAIL_EDITABLE|DETAIL_VISIBLE,
DETAIL_EDITABLE|DETAIL_VISIBLE);
/* Remember we're adding a user */
}
/** @brief Called when the 'Apply' button is pressed */
}
/** @brief Called when the 'Apply' button is pressed */
users_password,
DETAIL_VISIBLE,
DETAIL_EDITABLE|DETAIL_VISIBLE);
users_password,
DETAIL_VISIBLE,
DETAIL_EDITABLE|DETAIL_VISIBLE);
- users_mode = MODE_EDIT;
}
/** @brief Called when the selection MIGHT have changed */
}
/** @brief Called when the selection MIGHT have changed */
users_makedetails("", "", "", "",
DETAIL_VISIBLE,
DETAIL_VISIBLE);
users_makedetails("", "", "", "",
DETAIL_VISIBLE,
DETAIL_VISIBLE);
- disorder_eclient_userinfo(client, users_got_email, users_selected,
- "email", 0);
- disorder_eclient_userinfo(client, users_got_rights, users_selected,
- "rights", 0);
- disorder_eclient_userinfo(client, users_got_password, users_selected,
- "password", 0);
- users_mode = MODE_NONE; /* not editing *yet* */
+ if(users_selected) {
+ disorder_eclient_userinfo(client, users_got_email, users_selected,
+ "email", 0);
+ disorder_eclient_userinfo(client, users_got_rights, users_selected,
+ "rights", 0);
+ disorder_eclient_userinfo(client, users_got_password, users_selected,
+ "password", 0);
+ }
+ mode(NONE); /* not editing *yet* */
}
/** @brief Table of buttons below the user list */
}
/** @brief Table of buttons below the user list */
gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE/*expand*/, FALSE, 0);
/* Create an empty user details table, and put an apply button below it */
gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE/*expand*/, FALSE, 0);
/* Create an empty user details table, and put an apply button below it */
+ users_apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
users_makedetails("", "", "", "",
DETAIL_VISIBLE,
DETAIL_VISIBLE);
users_makedetails("", "", "", "",
DETAIL_VISIBLE,
DETAIL_VISIBLE);
- users_apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
+ /* TODO apply button is much too wide right now... */
g_signal_connect(users_apply_button, "clicked",
G_CALLBACK(users_apply), NULL);
vbox2 = gtk_vbox_new(FALSE, 2);
g_signal_connect(users_apply_button, "clicked",
G_CALLBACK(users_apply), NULL);
vbox2 = gtk_vbox_new(FALSE, 2);