static void prefs_summary_column_set_dialog(SummaryColumnState *state) { GtkCList *stock_clist = GTK_CLIST(summary_col.stock_clist); GtkCList *shown_clist = GTK_CLIST(summary_col.shown_clist); gint pos; SummaryColumnType type; gchar *name; gtk_clist_clear(stock_clist); gtk_clist_clear(shown_clist); if (!state) state = prefs_summary_column_get_config(); for (pos = 0; pos < N_SUMMARY_COLS; pos++) { gint row; type = state[pos].type; name = gettext(col_name[type]); if (state[pos].visible) { row = gtk_clist_append(shown_clist, (gchar **)&name); gtk_clist_set_row_data(shown_clist, row, GINT_TO_POINTER(type)); } else { row = gtk_clist_append(stock_clist, (gchar **)&name); gtk_clist_set_row_data(stock_clist, row, GINT_TO_POINTER(type)); } } }
static void glade_keys_dialog_init (GladeKeysDialog *dialog) { GtkWidget *scrolled_win; int i, row; gchar *titles[1]; gtk_window_set_title (GTK_WINDOW (dialog), _("Select Accelerator Key")); gtk_window_set_wmclass (GTK_WINDOW (dialog), "accelerator_key", "Glade"); titles[0] = _("Keys"); dialog->clist = gtk_clist_new_with_titles (1, titles); gtk_clist_column_titles_passive (GTK_CLIST (dialog->clist)); gtk_widget_set_usize (dialog->clist, 200, 300); gtk_widget_show (dialog->clist); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_win), dialog->clist); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scrolled_win, TRUE, TRUE, 0); gtk_widget_show (scrolled_win); /* Insert events & descriptions */ gtk_clist_freeze (GTK_CLIST (dialog->clist)); i = 0; while (GbKeys[i].name) { row = gtk_clist_append (GTK_CLIST (dialog->clist), (gchar**) (&GbKeys[i].name)); gtk_clist_set_row_data (GTK_CLIST (dialog->clist), row, GINT_TO_POINTER (i)); i++; } gtk_clist_thaw (GTK_CLIST (dialog->clist)); #ifdef USE_GNOME dialog->ok_button = gnome_stock_button (GNOME_STOCK_BUTTON_OK); #else dialog->ok_button = gtk_button_new_with_label (_ ("OK")); #endif gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), dialog->ok_button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (dialog->ok_button, GTK_CAN_DEFAULT); gtk_widget_grab_default (dialog->ok_button); gtk_widget_show (dialog->ok_button); #ifdef USE_GNOME dialog->cancel_button = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); #else dialog->cancel_button = gtk_button_new_with_label (_("Cancel")); #endif gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), dialog->cancel_button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (dialog->cancel_button, GTK_CAN_DEFAULT); gtk_widget_show (dialog->cancel_button); }
void add_item (gchar *label, gpointer data) { GtkWidget *curve = lookup_widget(app,"curve"); GtkWidget *clist = lookup_widget(app,"clist"); list_entry_t *le; gint row; gchar *labels[2]; if (label==NULL) return; le = g_new (list_entry_t,1); le->minx = gtk_spin_button_get_value_as_float (lookup_widget(app,"minx")); le->maxx = gtk_spin_button_get_value_as_float (lookup_widget(app,"maxx")); le->miny = gtk_spin_button_get_value_as_float (lookup_widget(app,"miny")); le->maxy = gtk_spin_button_get_value_as_float (lookup_widget(app,"maxy")); le->count = gtk_spin_button_get_value_as_int (lookup_widget(app,"count")); le->type = gtk_entry_get_text (lookup_widget(app,"typeentry")); le->name = g_strdup(label); labels[0] = "A+"; labels[1] = le->name; row = gtk_clist_append (clist,labels); gtk_clist_set_row_data (clist,row,le); }
static void dbg_property_set_row(GtkCList *clist, gint row, property_t prop) { gint i; g_assert(clist); g_assert(row != -1); for (i = 0; i < (gint) num_dbg_cols; i++) { const gchar *text; switch ((enum dbg_cols) i) { case dbg_col_saved: text = gnet_prop_is_saved(prop) ? _("Yes") : _("No"); break; case dbg_col_type: text = gnet_prop_type_to_string(prop); break; case dbg_col_name: text = gnet_prop_name(prop); break; case dbg_col_value: text = gnet_prop_to_string(prop); break; default: g_assert_not_reached(); text = "(null)"; } gtk_clist_set_text(clist, row, i, text); } gtk_clist_set_row_data(clist, row, GUINT_TO_POINTER(prop)); }
/** * Adds the given node to the gui. */ void nodes_gui_add_node(gnet_node_info_t *n) { GtkCList *clist_nodes; const gchar *titles[c_gnet_num]; gchar proto_tmp[32]; gint row; g_assert(n != NULL); str_bprintf(proto_tmp, sizeof proto_tmp, "%d.%d", n->proto_major, n->proto_minor); titles[c_gnet_host] = host_addr_port_to_string(n->addr, n->port); titles[c_gnet_flags] = "..."; titles[c_gnet_user_agent] = n->vendor ? lazy_utf8_to_locale(n->vendor) : "..."; titles[c_gnet_loc] = iso3166_country_cc(n->country); titles[c_gnet_version] = proto_tmp; titles[c_gnet_connected] = "..."; titles[c_gnet_uptime] = "..."; titles[c_gnet_info] = "..."; clist_nodes = GTK_CLIST(gui_main_window_lookup("clist_nodes")); row = gtk_clist_append(clist_nodes, (gchar **) titles); /* override const */ gtk_clist_set_row_data(clist_nodes, row, deconstify_gpointer(nid_ref(n->node_id))); }
static void prefs_summary_column_remove(void) { GtkCList *stock_clist = GTK_CLIST(summary_col.stock_clist); GtkCList *shown_clist = GTK_CLIST(summary_col.shown_clist); gint row; SummaryColumnType type; gchar *name; if (!shown_clist->selection) return; row = GPOINTER_TO_INT(shown_clist->selection->data); type = GPOINTER_TO_INT(gtk_clist_get_row_data(shown_clist, row)); gtk_clist_remove(shown_clist, row); if (shown_clist->rows == row) gtk_clist_select_row(shown_clist, row - 1, -1); if (!stock_clist->selection) row = 0; else row = GPOINTER_TO_INT(stock_clist->selection->data) + 1; name = gettext(col_name[type]); row = gtk_clist_insert(stock_clist, row, (gchar **)&name); gtk_clist_set_row_data(stock_clist, row, GINT_TO_POINTER(type)); gtk_clist_select_row(stock_clist, row, -1); }
static void key_dialog_add_new (GtkWidget * button, GtkCList * list) { gchar *strs[] = { "", NULL, NULL, NULL, NULL }; struct key_binding *kb; strs[1] = _("<none>"); strs[2] = _("<none>"); strs[3] = _("<none>"); strs[4] = _("<none>"); kb = malloc (sizeof (struct key_binding)); kb->keyval = 0; kb->keyname = NULL; kb->action = -1; kb->mod = 0; kb->data1 = kb->data2 = NULL; kb->next = keys_root; keys_root = kb; gtk_clist_set_row_data (GTK_CLIST (list), gtk_clist_append (GTK_CLIST (list), strs), kb); }
void DownloadUI::UpdateDownloadList(void) { if (!m_List || !isVisible) return; gtk_clist_freeze(GTK_CLIST(m_List)); gtk_clist_clear(GTK_CLIST(m_List)); uint32 iLoop = downloadList.size(); if (iLoop == 0) { gtk_clist_thaw(GTK_CLIST(m_List)); return; } for (uint32 i = 0; i < iLoop; i++) { DownloadItem *dli = downloadList[i]; char *iText[2]; string displayString = dli->GetMetaData().Title(); iText[0] = (char *)displayString.c_str(); iText[1] = (char *)StatusString(dli).c_str(); int row = gtk_clist_append(GTK_CLIST(m_List), iText); gtk_clist_set_row_data(GTK_CLIST(m_List), row, (gpointer)dli); } gtk_clist_select_row(GTK_CLIST(m_List), m_currentindex, 0); SelChangeEvent(m_currentindex); gtk_clist_thaw(GTK_CLIST(m_List)); }
static void prefs_display_items_add(GtkWidget *widget, gpointer data) { PrefsDisplayItemsDialog *dialog = data; GtkCList *stock_clist = GTK_CLIST(dialog->stock_clist); GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist); PrefsDisplayItem *item; gint row; gchar *name; if (!stock_clist->selection) return; row = GPOINTER_TO_INT(stock_clist->selection->data); item = (PrefsDisplayItem *)gtk_clist_get_row_data(stock_clist, row); if (!item->allow_multiple) { gtk_clist_remove(stock_clist, row); if (stock_clist->rows == row) gtk_clist_select_row(stock_clist, row - 1, -1); } if (!shown_clist->selection) row = 0; else row = GPOINTER_TO_INT(shown_clist->selection->data); item->in_use = TRUE; name = gettext(item->label); row = gtk_clist_insert(shown_clist, row, (gchar **)&name); gtk_clist_set_row_data(shown_clist, row, item); prefs_display_items_set_sensitive(dialog); }
static void imp_ldif_update_row( GtkCList *clist ) { Ldif_FieldRec *rec; gchar *text[ FIELDS_N_COLS ]; gint row; if( impldif_dlg.rowIndSelect < 0 ) return; row = impldif_dlg.rowIndSelect; rec = gtk_clist_get_row_data( clist, row ); text[ FIELD_COL_SELECT ] = ""; text[ FIELD_COL_FIELD ] = rec->tagName; text[ FIELD_COL_ATTRIB ] = rec->userName; gtk_clist_freeze( clist ); gtk_clist_remove( clist, row ); if( row == impldif_dlg.rowCount - 1 ) { gtk_clist_append( clist, text ); } else { gtk_clist_insert( clist, row, text ); } if( rec->selected ) gtk_clist_set_pixmap( clist, row, FIELD_COL_SELECT, markxpm, markxpmmask ); gtk_clist_set_row_data( clist, row, rec ); gtk_clist_thaw( clist ); }
static void imp_ldif_load_fields( LdifFile *ldf ) { GtkCList *clist = GTK_CLIST(impldif_dlg.clist_field); GList *node, *list; gchar *text[ FIELDS_N_COLS ]; impldif_dlg.rowIndSelect = -1; impldif_dlg.rowCount = 0; if( ! ldf->accessFlag ) return; gtk_clist_clear( clist ); list = ldif_get_fieldlist( ldf ); node = list; while( node ) { Ldif_FieldRec *rec = node->data; gint row; if( ! rec->reserved ) { text[ FIELD_COL_SELECT ] = ""; text[ FIELD_COL_FIELD ] = rec->tagName; text[ FIELD_COL_ATTRIB ] = rec->userName; row = gtk_clist_append( clist, text ); gtk_clist_set_row_data( clist, row, rec ); if( rec->selected ) gtk_clist_set_pixmap( clist, row, FIELD_COL_SELECT, markxpm, markxpmmask ); impldif_dlg.rowCount++; } node = g_list_next( node ); } g_list_free( list ); list = NULL; ldif_set_accessed( ldf, FALSE ); }
/* Displays contents of a directory in the file list */ void filelist_populate( GNode *dnode ) { GNode *node; GList *node_list = NULL, *node_llink; Icon *icon; int row, count = 0; char *empty_row[] = { NULL }; char strbuf[64]; g_assert( NODE_IS_DIR(dnode) ); /* Get an alphabetized list of directory's immediate children */ node = dnode->children; while (node != NULL) { G_LIST_PREPEND(node_list, node); node = node->next; } G_LIST_SORT(node_list, compare_node); /* Update file clist */ gtk_clist_freeze( GTK_CLIST(file_clist_w) ); gtk_clist_clear( GTK_CLIST(file_clist_w) ); node_llink = node_list; while (node_llink != NULL) { node = (GNode *)node_llink->data; row = gtk_clist_append( GTK_CLIST(file_clist_w), empty_row ); icon = &node_type_mini_icons[NODE_DESC(node)->type]; gtk_clist_set_pixtext( GTK_CLIST(file_clist_w), row, 0, NODE_DESC(node)->name, 2, icon->pixmap, icon->mask ); gtk_clist_set_row_data( GTK_CLIST(file_clist_w), row, node ); ++count; node_llink = node_llink->next; } gtk_clist_thaw( GTK_CLIST(file_clist_w) ); g_list_free( node_list ); /* Set node count message in the left statusbar */ switch (count) { case 0: strcpy( strbuf, "" ); break; case 1: strcpy( strbuf, _("1 node") ); break; default: sprintf( strbuf, _("%d nodes"), count ); break; } window_statusbar( SB_LEFT, strbuf ); filelist_current_dnode = dnode; filelist_reset_access( ); }
void ghack_menu_destroy (GtkWidget *menuWin, gpointer data) { MenuWinType isMenu; isMenu = (MenuWinType) GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuWin), "isMenu")); if (isMenu == MenuText) { GnomeLess *gless; gless = GNOME_LESS (gtk_object_get_data (GTK_OBJECT (menuWin), "gless")); g_assert (gless != NULL); g_assert (gless->text != NULL); g_assert (GTK_IS_TEXT (gless->text)); gtk_widget_destroy(GTK_WIDGET(gless)); } else if (isMenu == MenuMenu) { GtkWidget *frame1, *swin, *clist; /* destroy existing menu data, if any */ clist = gtk_object_get_data (GTK_OBJECT (menuWin), "clist"); if (clist) { /* destroy all the row_data we stored in the clist */ int i, numRows; menuItem* item; numRows = GPOINTER_TO_INT( gtk_object_get_data( GTK_OBJECT(clist), "numRows") ); for( i=0; i<numRows; i++) { item = (menuItem*) gtk_clist_get_row_data( GTK_CLIST (clist), i); if (item != NULL) { g_free( item); gtk_clist_set_row_data (GTK_CLIST (clist), i, (gpointer) NULL); } } gtk_object_set_data (GTK_OBJECT (clist), "numItems", GINT_TO_POINTER (-1)); gtk_widget_destroy (clist); } swin = gtk_object_get_data (GTK_OBJECT (menuWin), "swin"); if (swin) { gtk_widget_destroy (swin); } frame1 = gtk_object_get_data (GTK_OBJECT (menuWin), "frame1"); if (frame1) { gtk_widget_destroy (frame1); } } gnome_delete_nhwindow_by_reference (menuWin); }
static void addUserInListBox(MAINWIN *ctl, HUSER usr) { gchar *tbl[] = { "A", "*Failed*" }; int pos; tbl[1] = (char *) icqQueryUserNick(usr); pos = gtk_clist_append(GTK_CLIST(ctl->listBox),(gchar **) &tbl); gtk_clist_set_row_data(GTK_CLIST(ctl->listBox),pos,usr); gtk_clist_set_pixmap (GTK_CLIST(ctl->listBox),pos,0,ctl->iPixmap[usr->modeIcon],ctl->iBitmap[usr->modeIcon]); }
void prefs_display_items_dialog_set_visible(PrefsDisplayItemsDialog *dialog, const gint *ids) { GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist); GList *cur; PrefsDisplayItem *item; gint i; gint row; gchar *name; g_return_if_fail(dialog->available_items != NULL); if (!ids) ids = dialog->default_visible_ids; g_return_if_fail(ids != NULL); gtk_clist_clear(shown_clist); if (dialog->visible_items) { g_list_free(dialog->visible_items); dialog->visible_items = NULL; } for (cur = dialog->available_items; cur != NULL; cur = cur->next) { item = cur->data; item->in_use = FALSE; } for (i = 0; ids[i] != -1; i++) { gint id = ids[i]; item = prefs_display_items_get_item_from_id(dialog, id); g_return_if_fail(item != NULL); g_return_if_fail(item->allow_multiple || item->in_use == FALSE); item->in_use = TRUE; name = gettext(item->label); row = gtk_clist_append(shown_clist, (gchar **)&name); gtk_clist_set_row_data(shown_clist, row, item); } name = "--------"; row = gtk_clist_append(shown_clist, (gchar **)&name); gtk_widget_ensure_style(GTK_WIDGET(shown_clist)); gtk_clist_set_foreground (shown_clist, row, >K_WIDGET(shown_clist)->style->text[GTK_STATE_INSENSITIVE]); prefs_display_items_update_available(dialog); prefs_display_items_set_sensitive(dialog); gtk_clist_moveto(shown_clist, 0, 0, 0, 0); }
static void object_moved_cb(Object_t *obj, gpointer data) { Selection_t *selection = (Selection_t*) data; selection->select_lock = TRUE; #ifdef _OLD_ { gint row = object_get_position_in_list(obj); gtk_clist_set_row_data(GTK_CLIST(selection->list), row, (gpointer) obj); selection_set_selected(selection, row); } #endif }
void DownloadUI::AddItem(DownloadItem *dli) { if (!dli || !m_List || !isVisible) return; char *iText[2]; string displayString = dli->GetMetaData().Title(); iText[0] = (char *)displayString.c_str(); iText[1] = (char *)StatusString(dli).c_str(); int row = gtk_clist_append(GTK_CLIST(m_List), iText); gtk_clist_set_row_data(GTK_CLIST(m_List), row, (gpointer)dli); }
static int add_mod(const char *module, const char *description, int usecount, const char *like) { char use[10]; char *pass[4]; int row; snprintf(use, sizeof(use), "%d", usecount); pass[0] = module; pass[1] = description; pass[2] = use; pass[3] = NULL; row = gtk_clist_append(GTK_CLIST(modules), pass); gtk_clist_set_row_data(GTK_CLIST(modules), row, module); return 0; }
void add_minilist_item(GtkWidget * button, gpointer data) { int added_row; gchar *to_add[1]; struct slist_gui *the_gui = (struct slist_gui *) data; struct fnlist *current, *new_one; if (!the_gui) { NE_DEBUG(DEBUG_GNOME, "WARNING: gui component was null.\n"); return; } to_add[0] = strdup("New filename or expression"); added_row = gtk_clist_append(GTK_CLIST(the_gui->list), to_add); current = the_gui->data; if (current != NULL) while (current->next != NULL) current = current->next; new_one = malloc(sizeof(struct fnlist)); new_one->pattern = to_add[0]; new_one->next = NULL; if (!current) { new_one->prev = NULL; the_gui->data = new_one; switch (the_gui->type) { case list_exclude: selected_site->excludes = the_gui->data; the_gui->data = selected_site->excludes; break; case list_ascii: selected_site->asciis = the_gui->data; the_gui->data = selected_site->asciis; break; case list_ignore: selected_site->ignores = the_gui->data; the_gui->data = selected_site->ignores; break; } } else { new_one->prev = current; current->next = new_one; } gtk_clist_set_row_data(GTK_CLIST(the_gui->list), added_row, (gpointer) new_one); gtk_clist_select_row(GTK_CLIST(the_gui->list), added_row, 0); }
static void prefs_display_header_set_dialog(void) { GtkCList *clist = GTK_CLIST(dispheader.headers_clist); GtkCList *hidden_clist = GTK_CLIST(dispheader.hidden_headers_clist); GSList *cur; gchar *dp_str[1]; gint row; gtk_clist_freeze(clist); gtk_clist_freeze(hidden_clist); gtk_clist_clear(clist); gtk_clist_clear(hidden_clist); for (cur = prefs_common.disphdr_list; cur != NULL; cur = cur->next) { DisplayHeaderProp *dp = (DisplayHeaderProp *)cur->data; dp_str[0] = dp->name; if (dp->hidden) { row = gtk_clist_append(hidden_clist, dp_str); gtk_clist_set_row_data(hidden_clist, row, dp); } else { row = gtk_clist_append(clist, dp_str); gtk_clist_set_row_data(clist, row, dp); } } gtk_clist_thaw(hidden_clist); gtk_clist_thaw(clist); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dispheader.other_headers), prefs_common.show_other_header); }
static gint fontsel_style_list_insert (gpointer key, gpointer value, gpointer data) { gint row; gchar *text[1]; GtkWidget *clist = (GtkWidget *)data; text[0] = (gchar *)key; row = gtk_clist_append (GTK_CLIST (clist), text); gtk_clist_set_row_data (GTK_CLIST (clist), row, value); return FALSE; }
void ghack_menu_window_clear(GtkWidget *menuWin, gpointer data) { MenuWinType isMenu; int i, numRows; menuItem* item; isMenu = (MenuWinType) GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuWin), "isMenu")); if (isMenu == MenuMenu) { GtkWidget *clist; clist = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (menuWin), "clist")); g_assert (clist != NULL); /* destroy existing menu data, if any */ if (clist) { /* destroy all the row_data we stored in the clist */ numRows = GPOINTER_TO_INT( gtk_object_get_data( GTK_OBJECT(clist), "numRows") ); for( i=0; i<numRows; i++) { item = (menuItem*) gtk_clist_get_row_data( GTK_CLIST (clist), i); if (item != NULL) { g_free( item); gtk_clist_set_row_data (GTK_CLIST (clist), i, (gpointer) NULL); } } gtk_object_set_data (GTK_OBJECT (clist), "numItems", GINT_TO_POINTER (-1)); gtk_clist_clear (GTK_CLIST (clist)); } } else if (isMenu == MenuText) { GnomeLess *gless; gless = GNOME_LESS (gtk_object_get_data (GTK_OBJECT (menuWin), "gless")); g_assert (gless != NULL); gtk_editable_delete_text (GTK_EDITABLE (gless->text), 0, 0); } }
void gnome_o_put_the_damn_rules_in_the_box (GtkWidget * w) { int numrules, x; rule *r; GtkCList *clist; clist = GTK_CLIST (lookup_widget (w, "clist1")); gtk_clist_clear (clist); r = (rule *) db_fetch_rules (&numrules); for (x = 0; x < numrules; x++) { gtk_clist_insert (clist, x, &(r[x].name)); gtk_clist_set_row_data (clist, x, &r[x]); } return; }
static void glade_keys_dialog_init (GladeKeysDialog *dialog) { GtkWidget *scrolled_win; int i, row; gchar *titles[1]; gtk_window_set_title (GTK_WINDOW (dialog), _("Select Accelerator Key")); gtk_window_set_wmclass (GTK_WINDOW (dialog), "accelerator_key", "Glade"); titles[0] = _("Keys"); dialog->clist = gtk_clist_new_with_titles (1, titles); gtk_clist_column_titles_passive (GTK_CLIST (dialog->clist)); gtk_widget_set_usize (dialog->clist, 200, 300); gtk_widget_show (dialog->clist); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_win), dialog->clist); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scrolled_win, TRUE, TRUE, 0); gtk_widget_show (scrolled_win); /* Insert events & descriptions */ gtk_clist_freeze (GTK_CLIST (dialog->clist)); i = 0; while (GbKeys[i].name) { row = gtk_clist_append (GTK_CLIST (dialog->clist), (gchar**) (&GbKeys[i].name)); gtk_clist_set_row_data (GTK_CLIST (dialog->clist), row, GINT_TO_POINTER (i)); i++; } gtk_clist_thaw (GTK_CLIST (dialog->clist)); gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); }
void on_list_open_clicked (GtkButton *button, gpointer user_data) { GtkCList *clist = lookup_widget(app,"clist"); gint i; list_entry_t *le; FILE *file; gchar *filename; gchar line[1000]; filename = g_strdup_printf ("%s/.curvegenrc",g_get_home_dir()); file = fopen(filename,"r"); if (file) { gint n; fgets(line,1000,file); n = atoi(line); for (i=0; i<n; i++) { gint row; gchar *labels[2]; le = g_new (list_entry_t,1); fgets (line,1000,file); le->name = g_strdup(line); fgets (line,1000,file); le->minx = atof(line); fgets (line,1000,file); le->maxx = atof(line); fgets (line,1000,file); le->miny = atof(line); fgets (line,1000,file); le->maxy = atof(line); fgets (line,1000,file); le->count = atoi(line); fgets (line,1000,file); le->type = g_strdup(line); labels[0] = "A+"; labels[1] = le->name; row = gtk_clist_append (clist,labels); gtk_clist_set_row_data (clist,row,le); } fclose (file); } g_free (filename); }
void on_rule_new_rule_clicked (GtkButton * button, gpointer UNUSED(user_data)) { rule *r; int x; GtkCList *clist; r = (rule *) malloc (sizeof (rule)); r->regex = g_strdup (""); r->mbox = g_strdup ("Inbox"); r->name = g_strdup ("New rule"); r->piece = g_strdup ("Header"); clist = GTK_CLIST (lookup_widget (GTK_WIDGET (button), "clist1")); x = clist->rows; gtk_clist_insert (clist, x, &(r->name)); gtk_clist_set_row_data (clist, x, r); gtk_clist_select_row (clist, x, 0); }
static void ssl_manager_load_certs (void) { DIR *dir; struct dirent *d; gchar *path; int row = 0; path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "certs", G_DIR_SEPARATOR_S, NULL); gtk_clist_clear(GTK_CLIST(manager.certlist)); if((dir = opendir(path)) == NULL) { perror("opendir"); return; } while ((d = readdir(dir)) != NULL) { gchar *server, *port, *text[2]; SSLCertificate *cert; if(!strstr(d->d_name, ".cert")) continue; server = get_server(d->d_name); port = get_port(d->d_name); text[0] = g_strdup(server); text[1] = g_strdup(port); gtk_clist_append(GTK_CLIST(manager.certlist), text); cert = ssl_certificate_find_lookup(server, atoi(port), FALSE); gtk_clist_set_row_data(GTK_CLIST(manager.certlist), row, cert); g_free(server); g_free(port); g_free(text[0]); g_free(text[1]); row++; } closedir(dir); g_free(path); }
static void prefs_display_items_update_available (PrefsDisplayItemsDialog *dialog) { GtkCList *stock_clist = GTK_CLIST(dialog->stock_clist); GList *cur; g_return_if_fail(dialog->available_items != NULL); gtk_clist_clear(stock_clist); for (cur = dialog->available_items; cur != NULL; cur = cur->next) { PrefsDisplayItem *item = cur->data; gint row; gchar *name; if (item->allow_multiple || item->in_use == FALSE) { name = gettext(item->label); row = gtk_clist_append(stock_clist, (gchar **)&name); gtk_clist_set_row_data(stock_clist, row, item); } } }
void fe_dcc_update_chat_win (void) { struct DCC *dcc; GSList *list = dcc_list; gchar *nnew[5]; char pos[14]; char siz[14]; gint row; int selrow; if (!dcccwin.window) return; selrow = gtkutil_clist_selection (dcccwin.list); gtk_clist_clear ((GtkCList *) dcccwin.list); nnew[2] = pos; nnew[3] = siz; while (list) { dcc = (struct DCC *) list->data; if ((dcc->type == TYPE_CHATSEND || dcc->type == TYPE_CHATRECV)) { nnew[0] = _(dccstat[(int) dcc->dccstat].name); nnew[1] = dcc->nick; sprintf (pos, "%d", dcc->pos); sprintf (siz, "%d", dcc->size); nnew[4] = ctime (&dcc->starttime); row = gtk_clist_append (GTK_CLIST (dcccwin.list), nnew); gtk_clist_set_row_data (GTK_CLIST (dcccwin.list), row, (gpointer) dcc); } list = list->next; } if (selrow != -1) gtk_clist_select_row ((GtkCList *) dcccwin.list, selrow, 0); }
void populate_minilist(struct slist_gui *the_gui) { struct fnlist *current; gchar *to_add[1]; if (!the_gui) { NE_DEBUG(DEBUG_GNOME, "WARNING! gui component was null that should not have been.\n"); return; } for (current = the_gui->data; current != NULL; current = current->next) { /* If the path is absolute, we actually want to display it without * modifying the original text. */ if (current->haspath) /* FIXME: This will barf when 'free'd. */ to_add[0] = g_strjoin(NULL, "/", current->pattern, NULL); else to_add[0] = current->pattern; the_gui->chosen_row = gtk_clist_append(GTK_CLIST(the_gui->list), to_add); gtk_clist_set_row_data(GTK_CLIST(the_gui->list), the_gui->chosen_row, (gpointer) current); } }