extern void admin_edit_block(GtkCellRendererText *cell, const char *path_string, const char *new_text, gpointer data) { GtkTreeStore *treestore = GTK_TREE_STORE(data); GtkTreePath *path = gtk_tree_path_new_from_string(path_string); GtkTreeIter iter; int column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), "column")); char *blockid = NULL; char *old_text = NULL; if (!new_text || !xstrcmp(new_text, "")) goto no_input; gtk_tree_model_get_iter(GTK_TREE_MODEL(treestore), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(treestore), &iter, SORTID_BLOCK, &blockid, column, &old_text, -1); switch(column) { case SORTID_STATE: update_state_block(NULL, blockid, new_text); break; default: break; } g_free(blockid); g_free(old_text); no_input: gtk_tree_path_free(path); g_mutex_unlock(sview_mutex); }
static void _admin_block(GtkTreeModel *model, GtkTreeIter *iter, char *type) { char *blockid = NULL; GtkWidget *popup = NULL; if (cluster_flags & CLUSTER_FLAG_FED) { display_fed_disabled_popup(type); return; } popup = gtk_dialog_new_with_buttons( type, GTK_WINDOW(main_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, NULL); gtk_window_set_transient_for(GTK_WINDOW(popup), NULL); gtk_tree_model_get(model, iter, SORTID_BLOCK, &blockid, -1); update_state_block(GTK_DIALOG(popup), blockid, type); g_free(blockid); gtk_widget_destroy(popup); return; }