static const char *users_who, *users_email, *users_rights, *users_password;
+/** @brief qsort() callback for username comparison */
static int usercmp(const void *a, const void *b) {
return strcmp(*(char **)a, *(char **)b);
}
+/** @brief Called with the list of users */
static void users_got_list(void attribute((unused)) *v, int nvec, char **vec) {
int n;
GtkTreeIter iter;
gtk_widget_show_all(users_window);
}
+/** @brief Pick the selected user from the list */
static char *users_getuser(void) {
GtkTreeIter iter;
char *who, *c;
/** @brief Text should be editable */
#define DETAIL_EDITABLE 2
+/** @brief Add a row to the user detail table */
static GtkWidget *users_detail_generic(GtkWidget *table,
int *rowp,
const char *title,
gtk_widget_show_all(users_details_window);
}
+/** @brief Called when the 'add' button is pressed */
static void users_add(GtkButton attribute((unused)) *button,
gpointer attribute((unused)) userdata) {
/* TODO */
}
+/** @brief Called when user deletion goes wrong */
static void users_deleted_error(struct callbackdata attribute((unused)) *cbd,
int attribute((unused)) code,
const char *msg) {
popup_msg(GTK_MESSAGE_ERROR, msg);
}
+/** @brief Called when a user has been deleted */
static void users_deleted(void *v) {
const struct callbackdata *const cbd = v;
GtkTreeIter iter;
g_free(who);
}
+/** @brief Called when the 'Delete' button is pressed */
static void users_delete(GtkButton attribute((unused)) *button,
gpointer attribute((unused)) userdata) {
GtkWidget *yesno;
users_password);
}
+/** @brief Called when the 'Edit' button is pressed */
static void users_edit(GtkButton attribute((unused)) *button,
gpointer attribute((unused)) userdata) {
if(!(users_who = users_getuser()))
disorder_eclient_userinfo(client, users_got_password, users_who, "password", 0);
}
+/** @brief Table of buttons for the user window */
static const struct button users_buttons[] = {
{
"Add user",
};
#define NUSERS_BUTTONS (sizeof users_buttons / sizeof *users_buttons)
+/** @brief Pop up the user management window */
void manage_users(void) {
GtkWidget *tree, *buttons, *hbox;
GtkCellRenderer *cr;