Code review and cleanup.
This commit is contained in:
1 parent
bbe931335f
commit
92d6ad3cc4
23 files changed
+1497
-886
No files matched your search
@@ -22,7 +22,7 @@ static void name_toggle_cells(void) {
|
||||
}
|
||||
static void tentacle_selected(GtkTreeSelection *selection, gpointer data) {
|
||||
(void)selection; (void)data;
|
||||
if (!updating) prefs_set_action(16);
|
||||
if (!updating) prefs_set_action(PREFS_TENTACLE_SELECT);
|
||||
}
|
||||
static void tentacle_clicked(GtkButton *button, gpointer data) {
|
||||
(void)button;
|
||||
@@ -36,12 +36,12 @@ static void tentacle_toggled(GtkCellRendererToggle *renderer, gchar *pathString,
|
||||
gtk_tree_path_free(path);
|
||||
// The accepted backend snapshot owns the check state; never check
|
||||
// optimistically before persistence or after an operation has failed.
|
||||
prefs_set_action(11);
|
||||
prefs_set_action(PREFS_TENTACLE_TOGGLE);
|
||||
}
|
||||
static gboolean tentacle_key(GtkWidget *widget, GdkEventKey *event, gpointer data) {
|
||||
(void)widget; (void)data;
|
||||
if (event->keyval != GDK_KEY_space && event->keyval != GDK_KEY_KP_Space) return FALSE;
|
||||
prefs_set_action(11);
|
||||
prefs_set_action(PREFS_TENTACLE_TOGGLE);
|
||||
return TRUE;
|
||||
}
|
||||
static void repository_switched(GtkNotebook *notebook, GtkWidget *page, guint index, gpointer data) {
|
||||
@@ -54,7 +54,7 @@ static void repository_switched(GtkNotebook *notebook, GtkWidget *page, guint in
|
||||
gtk_container_add(GTK_CONTAINER(page), scroll);
|
||||
g_object_unref(scroll);
|
||||
}
|
||||
if (!updating) prefs_set_action(17);
|
||||
if (!updating) prefs_set_action(PREFS_TENTACLE_REPOSITORY_SELECT);
|
||||
}
|
||||
void prefs_init_tentacles(void) {
|
||||
updating = FALSE;
|
||||
@@ -74,9 +74,15 @@ void prefs_init_tentacles(void) {
|
||||
g_signal_connect(tree, "key-press-event", G_CALLBACK(tentacle_key), NULL);
|
||||
g_signal_connect(prefs_widget("tentacleRepositories"), "switch-page", G_CALLBACK(repository_switched), NULL);
|
||||
const struct { const char *id; int action; } buttons[] = {
|
||||
{"tentacleNew", 9}, {"tentacleRetry", 13}, {"tentacleRemove", 14},
|
||||
{"tentacleRefresh", 15}, {"tentacleRepositoryRemove", 12}, {"tentacleRepositoryRefresh", 18},
|
||||
{"tentacleInstall", 19}, {"tentacleUpdate", 21}, {"tentacleSettings", 20},
|
||||
{"tentacleNew", PREFS_TENTACLE_REPOSITORY_ADD},
|
||||
{"tentacleRetry", PREFS_TENTACLE_RETRY},
|
||||
{"tentacleRemove", PREFS_TENTACLE_REMOVE},
|
||||
{"tentacleRefresh", PREFS_TENTACLE_REFRESH},
|
||||
{"tentacleRepositoryRemove", PREFS_TENTACLE_REPOSITORY_REMOVE},
|
||||
{"tentacleRepositoryRefresh", PREFS_TENTACLE_REPOSITORY_REFRESH},
|
||||
{"tentacleInstall", PREFS_TENTACLE_INSTALL},
|
||||
{"tentacleUpdate", PREFS_TENTACLE_UPDATE},
|
||||
{"tentacleSettings", PREFS_TENTACLE_SETTINGS},
|
||||
};
|
||||
for (unsigned i = 0; i < G_N_ELEMENTS(buttons); i++)
|
||||
g_signal_connect(prefs_widget(buttons[i].id), "clicked", G_CALLBACK(tentacle_clicked), GINT_TO_POINTER(buttons[i].action));
|
||||
|
||||
Reference in new issue
Block a user