int main(int argc, char** argv) { GtkWidget *window; GtkWidget *clist; gchar* text1[3] = {"刘备","男","23"}; gchar* text2[3] = {"张飞","男","18"}; gchar* text3[3] = {"关羽","男","16"}; gchar* text4[3] = {"孙二娘","女","25"}; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_widget_set_size_request(window, 150, 100); g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); clist = gtk_clist_new(3); g_signal_connect(GTK_OBJECT(clist), "select_row", G_CALLBACK(select_row_cb), NULL); gtk_clist_set_column_title(GTK_CLIST(clist), 0, "Name"); gtk_clist_set_column_title(GTK_CLIST(clist), 1, "Sex"); gtk_clist_set_column_title(GTK_CLIST(clist), 2, "Age"); gtk_clist_column_titles_show(GTK_CLIST(clist)); gtk_clist_append(GTK_CLIST(clist), text1); gtk_clist_append(GTK_CLIST(clist), text2); gtk_clist_append(GTK_CLIST(clist), text3); gtk_clist_prepend(GTK_CLIST(clist), text4); gtk_container_add(GTK_CONTAINER(window), clist); gtk_widget_show_all(window); gtk_main(); return 0; }
static void addkeywords_to_list(GtkWidget* widget, LPCSTR attrs, TGENSETUP *gensetup_t) { char *curr, *cour; char *data[2]; if (!GTK_IS_CLIST (widget)) return; gtk_clist_clear (GTK_CLIST (widget)); for (curr = (LPSTR) attrs; *curr; curr += (STRLEN (curr) + 1)) { if (!strncasecmp (curr, "DSN=", STRLEN ("DSN=")) || !strncasecmp (curr, "Driver=", STRLEN ("Driver=")) || !strncasecmp (curr, "Description=", STRLEN ("Description="))) continue; if ((cour = strchr (curr, '='))) { *cour = '\0'; data[0] = curr; data[1] = cour + 1; gtk_clist_append (GTK_CLIST (widget), data); *cour = '='; } else { data[0] = ""; gtk_clist_append (GTK_CLIST (widget), data); } } if (GTK_CLIST (widget)->rows > 0) gtk_clist_sort (GTK_CLIST (widget)); }
int gtkFillSkinList( gchar * mdir ) { gchar * str[2]; gchar * tmp; int i; glob_t gg; struct stat fs; gtkOldSkin=strdup( skinName ); prev=gtkOldSkin; str[0]="default"; str[1]=""; if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); glob( mdir,GLOB_NOSORT,NULL,&gg ); for( i=0;i<(int)gg.gl_pathc;i++ ) { if ( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue; stat( gg.gl_pathv[i],&fs ); if ( S_ISDIR( fs.st_mode ) ) { tmp=strrchr( gg.gl_pathv[i],'/' ); tmp++; if ( !strcmp( tmp,"default" ) ) continue; str[0]=tmp; if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); } } globfree( &gg ); return 1; }
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 filer_cb(GtkWidget *widget, gpointer data) { gchar *filenames[2]; #ifdef GLOB_BRACE int i; #ifdef HAVE_GTK_2 const gchar *patt; #else gchar *patt; #endif glob_t pglob; if(GPOINTER_TO_INT(data) == 1) { patt = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); if(glob(patt, GLOB_BRACE|GLOB_NOMAGIC|GLOB_TILDE, NULL, &pglob)) return; for( i = 0; i < pglob.gl_pathc; i++) { filenames[0] = pglob.gl_pathv[i]; filenames[1] = NULL; gtk_clist_append(GTK_CLIST(clist), filenames); } globfree(&pglob); } #else if((int)data == 1) { filenames[0] = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); filenames[1] = NULL; gtk_clist_append(GTK_CLIST(clist), filenames); } #endif gtk_widget_hide(filesel); gtk_clist_columns_autosize(GTK_CLIST(clist)); }
static void rebuildLists() { short i, c; gchar* txt[2]; gUpdateFlag=TRUE; gtk_clist_freeze(GTK_CLIST(gSrcList)); gtk_clist_freeze(GTK_CLIST(gAppList)); gtk_clist_freeze(GTK_CLIST(gDstList)); gtk_clist_clear(GTK_CLIST(gSrcList)); gtk_clist_clear(GTK_CLIST(gAppList)); gtk_clist_clear(GTK_CLIST(gDstList)); c = MidiCountAppls(); for (i=1; i <= c; i++) { txt[0] = g_strdup_printf("%d", MidiGetIndAppl(i)); txt[1] = MidiGetName(MidiGetIndAppl(i)); gtk_clist_append(GTK_CLIST(gSrcList), txt); gtk_clist_append(GTK_CLIST(gAppList), txt); gtk_clist_append(GTK_CLIST(gDstList), txt); } gtk_clist_thaw(GTK_CLIST(gSrcList)); gtk_clist_thaw(GTK_CLIST(gAppList)); gtk_clist_thaw(GTK_CLIST(gDstList)); gUpdateFlag=FALSE; }
mmio_window_t mmio_window_new( const gchar *title ) { mmio_window_t mmio = g_malloc0( sizeof(struct mmio_window_info) ); int i, j; GtkCList *all_list; GtkWidget *vbox1; GtkWidget *hbuttonbox1; GtkWidget *mmr_close; mmio->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (mmio->window), title); gtk_window_set_default_size (GTK_WINDOW (mmio->window), 600, 600); vbox1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (mmio->window), vbox1); mmio->notebook = gtk_notebook_new (); gtk_box_pack_start (GTK_BOX (vbox1), mmio->notebook, TRUE, TRUE, 0); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (mmio->notebook), GTK_POS_LEFT); hbuttonbox1 = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, TRUE, 0); gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30); mmr_close = gtk_button_new_with_mnemonic (_("Close")); gtk_container_add (GTK_CONTAINER (hbuttonbox1), mmr_close); GTK_WIDGET_SET_FLAGS (mmr_close, GTK_CAN_DEFAULT); /* Add the mmio register data */ all_list = mmio_window_add_page( mmio, "All", NULL ); for( i=0; i < num_io_rgns; i++ ) { GtkCList *list = mmio_window_add_page( mmio, io_rgn[i]->id, io_rgn[i] ); for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) { int sz = io_rgn[i]->ports[j].width; char addr[10], data[10], bits[40]; char *arr[] = { addr, io_rgn[i]->ports[j].id, data, bits, io_rgn[i]->ports[j].desc }; sprintf( addr, "%08X", io_rgn[i]->base + io_rgn[i]->ports[j].offset ); printhex( data, sz, *io_rgn[i]->ports[j].val ); printbits( bits, io_rgn[i]->ports[j].width, *io_rgn[i]->ports[j].val ); gtk_clist_append( list, arr ); gtk_clist_append( all_list, arr ); } } g_signal_connect ((gpointer) mmio->window, "delete_event", G_CALLBACK (on_mmio_delete_event), NULL); g_signal_connect ((gpointer) mmr_close, "clicked", G_CALLBACK (on_mmio_close_clicked), mmio); gtk_widget_show_all( mmio->window ); return mmio; }
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 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); }
advertised_service *add_advertised_service( char *addr, char *port, int method, int protocol ){ advertised_service *t; gchar *s_text[4]; extern gchar *s_methods[]; extern gchar *s_protocols[]; extern GList *service; extern GtkWidget *advertised_service_clist; t = g_malloc(sizeof(advertised_service)); t->address = g_strdup(addr); t->port = g_strdup(port); t->back_end_servers = NULL; t->ipvs_servers = NULL; t->method = method; t->protocol = protocol; service = g_list_append(service, t); s_text[0] = t->address; s_text[1] = t->port; s_text[2] = s_methods[t->method]; s_text[3] = s_protocols[t->protocol]; gtk_clist_append(GTK_CLIST(advertised_service_clist), s_text); return t; }
static void update_display( GtkCList *clist, libspectrum_word base ) { size_t i, j; gchar buffer[ 8 + 64 + 20 ]; gchar *text[] = { &buffer[0], &buffer[ 8 ], &buffer[ 8 + 64 ] }; char buffer2[ 8 ]; gtk_clist_freeze( clist ); gtk_clist_clear( clist ); for( i = 0; i < 20; i++ ) { snprintf( text[0], 8, "%04X", base ); text[1][0] = '\0'; for( j = 0; j < 0x10; j++, base++ ) { libspectrum_byte b = readbyte_internal( base ); snprintf( buffer2, 4, "%02X ", b ); strncat( text[1], buffer2, 4 ); text[2][j] = ( b >= 32 && b < 127 ) ? b : '.'; } text[2][ 0x10 ] = '\0'; gtk_clist_append( clist, text ); } gtk_clist_thaw( clist ); }
void ShowPlayList( void ) { if ( PlayList ) gtkActive( PlayList ); else PlayList=create_PlayList(); if ( old_path && *old_path ) { char * currentdir = strdup( old_path ); char * tpath,* pos; GtkCTreeNode * node,* nextnode; gboolean leaf; tpath=strdup( "/" ); pos=strtok( currentdir,"/" ); node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func ); do { char * tpathnew = g_strconcat( tpath,pos,"/",NULL ); free( tpath ); tpath=tpathnew; nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func ); if ( !nextnode ) break; node=nextnode; pos=strtok( NULL,"/" ); gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL ); if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node ); else { DirNodeType * DirNode; gtk_ctree_select( GTK_CTREE( CTDirTree ),node ); DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node ); current_path=DirNode->path; scan_dir( DirNode->path ); if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) ); break; } } while( pos ); free( tpath ); free( currentdir ); } else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent ); gtk_clist_freeze( GTK_CLIST( CLSelected ) ); gtk_clist_clear( GTK_CLIST( CLSelected ) ); if ( plList ) { plItem * next = plList; while ( next || next->next ) { char * text[1][3]; text[0][2]=""; text[0][0]=next->name; text[0][1]=next->path; gtk_clist_append( GTK_CLIST( CLSelected ),text[0] ); NrOfSelected++; if ( next->next ) next=next->next; else break; } CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) ); } gtk_clist_thaw( GTK_CLIST( CLSelected ) ); gtk_widget_show( PlayList ); }
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); }
static void widget_table_input_by_items(variable *var) { GList *element; gchar *text; list_t *sliced; #ifdef DEBUG_TRANSITS fprintf(stderr, "%s(): Entering.\n", __func__); #endif #if !GTK_CHECK_VERSION(3,0,0) /* gtk3: Deprecated in gtk2 and now gone */ g_assert(var->Attributes != NULL && var->Widget != NULL); text = attributeset_get_first(&element, var->Attributes, ATTR_ITEM); while (text != NULL) { sliced = linecutter(g_strdup(text), '|'); gtk_clist_append(GTK_CLIST(var->Widget), sliced->line); if (sliced) list_t_free(sliced); /* Free linecutter memory */ text = attributeset_get_next(&element, var->Attributes, ATTR_ITEM); } #endif #ifdef DEBUG_TRANSITS fprintf(stderr, "%s(): Exiting.\n", __func__); #endif }
static void __verboser(const char *stuff, int opos, int replacelast, int complete) { char *s2[2]; struct timeval tv; int ms; s2[0] = (char *)stuff; s2[1] = NULL; gtk_clist_freeze(GTK_CLIST(verb)); if (replacelast) gtk_clist_remove(GTK_CLIST(verb), GTK_CLIST(verb)->rows - 1); gtk_clist_append(GTK_CLIST(verb), s2); if (!ast_tvzero(last)) { gdk_threads_leave(); gettimeofday(&tv, NULL); if (cleanupid > -1) gtk_timeout_remove(cleanupid); ms = ast_tvdiff_ms(tv, last); if (ms < 100) { /* We just got a message within 100ms, so just schedule an update in the near future */ cleanupid = gtk_timeout_add(200, cleanup, NULL); } else { cleanup(&cleanupid); } last = tv; } else { gettimeofday(&last, NULL); } }
static void RefreshEventList( void ) { int i; char buf[128]; // Clear events list gtk_clist_freeze( GTK_CLIST(g_pEventsList) ); gtk_clist_clear( GTK_CLIST(g_pEventsList) ); if( GetCurrentCam() ) { // Fill events list for( i = 0; i < GetCurrentCam()->GetCam()->numEvents(); i++ ) { char rowbuf[3][128], *row[3]; // FIXME: sort by time? sprintf( rowbuf[0], "%li", GetCurrentCam()->GetCam()->getEvent(i)->getTime() ); row[0] = rowbuf[0]; strncpy( rowbuf[1], GetCurrentCam()->GetCam()->getEvent(i)->typeStr(), sizeof(rowbuf[0]) ); row[1] = rowbuf[1]; strncpy( rowbuf[2], GetCurrentCam()->GetCam()->getEvent(i)->getParam(), sizeof(rowbuf[1]) ); row[2] = rowbuf[2]; gtk_clist_append( GTK_CLIST(g_pEventsList), row ); } // Total duration might have changed sprintf( buf, "%.2f", GetCurrentCam()->GetCam()->getTotalTime() ); gtk_label_set_text( g_pCurrentTime, "0.00" ); gtk_label_set_text( g_pTotalTime, buf ); gtk_adjustment_set_value( g_pTimeLine, 0.f ); g_pTimeLine->upper = ( GetCurrentCam()->GetCam()->getTotalTime() * 1000 ); } gtk_clist_thaw( GTK_CLIST(g_pEventsList) ); }
/** * 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))); }
/* Creates the clist widget used in the "Contents" page of the Properties * dialog for a directory */ GtkWidget * dir_contents_list( GNode *dnode ) { char *col_titles[2]; char *clist_row[2]; GtkWidget *clist_w; Icon *icon; int i; g_assert( NODE_IS_DIR(dnode) ); col_titles[0] = _("Node type"); col_titles[1] = _("Quantity"); /* Don't use gui_clist_add( ) as this one shouldn't be placed * inside a scrolled window */ clist_w = gtk_clist_new_with_titles( 2, col_titles ); gtk_clist_set_selection_mode( GTK_CLIST(clist_w), GTK_SELECTION_SINGLE ); for (i = 0; i < 2; i++) gtk_clist_set_column_auto_resize( GTK_CLIST(clist_w), i, TRUE ); clist_row[0] = NULL; for (i = 1; i < NUM_NODE_TYPES; i++) { clist_row[1] = (char *)i64toa( DIR_NODE_DESC(dnode)->subtree.counts[i] ); gtk_clist_append( GTK_CLIST(clist_w), clist_row ); icon = &node_type_mini_icons[i]; gtk_clist_set_pixtext( GTK_CLIST(clist_w), i - 1, 0, _(node_type_plural_names[i]), 2, icon->pixmap, icon->mask ); } return clist_w; }
/* ***************************************************************************** */ void insertallroutepoints () { gint i, j; gchar *text[5], text0[20], text1[20], text2[20], text3[20]; for (i = 0; i < maxwp; i++) { (wayp + i)->dist = calcdist ((wayp + i)->lon, (wayp + i)->lat); text[1] = (wayp + i)->name; g_snprintf (text0, sizeof (text0), "%d", i + 1); coordinate2gchar(text1, sizeof(text1), (wayp+i)->lat, TRUE, local_config.coordmode); coordinate2gchar(text2, sizeof(text2), (wayp+i)->lon, FALSE, local_config.coordmode); g_snprintf (text3, sizeof (text3), "%9.3f", (wayp + i)->dist); text[0] = text0; text[2] = text1; text[3] = text2; text[4] = text3; j = gtk_clist_append (GTK_CLIST (myroutelist), (gchar **) text); gtk_clist_set_foreground (GTK_CLIST (myroutelist), j, &colors.black); g_strlcpy ((routelist + route.items)->name, (wayp + i)->name, 40); (routelist + route.items)->lat = (wayp + i)->lat; (routelist + route.items)->lon = (wayp + i)->lon; route.items++; } gtk_widget_set_sensitive (select_route_button, TRUE); gtk_widget_set_sensitive (menuitem_saveroute, TRUE); }
gint gw_plugin_settings_quick_search_pane_load ( GtkWidget *pane) { gint result = -1; GtkCList *list_visible = NULL; GtkCList *list_hidden = NULL; GtkCList *list = NULL; GWSettingsExplorerField **fields; gint i; #ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif if ( pane != NULL ) { list_visible = GTK_CLIST ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_QUICK_SEARCH_LIST_VISIBLE)); list_hidden = GTK_CLIST ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_QUICK_SEARCH_LIST_HIDDEN)); if ( (list_visible != NULL) && (list_hidden != NULL) ) { if ( (fields = gw_plugin_settings_search_get_all_fields ( )) != NULL ) { gtk_object_set_data_full ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_QUICK_SEARCH_FIELDS_TABLE, fields, (GtkDestroyNotify) gw_settings_explorer_field_freev); gtk_clist_freeze ( list_visible); gtk_clist_freeze ( list_hidden); for ( i = 0; fields[i] != NULL; i++) { #ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : adding the field %s to the list visible/hidden\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, fields[i]->name); #endif if ( fields[i]->visible == TRUE ) { list = list_visible; } else { list = list_hidden; } gtk_clist_append ( list, &fields[i]->name); } gtk_clist_thaw ( list_visible); gtk_clist_thaw ( list_hidden); } #ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : all fields are loaded.\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif } result = 0; } return result; }
GtkWidget* PLAYLISTUI_CreateWindow(void *pl) { GtkWidget *pui = NULL; TRACE("PLAYLISTUI_CreateWindow"); pui = gtk_clist_new(2); gtk_clist_set_column_width (GTK_CLIST(pui), 0, 150); /* Add the CList widget to the vertical box and show it. */ gtk_container_add(GTK_CONTAINER(pl), pui); { int indx; /* Something silly to add to the list. 4 rows of 2 columns each */ gchar *drink[4][2] = { { "Milk", "3 Oz" }, { "Water", "6 l" }, { "Carrots", "2" }, { "Snakes", "55" } }; /* Here we do the actual adding of the text. It's done once for * each row. */ for ( indx=0 ; indx < 4 ; indx++ ) gtk_clist_append( (GtkCList *) pui, drink[indx]); } gtk_widget_show(pui); return pui; }
/* * Función mostrarConsultaWindow() * * Parámetros de entrada: * char * dir[3]: nombre direccion y telefono a mostrar * * Parámetros de salida: * Ninguno * * Descripción: * Mostrar en la pantalla una única consulta */ void mostrarConsultaWindow(char* dir[3]) { GtkWidget *datos; GtkWidget *window; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_usize (GTK_WIDGET (window), 300, 300); gtk_window_set_policy(GTK_WINDOW (window), TRUE, TRUE, FALSE); gtk_window_set_title (GTK_WINDOW (window), "Libro de direcciones"); gtk_container_border_width (GTK_CONTAINER (window), 10); gtk_widget_set_uposition( window, 300, 300 ); datos=gtk_clist_new(3); gtk_clist_set_column_title(GTK_CLIST(datos),0,"Nombre"); gtk_clist_set_column_title(GTK_CLIST(datos),1,"Direccion"); gtk_clist_set_column_title(GTK_CLIST(datos),2,"Telefono"); gtk_clist_column_titles_show(GTK_CLIST(datos)); gtk_clist_set_column_width(GTK_CLIST(datos),0,100); gtk_clist_set_column_width(GTK_CLIST(datos),1,100); gtk_clist_set_column_width(GTK_CLIST(datos),2,50); gtk_container_add (GTK_CONTAINER (window), datos); gtk_clist_append(GTK_CLIST(datos),dir); gtk_widget_show(datos); gtk_grab_add(window); gtk_widget_show(window); }
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 ); }
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 ); }
/* This replaces the file list widget with another one made specifically * to monitor the progress of an impending scan */ void filelist_scan_monitor_init( void ) { char *col_titles[3]; char *empty_row[3] = { NULL, NULL, NULL }; GtkWidget *parent_w; Icon *icon; int i; col_titles[0] = _("Type"); col_titles[1] = _("Found"); col_titles[2] = _("Bytes"); /* Replace current clist widget with a 3-column one */ parent_w = file_clist_w->parent->parent; gtk_widget_destroy( file_clist_w->parent ); file_clist_w = gui_clist_add( parent_w, 3, col_titles ); /* Place icons and static text */ for (i = 1; i <= NUM_NODE_TYPES; i++) { gtk_clist_append( GTK_CLIST(file_clist_w), empty_row ); if (i < NUM_NODE_TYPES) { icon = &node_type_mini_icons[i]; gtk_clist_set_pixtext( GTK_CLIST(file_clist_w), i - 1, 0, _(node_type_plural_names[i]), 2, icon->pixmap, icon->mask ); } else gtk_clist_set_text( GTK_CLIST(file_clist_w), i - 1, 0, _("TOTAL") ); gtk_clist_set_selectable( GTK_CLIST(file_clist_w), i - 1, FALSE ); } }
void close_and_add_station_editor(gpointer *userdata) { gint new_entry = (gint)userdata; gchar *f[3]; gfloat freq; gchar fstr[32]; f[0] = (gchar *) gtk_entry_get_text(GTK_ENTRY(gui_station_name_input)); freq = gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(gui_freq_input)); sprintf(fstr, "%.2f", freq); f[1] = fstr; f[2] = ""; if (new_entry) { gtk_clist_append(GTK_CLIST(gui_station_list), f); gui_station_count++; } else { assert(gui_station_selected != -1); gtk_clist_set_text(GTK_CLIST(gui_station_list), gui_station_selected, 0, f[0]); gtk_clist_set_text(GTK_CLIST(gui_station_list), gui_station_selected, 1, f[1]); } close_station_editor(); }
static void megacostat_draw(void *pms) { megacostat_t *ms=(megacostat_t *)pms; int i; char *str[7]; for(i=0; i<7; i++) { str[i]=g_malloc(sizeof(char[256])); } /* clear list before printing */ gtk_clist_clear(ms->table); for(i=0; i<NUM_TIMESTATS; i++) { /* nothing seen, nothing to do */ if(ms->rtd[i].num==0) { continue; } g_snprintf(str[0], sizeof(char[256]), "%s", val_to_str(i,megaco_message_type,"Other")); g_snprintf(str[1], sizeof(char[256]), "%d", ms->rtd[i].num); g_snprintf(str[2], sizeof(char[256]), "%8.2f msec", nstime_to_msec(&(ms->rtd[i].min))); g_snprintf(str[3], sizeof(char[256]), "%8.2f msec", nstime_to_msec(&(ms->rtd[i].max))); g_snprintf(str[4], sizeof(char[256]), "%8.2f msec", get_average(&(ms->rtd[i].tot), ms->rtd[i].num)); g_snprintf(str[5], sizeof(char[256]), "%6u", ms->rtd[i].min_num); g_snprintf(str[6], sizeof(char[256]), "%6u", ms->rtd[i].max_num); gtk_clist_append(ms->table, str); } gtk_widget_show(GTK_WIDGET(ms->table)); for(i=0; i<7; i++) { g_free(str[i]); } }
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); }
/* * Función listarNotasWidget() */ void listarNotasWidget (void) { int i, num; gchar *linea[2]; char posicion[32]; /* * Lista vacía */ num=numeroNotas(&(datosAgenda.notas)); if (0 == num) { gtk_clist_clear( (GtkCList *) datosAgenda.gtk_notas); return; } /* * Imprimir lista */ gtk_clist_clear( (GtkCList *) datosAgenda.gtk_notas); for (i=1; i<=num; i++) { sprintf(posicion,"%d",i); linea[0]=posicion; linea[1]=consultarNotas(&(datosAgenda.notas),i); gtk_clist_append( (GtkCList *) datosAgenda.gtk_notas, linea); } }
static void scan_dir( char * path ) { DIR * dir = NULL; char * curr; struct dirent * dirent; struct stat statbuf; gchar * name; char * text[1][2]; text[0][1]=""; gtk_clist_clear( GTK_CLIST( CLFiles ) ); if ( (dir=opendir( path )) ) { NrOfEntrys=0; while( (dirent=readdir( dir )) ) { curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name ); if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) ) { name=g_filename_to_utf8( dirent->d_name, -1, NULL, NULL, NULL ); text[0][0]=name ? name : dirent->d_name; gtk_clist_append( GTK_CLIST( CLFiles ), text[0] ); g_free( name ); NrOfEntrys++; } free( curr ); } closedir( dir ); gtk_clist_sort( GTK_CLIST( CLFiles ) ); } }