static GtkCMCTreeNode *grouplist_create_branch(NewsGroupInfo *ginfo, const gchar *pattern) { GtkCMCTreeNode *node; GtkCMCTreeNode *parent; gchar *name = (gchar *)ginfo->name; gchar *parent_name; gchar *count_str; gchar *cols[3]; gint count; count = ginfo->last - ginfo->first; if (count < 0) count = 0; count_str = itos(count); cols[0] = ginfo->name; cols[1] = count_str; if (ginfo->type == 'y') cols[2] = ""; else if (ginfo->type == 'm') cols[2] = _("moderated"); else if (ginfo->type == 'n') cols[2] = _("readonly"); else cols[2] = _("unknown"); parent_name = grouplist_get_parent_name(name); parent = grouplist_create_parent(parent_name, pattern); node = grouplist_hash_get_branch_node(name); if (node) { gtk_cmctree_set_node_info(GTK_CMCTREE(ctree), node, cols[0], 0, NULL, NULL, FALSE, FALSE); gtk_cmctree_node_set_text(GTK_CMCTREE(ctree), node, 1, cols[1]); gtk_cmctree_node_set_text(GTK_CMCTREE(ctree), node, 2, cols[2]); } else { node = parent ? GTK_CMCTREE_ROW(parent)->children : GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node = gtk_sctree_insert_node(GTK_CMCTREE(ctree), parent, node, cols, 0, NULL, NULL, TRUE, FALSE); if (parent && g_pattern_match_simple(pattern, parent_name) == FALSE) gtk_cmctree_expand(GTK_CMCTREE(ctree), parent); } gtk_cmctree_node_set_selectable(GTK_CMCTREE(ctree), node, TRUE); if (node) gtk_cmctree_node_set_row_data(GTK_CMCTREE(ctree), node, ginfo); g_free(parent_name); return node; }
/* clist/ctree clear old selection on click (gtk2 only) * - intercept all button clicks (always return TRUE) * - only allow left button single click * - handle click on expander * - update "subscribed" list and un-/select row */ static gboolean button_press_cb(GtkCMCTree *ctree, GdkEventButton *button, gpointer data) { gint row, col; GtkCMCTreeNode *node; NewsGroupInfo *ginfo; GSList *list; if (button->type != GDK_BUTTON_PRESS) return TRUE; if (button->button != 1) return TRUE; if (button->window != GTK_CMCLIST(ctree)->clist_window) return TRUE; if (!gtk_cmclist_get_selection_info(GTK_CMCLIST(ctree), button->x, button->y, &row, &col)) return TRUE; node = gtk_cmctree_node_nth(ctree, row); if (!node) return TRUE; if (gtk_cmctree_is_hot_spot(ctree, button->x, button->y)) { gtk_cmctree_toggle_expansion(ctree, node); return TRUE; } ginfo = gtk_cmctree_node_get_row_data(ctree, node); if (!ginfo) return TRUE; list = g_slist_find_custom(subscribed, ginfo->name, (GCompareFunc)g_ascii_strcasecmp); if (list) { g_free(list->data); subscribed = g_slist_remove(subscribed, list->data); gtk_cmclist_unselect_row(GTK_CMCLIST(ctree), row, 0); } else { subscribed = g_slist_append(subscribed, g_strdup(ginfo->name)); gtk_cmclist_select_row(GTK_CMCLIST(ctree), row, 0); } return TRUE; }
static void edit_person_attrib_modify(gpointer data) { gboolean errFlg = FALSE; GtkCMCList *clist = GTK_CMCLIST(personEditDlg->clist_attrib); gint row = personEditDlg->rowIndAttrib; UserAttribute *attrib = gtk_cmclist_get_row_data(clist, row); if (attrib) { edit_person_attrib_edit(&errFlg, attrib); if (!errFlg) { gtk_cmclist_set_text(clist, row, ATTRIB_COL_NAME, attrib->name); gtk_cmclist_set_text(clist, row, ATTRIB_COL_VALUE, attrib->value); edit_person_attrib_clear(NULL); } } }
static gboolean list_find_attribute(const gchar *attr) { GtkCMCList *clist = GTK_CMCLIST(personEditDlg->clist_attrib); UserAttribute *attrib; gint row = 0; while((attrib = gtk_cmclist_get_row_data(clist, row))) { if (!g_ascii_strcasecmp(attrib->name, attr)) { gtk_cmclist_select_row(clist, row, 0); return TRUE; } row++; } return FALSE; }
static void edit_person_attrib_add(gpointer data) { GtkCMCList *clist = GTK_CMCLIST(personEditDlg->clist_attrib); gboolean errFlg = FALSE; UserAttribute *attrib = NULL; gint row = personEditDlg->rowIndAttrib; if (gtk_cmclist_get_row_data(clist, row) == NULL) row = 0; attrib = edit_person_attrib_edit(&errFlg, NULL); if (!errFlg) { gchar *text[EMAIL_N_COLS]; text[ATTRIB_COL_NAME] = attrib->name; text[ATTRIB_COL_VALUE] = attrib->value; row = gtk_cmclist_insert(clist, 1 + row, text); gtk_cmclist_set_row_data(clist, row, attrib); gtk_cmclist_select_row(clist, row, 0); edit_person_attrib_clear(NULL); } }
static void edit_person_combo_box_changed(GtkComboBox *opt_menu, gpointer data) { GtkCMCList *clist = GTK_CMCLIST(data); gint row = personEditDlg->rowIndAttrib; UserAttribute *attrib = gtk_cmclist_get_row_data(clist, row); gint option = gtk_combo_box_get_active(opt_menu); const gchar *str = attrib ? attrib->name:""; cm_return_if_fail (option < ATTRIBUTE_SIZE); /* A corresponding attribute in contact does not match selected option */ if (strcmp(ATTRIBUTE[option], str) != 0) { gtk_widget_set_sensitive(personEditDlg->attrib_add, TRUE); gtk_widget_set_sensitive(personEditDlg->attrib_mod, TRUE); gtk_widget_set_sensitive(personEditDlg->attrib_del, FALSE); gtk_entry_set_text(GTK_ENTRY(personEditDlg->entry_atvalue), ""); gtk_widget_grab_focus(personEditDlg->entry_atvalue); edit_person_status_show(NULL); } }
/** * Callback function to update LDIF field data from input fields. * \param widget Widget (button). * \param data User data. */ static void imp_ldif_modify_pressed( GtkWidget *widget, gpointer data ) { GtkCMCList *clist = GTK_CMCLIST(impldif_dlg.clist_field); Ldif_FieldRec *rec; gint row; if( impldif_dlg.rowIndSelect < 0 ) return; row = impldif_dlg.rowIndSelect; rec = gtk_cmclist_get_row_data( clist, impldif_dlg.rowIndSelect ); ldif_field_set_name( rec, gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.entryAttrib), 0, -1 ) ); ldif_field_set_selected( rec, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( impldif_dlg.checkSelect) ) ); imp_ldif_update_row( clist ); gtk_cmclist_select_row( clist, row, 0 ); gtk_label_set_text( GTK_LABEL(impldif_dlg.entryField), "" ); gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryAttrib), "" ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( impldif_dlg.checkSelect), FALSE ); }
static void edit_person_attrib_delete(gpointer data) { GtkCMCList *clist = GTK_CMCLIST(personEditDlg->clist_attrib); gint row = personEditDlg->rowIndAttrib; UserAttribute *attrib = gtk_cmclist_get_row_data(clist, row); edit_person_attrib_clear(NULL); if (attrib) { /* Remove list entry */ gtk_cmclist_remove(clist, row); addritem_free_attribute(attrib); attrib = NULL; } /* Position hilite bar */ attrib = gtk_cmclist_get_row_data(clist, row); if (!attrib) { personEditDlg->rowIndAttrib = -1 + row; } if (!personEditDlg->read_only) gtk_widget_set_sensitive(personEditDlg->attrib_del, gtk_cmclist_get_row_data(clist, 0) != NULL); edit_person_status_show(NULL); }
/** * Load list with LDIF fields read from file. * \param ldf LDIF control data. */ static void imp_ldif_load_fields( LdifFile *ldf ) { GtkCMCList *clist = GTK_CMCLIST(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_cmclist_clear( clist ); list = ldif_get_fieldlist( ldf ); node = list; while( node ) { Ldif_FieldRec *rec = node->data; gint row; text[ FIELD_COL_RESERVED ] = ""; text[ FIELD_COL_SELECT ] = ""; text[ FIELD_COL_FIELD ] = rec->tagName; text[ FIELD_COL_ATTRIB ] = rec->userName; row = gtk_cmclist_append( clist, text ); gtk_cmclist_set_row_data( clist, row, rec ); if( rec->selected ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_SELECT, markxpm ); } if( rec->reserved ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_RESERVED, markxpm ); } impldif_dlg.rowCount++; node = g_list_next( node ); } g_list_free( list ); list = NULL; ldif_set_accessed( ldf, FALSE ); }
static void edit_person_entry_att_changed (GtkWidget *entry, gpointer data) { gboolean non_empty = gtk_cmclist_get_row_data(GTK_CMCLIST(personEditDlg->clist_attrib), 0) != NULL; const gchar *sName; int index; if (personEditDlg->read_only) return; index = gtk_combo_box_get_active(GTK_COMBO_BOX(personEditDlg->entry_atname)); sName = ATTRIBUTE[index]; if (list_find_attribute(sName)) { gtk_widget_set_sensitive(personEditDlg->attrib_add,FALSE); gtk_widget_set_sensitive(personEditDlg->attrib_mod,non_empty); attrib_adding = FALSE; attrib_saving = non_empty; } else { gtk_widget_set_sensitive(personEditDlg->attrib_add,TRUE); gtk_widget_set_sensitive(personEditDlg->attrib_mod,non_empty); attrib_adding = TRUE; attrib_saving = non_empty; } }
static void edit_ldap_bdn_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *table; GtkWidget *label; GtkWidget *host_label; GtkWidget *port_label; GtkWidget *basedn_list; GtkWidget *vlbox; GtkWidget *lwindow; GtkWidget *basedn_entry; GtkWidget *hbbox; GtkWidget *hsep; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *hsbox; GtkWidget *statusbar; gint top; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "editldap_basedn"); gtk_widget_set_size_request(window, 300, 270); gtk_container_set_border_width(GTK_CONTAINER(window), 0); gtk_window_set_title(GTK_WINDOW(window), _("Edit LDAP - Select Search Base")); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(edit_ldap_bdn_delete_event), NULL ); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(edit_ldap_bdn_key_pressed), NULL ); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_container_set_border_width( GTK_CONTAINER(vbox), 0 ); table = gtk_table_new(3, 2, FALSE); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); gtk_container_set_border_width( GTK_CONTAINER(table), 8 ); gtk_table_set_row_spacings(GTK_TABLE(table), 8); gtk_table_set_col_spacings(GTK_TABLE(table), 8); /* First row */ top = 0; label = gtk_label_new(_("Hostname")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); host_label = gtk_label_new(""); gtk_table_attach(GTK_TABLE(table), host_label, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(host_label), 0, 0.5); /* Second row */ top = 1; label = gtk_label_new(_("Port")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); port_label = gtk_label_new(""); gtk_table_attach(GTK_TABLE(table), port_label, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(port_label), 0, 0.5); /* Third row */ top = 2; label = gtk_label_new(_("Search Base")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); basedn_entry = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), basedn_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Basedn list */ vlbox = gtk_vbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(vbox), vlbox, TRUE, TRUE, 0); gtk_container_set_border_width( GTK_CONTAINER(vlbox), 8 ); lwindow = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(lwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(vlbox), lwindow, TRUE, TRUE, 0); basedn_list = gtk_cmclist_new(1); gtk_container_add(GTK_CONTAINER(lwindow), basedn_list); gtk_cmclist_column_titles_show( GTK_CMCLIST(basedn_list) ); gtk_cmclist_set_column_title( GTK_CMCLIST(basedn_list), 0, _( "Available Search Base(s)" ) ); gtk_cmclist_set_selection_mode(GTK_CMCLIST(basedn_list), GTK_SELECTION_BROWSE); /* Status line */ hsbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH); statusbar = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); /* Button panel */ gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); gtk_widget_grab_default(ok_btn); hsep = gtk_hseparator_new(); gtk_box_pack_end(GTK_BOX(vbox), hsep, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(edit_ldap_bdn_ok), NULL); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(edit_ldap_bdn_cancel), NULL); g_signal_connect(G_OBJECT(basedn_list), "select_row", G_CALLBACK(edit_ldap_bdn_list_select), NULL); g_signal_connect(G_OBJECT(basedn_list), "button_press_event", G_CALLBACK(edit_ldap_bdn_list_button), NULL); gtk_widget_show_all(vbox); ldapedit_basedn.window = window; ldapedit_basedn.host_label = host_label; ldapedit_basedn.port_label = port_label; ldapedit_basedn.basedn_entry = basedn_entry; ldapedit_basedn.basedn_list = basedn_list; ldapedit_basedn.ok_btn = ok_btn; ldapedit_basedn.cancel_btn = cancel_btn; ldapedit_basedn.statusbar = statusbar; ldapedit_basedn.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit LDAP Select Base DN" ); }
static void addressbook_foldersel_create( void ) { GtkWidget *window; GtkWidget *vbox; GtkWidget *tree_folder; GtkWidget *vlbox; GtkWidget *tree_win; GtkWidget *hbbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; static GdkGeometry geometry; gchar *titles[1]; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "addressbook_foldersel" ); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title( GTK_WINDOW(window), _("Select Address Book Folder") ); gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_MOUSE ); g_signal_connect( G_OBJECT(window), "delete_event", G_CALLBACK(addressbook_foldersel_delete_event), NULL ); g_signal_connect( G_OBJECT(window), "key_press_event", G_CALLBACK(addressbook_foldersel_key_pressed), NULL ); g_signal_connect(G_OBJECT(window), "size_allocate", G_CALLBACK(addressbook_foldersel_size_allocate_cb), NULL); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_container_set_border_width( GTK_CONTAINER(vbox), 8 ); /* Address book/folder tree */ vlbox = gtk_vbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(vbox), vlbox, TRUE, TRUE, 0); gtk_container_set_border_width( GTK_CONTAINER(vlbox), 8 ); tree_win = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(tree_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_box_pack_start( GTK_BOX(vlbox), tree_win, TRUE, TRUE, 0 ); titles[0] = _( "Address Book") ; tree_folder = gtk_sctree_new_with_titles( 1, 0, titles ); gtk_container_add( GTK_CONTAINER(tree_win), tree_folder ); gtk_cmclist_column_titles_show( GTK_CMCLIST(tree_folder) ); gtk_cmctree_set_line_style(GTK_CMCTREE(tree_folder), GTK_CMCTREE_LINES_NONE); gtk_cmctree_set_expander_style(GTK_CMCTREE(tree_folder), GTK_CMCTREE_EXPANDER_TRIANGLE); gtk_sctree_set_stripes(GTK_SCTREE(tree_folder), prefs_common.use_stripes_everywhere); gtk_cmclist_set_selection_mode( GTK_CMCLIST(tree_folder), GTK_SELECTION_BROWSE ); gtk_cmctree_set_indent( GTK_CMCTREE(tree_folder), CTREE_INDENT ); gtk_cmclist_set_auto_sort( GTK_CMCLIST(tree_folder), TRUE ); /* Button panel */ gtkut_stock_button_set_create( &hbbox, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL ); gtk_box_pack_end( GTK_BOX(vbox), hbbox, FALSE, FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); gtk_widget_grab_default( ok_btn ); g_signal_connect( G_OBJECT(ok_btn), "clicked", G_CALLBACK(addressbook_foldersel_ok), NULL ); g_signal_connect( G_OBJECT(cancel_btn), "clicked", G_CALLBACK(addressbook_foldersel_cancel), NULL ); g_signal_connect( G_OBJECT(tree_folder), "tree_select_row", G_CALLBACK(addressbook_foldersel_folder_select), NULL ); g_signal_connect( G_OBJECT(tree_folder), "button_press_event", G_CALLBACK(addressbook_foldersel_tree_button), NULL ); if ( !geometry.min_height ) { geometry.min_width = 300; geometry.min_height = 350; } gtk_window_set_geometry_hints( GTK_WINDOW(window), NULL, &geometry, GDK_HINT_MIN_SIZE ); gtk_widget_set_size_request( window, prefs_common.addressbook_folderselwin_width, prefs_common.addressbook_folderselwin_height ); gtk_widget_show_all( vbox ); addressbook_foldersel_dlg.window = window; addressbook_foldersel_dlg.tree_folder = tree_folder; addressbook_foldersel_dlg.ok_btn = ok_btn; addressbook_foldersel_dlg.cancel_btn = cancel_btn; gtk_widget_show_all( window ); stock_pixbuf_gdk(STOCK_PIXMAP_BOOK, &bookXpm); stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN, &folderXpm); }
/** * Format notebook fields page. * \param pageNum Page (tab) number. * \param pageLbl Page (tab) label. */ static void imp_ldif_page_fields( gint pageNum, gchar *pageLbl ) { GtkWidget *vbox; GtkWidget *vboxt; GtkWidget *vboxb; GtkWidget *table; GtkWidget *label; GtkWidget *clist_swin; GtkWidget *clist_field; GtkWidget *entryField; GtkWidget *entryAttrib; GtkWidget *checkSelect; GtkWidget *btnModify; GtkWidget *eventBox; gint top; gchar *titles[ FIELDS_N_COLS ]; gint i; titles[ FIELD_COL_RESERVED ] = _("R"); titles[ FIELD_COL_SELECT ] = _("S"); titles[ FIELD_COL_FIELD ] = _("LDIF Field Name"); titles[ FIELD_COL_ATTRIB ] = _("Attribute Name"); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add( GTK_CONTAINER( impldif_dlg.notebook ), vbox ); gtk_container_set_border_width( GTK_CONTAINER (vbox), 4 ); label = gtk_label_new( pageLbl ); gtk_widget_show( label ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( impldif_dlg.notebook ), gtk_notebook_get_nth_page(GTK_NOTEBOOK( impldif_dlg.notebook ), pageNum ), label ); /* Upper area - Field list */ vboxt = gtk_vbox_new( FALSE, 4 ); gtk_container_add( GTK_CONTAINER( vbox ), vboxt ); clist_swin = gtk_scrolled_window_new( NULL, NULL ); gtk_container_add( GTK_CONTAINER(vboxt), clist_swin ); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); clist_field = gtk_cmclist_new_with_titles( FIELDS_N_COLS, titles ); gtk_container_add( GTK_CONTAINER(clist_swin), clist_field ); gtk_cmclist_set_selection_mode( GTK_CMCLIST(clist_field), GTK_SELECTION_BROWSE ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field), FIELD_COL_RESERVED, FIELDS_COL_WIDTH_RESERVED ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field), FIELD_COL_SELECT, FIELDS_COL_WIDTH_SELECT ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field), FIELD_COL_FIELD, FIELDS_COL_WIDTH_FIELD ); gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field), FIELD_COL_ATTRIB, FIELDS_COL_WIDTH_ATTRIB ); /* Remove focus capability for column headers */ for( i = 0; i < FIELDS_N_COLS; i++ ) { gtkut_widget_set_can_focus( GTK_CMCLIST(clist_field)->column[i].button, FALSE); } /* Lower area - Edit area */ vboxb = gtk_vbox_new( FALSE, 4 ); gtk_box_pack_end(GTK_BOX(vbox), vboxb, FALSE, FALSE, 2); /* Data entry area */ table = gtk_table_new( 3, 3, FALSE); gtk_box_pack_start(GTK_BOX(vboxb), table, FALSE, FALSE, 0); gtk_table_set_row_spacings(GTK_TABLE(table), 4); gtk_table_set_col_spacings(GTK_TABLE(table), 4); /* First row */ top = 0; label = gtk_label_new(_("LDIF Field")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entryField = gtk_label_new( "" ); gtk_misc_set_alignment(GTK_MISC(entryField), 0.01, 0.5); gtk_table_attach(GTK_TABLE(table), entryField, 1, 3, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Second row */ ++top; label = gtk_label_new(_("Attribute")); /* * Use an event box to attach some help in the form of a tooltip. * Tried this for the clist but it looked bad. */ eventBox = gtk_event_box_new(); gtk_container_add( GTK_CONTAINER(eventBox), label ); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), eventBox, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); CLAWS_SET_TIP(eventBox, _( "Choose the LDIF field that will be renamed or selected " \ "for import in the list above. Reserved fields (marked " \ "with a tick in the \"R\" column), are automatically " \ "imported and cannot be renamed. A single click in the " \ "Select (\"S\") column will select the field for import " \ "with a tick. A single click anywhere in the row will " \ "select that field for rename in the input area below " \ "the list. A double click anywhere in the row will also " \ "select the field for import.")); entryAttrib = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entryAttrib, 1, 3, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); CLAWS_SET_TIP(entryAttrib, _( "The LDIF field can be renamed to the User Attribute name." )); /* Next row */ ++top; checkSelect = gtk_check_button_new_with_label( _( "Select for Import" ) ); gtk_table_attach(GTK_TABLE(table), checkSelect, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); CLAWS_SET_TIP(checkSelect, _( "Select the LDIF field for import into the address book." )); btnModify = gtk_button_new_with_label( _(" Modify ")); gtk_table_attach(GTK_TABLE(table), btnModify, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0); CLAWS_SET_TIP(btnModify, _( "This button will update the list above with the data supplied." )); gtk_widget_show_all(vbox); /* Event handlers */ g_signal_connect( G_OBJECT(clist_field), "select_row", G_CALLBACK(imp_ldif_field_list_selected), NULL ); g_signal_connect( G_OBJECT(clist_field), "button_press_event", G_CALLBACK(imp_ldif_field_list_toggle), NULL ); g_signal_connect( G_OBJECT(btnModify), "clicked", G_CALLBACK(imp_ldif_modify_pressed), NULL ); impldif_dlg.clist_field = clist_field; impldif_dlg.entryField = entryField; impldif_dlg.entryAttrib = entryAttrib; impldif_dlg.checkSelect = checkSelect; impldif_dlg.btnModify = btnModify; }
static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh) { static GdkCursor *watch_cursor = NULL; GSList *cur; GtkCMCTreeNode *node; GPatternSpec *pspec; GdkWindow *window; if (locked) return; locked = TRUE; if (!pattern || *pattern == '\0') pattern = "*"; if (!watch_cursor) watch_cursor = gdk_cursor_new(GDK_WATCH); window = gtk_widget_get_window(dialog); gdk_window_set_cursor(window, watch_cursor); main_window_cursor_wait(mainwindow_get_mainwindow()); GTK_EVENTS_FLUSH(); if (refresh) { ack = TRUE; grouplist_clear(); recv_set_ui_func(grouplist_recv_func, NULL); group_list = news_get_group_list(news_folder); group_list = g_slist_reverse(group_list); recv_set_ui_func(NULL, NULL); if (group_list == NULL && ack == TRUE) { alertpanel_error(_("Can't retrieve newsgroup list.")); locked = FALSE; gdk_window_set_cursor(window, NULL); main_window_cursor_normal(mainwindow_get_mainwindow()); return; } } else gtk_cmclist_clear(GTK_CMCLIST(ctree)); gtk_entry_set_text(GTK_ENTRY(entry), pattern); grouplist_hash_init(); gtk_cmclist_freeze(GTK_CMCLIST(ctree)); pspec = g_pattern_spec_new(pattern); for (cur = group_list; cur != NULL ; cur = cur->next) { NewsGroupInfo *ginfo = (NewsGroupInfo *)cur->data; if (g_pattern_match_string(pspec, ginfo->name)) { node = grouplist_create_branch(ginfo, pattern); if (g_slist_find_custom(subscribed, ginfo->name, (GCompareFunc)g_ascii_strcasecmp) != NULL) gtk_cmctree_select(GTK_CMCTREE(ctree), node); } } for (cur = subscribed; cur; cur = g_slist_next(cur)) grouplist_expand_upwards(GTK_CMCTREE(ctree), (gchar *)cur->data); g_pattern_spec_free(pspec); gtk_cmclist_thaw(GTK_CMCLIST(ctree)); grouplist_hash_done(); gtk_label_set_text(GTK_LABEL(status_label), _("Done.")); gdk_window_set_cursor(window, NULL); main_window_cursor_normal(mainwindow_get_mainwindow()); locked = FALSE; }
static void addressbook_foldersel_load_data( AddressIndex *addrIndex, FolderPathMatch* match ) { AddressDataSource *ds; GList *list, *nodeDS; gchar **name; gchar *dsName; ItemFolder *rootFolder; AddressBookFile *abf; FolderInfo *fi; GtkCMCTree *tree = GTK_CMCTREE( addressbook_foldersel_dlg.tree_folder ); GtkCMCTreeNode *node; FolderPathMatch *nextmatch; gtk_cmclist_clear( GTK_CMCLIST( tree ) ); list = addrindex_get_interface_list( addrIndex ); while ( list ) { AddressInterface *interface = list->data; if ( interface->type == ADDR_IF_BOOK ) { nodeDS = interface->listSource; while ( nodeDS ) { ds = nodeDS->data; dsName = g_strdup( addrindex_ds_get_name( ds ) ); /* Read address book */ if( ! addrindex_ds_get_read_flag( ds ) ) { addrindex_ds_read_data( ds ); } /* Add node for address book */ abf = ds->rawDataSource; name = &dsName; node = gtk_cmctree_insert_node( tree, NULL, NULL, name, FOLDER_SPACING, bookXpm, bookXpm, FALSE, TRUE ); g_free( dsName ); /* try to match subfolders if this book is the right book (and if there's smth to match, and not yet matched) */ nextmatch = NULL; if ( match->folder_path != NULL && match->matched == FALSE && match->folder_path[0] != NULL && strcmp(match->folder_path[0], abf->fileName) == 0 ) { debug_print("matched book name '%s'\n", abf->fileName); match->index = 1; if ( match->folder_path[match->index] == NULL ) { /* we've matched all elements */ match->matched = TRUE; match->node = node; debug_print("book path matched!\n"); } else { /* keep on matching */ nextmatch = match; } } fi = addressbook_foldersel_create_folderinfo( abf, NULL ); gtk_cmctree_node_set_row_data_full( tree, node, fi, ( GDestroyNotify ) addressbook_foldersel_free_folderinfo ); rootFolder = addrindex_ds_get_root_folder( ds ); addressbook_foldersel_load_folder( node, rootFolder, fi, nextmatch ); nodeDS = g_list_next( nodeDS ); } } list = g_list_next( list ); } }
void addressbook_edit_person_page_attrib_ldap(PersonEditDlg *dialog, gint pageNum, gchar *pageLbl) { GtkWidget *combo_box; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *vboxl; GtkWidget *vboxb; GtkWidget *vbuttonbox; GtkWidget *buttonDel; GtkWidget *buttonMod; GtkWidget *buttonAdd; GtkWidget *table; GtkWidget *label; GtkWidget *clist_swin; GtkWidget *clist; GtkWidget *entry_value; gint top; personEditDlg = dialog; gchar *titles[ATTRIB_N_COLS]; gint i; titles[ATTRIB_COL_NAME] = N_("Name"); titles[ATTRIB_COL_VALUE] = N_("Value"); vbox = gtk_vbox_new(FALSE, 8); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(personEditDlg->notebook), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH); label = gtk_label_new_with_mnemonic(pageLbl); gtk_widget_show(label); gtk_notebook_set_tab_label( GTK_NOTEBOOK(personEditDlg->notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(personEditDlg->notebook), pageNum), label); /* Split into two areas */ hbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(vbox), hbox); /* Attribute list */ vboxl = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(hbox), vboxl); gtk_container_set_border_width(GTK_CONTAINER(vboxl), 4); clist_swin = gtk_scrolled_window_new(NULL, NULL); gtk_container_add(GTK_CONTAINER(vboxl), clist_swin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); clist = gtk_cmclist_new_with_titles(ATTRIB_N_COLS, titles); gtk_container_add(GTK_CONTAINER(clist_swin), clist); gtk_cmclist_set_selection_mode(GTK_CMCLIST(clist), GTK_SELECTION_BROWSE); gtk_cmclist_set_column_width(GTK_CMCLIST(clist), ATTRIB_COL_NAME, ATTRIB_COL_WIDTH_NAME); gtk_cmclist_set_column_width(GTK_CMCLIST(clist), ATTRIB_COL_VALUE, ATTRIB_COL_WIDTH_VALUE); gtk_cmclist_set_compare_func(GTK_CMCLIST(clist), edit_person_attrib_compare_func); gtk_cmclist_set_auto_sort(GTK_CMCLIST(clist), TRUE); for (i = 0; i < ATTRIB_N_COLS; i++) gtkut_widget_set_can_focus(GTK_CMCLIST(clist)->column[i].button, FALSE); /* Data entry area */ table = gtk_table_new(4, 2, FALSE); gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(table), 4); gtk_table_set_row_spacings(GTK_TABLE(table), 4); gtk_table_set_col_spacings(GTK_TABLE(table), 4); /* First row */ top = 0; label = gtk_label_new(N_("Name")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gchar **attribute = (gchar **) ATTRIBUTE; combo_box = gtk_combo_box_new_text(); while (*attribute) { if (!strcmp(*attribute, "jpegPhoto")) { attribute++; continue; } gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), *attribute++); } gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0); gtk_table_attach(GTK_TABLE(table), combo_box, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Next row */ ++top; label = gtk_label_new(N_("Value")); gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entry_value = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_value, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Button box */ vboxb = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(hbox), vboxb, FALSE, FALSE, 2); vbuttonbox = gtk_vbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START); gtk_box_set_spacing(GTK_BOX(vbuttonbox), 8); gtk_container_set_border_width(GTK_CONTAINER(vbuttonbox), 4); gtk_container_add(GTK_CONTAINER(vboxb), vbuttonbox); /* Buttons */ buttonDel = gtk_button_new_from_stock(GTK_STOCK_DELETE); gtk_container_add(GTK_CONTAINER(vbuttonbox), buttonDel); buttonMod = gtk_button_new_from_stock(GTK_STOCK_SAVE); gtk_container_add(GTK_CONTAINER(vbuttonbox), buttonMod); buttonAdd = gtk_button_new_from_stock(GTK_STOCK_ADD); gtk_container_add(GTK_CONTAINER(vbuttonbox), buttonAdd); gtk_widget_set_sensitive(buttonDel,FALSE); gtk_widget_set_sensitive(buttonMod,FALSE); gtk_widget_set_sensitive(buttonAdd,FALSE); gtk_widget_show_all(vbox); /* Event handlers */ g_signal_connect(G_OBJECT(clist), "select_row", G_CALLBACK( edit_person_attrib_list_selected), NULL); g_signal_connect(G_OBJECT(buttonDel), "clicked", G_CALLBACK(edit_person_attrib_delete), NULL); g_signal_connect(G_OBJECT(buttonMod), "clicked", G_CALLBACK(edit_person_attrib_modify), NULL); g_signal_connect(G_OBJECT(buttonAdd), "clicked", G_CALLBACK(edit_person_attrib_add), NULL); g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(edit_person_entry_att_changed), NULL); g_signal_connect(G_OBJECT(entry_value), "key_press_event", G_CALLBACK(edit_person_entry_att_pressed), NULL); g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(edit_person_combo_box_changed), clist); personEditDlg->clist_attrib = clist; personEditDlg->entry_atname = combo_box; personEditDlg->entry_atvalue = entry_value; personEditDlg->attrib_add = buttonAdd; personEditDlg->attrib_del = buttonDel; personEditDlg->attrib_mod = buttonMod; }
gboolean addressbook_foldersel_selection( AddressIndex *addrIndex, AddressBookFile **book, ItemFolder **folder, const gchar* path) { FolderPathMatch folder_path_match = { NULL, FALSE, 0, NULL }; gboolean retVal = FALSE; addressbook_foldersel_cancelled = FALSE; if ( ! addressbook_foldersel_dlg.window ) addressbook_foldersel_create(); gtk_widget_grab_focus(addressbook_foldersel_dlg.ok_btn); gtk_widget_show(addressbook_foldersel_dlg.window); manage_window_set_transient(GTK_WINDOW(addressbook_foldersel_dlg.window)); gtk_window_set_modal(GTK_WINDOW(addressbook_foldersel_dlg.window), TRUE); addressbook_foldersel_dlg.fiSelected = NULL; /* split the folder path we've received, we'll try to match this path, subpath by subpath against the book/folder structure in order to select the folder that corresponds to what we received */ if ( path != NULL ) { if ( g_utf8_collate(path, _("Any")) == 0 || strcasecmp(path, "Any") ==0 || *path == '\0' ) /* consider "Any" (both translated or untranslated forms) and "" as valid addressbook roots */ folder_path_match.matched = TRUE; else folder_path_match.folder_path = g_strsplit( path, "/", 256 ); } addressbook_foldersel_load_data( addrIndex, &folder_path_match ); if ( folder_path_match.folder_path != NULL && folder_path_match.matched == FALSE) g_warning("addressbook_foldersel_load_data: couldn't match book/folder path '%s'", path); g_strfreev( folder_path_match.folder_path ); if ( folder_path_match.node != NULL) gtk_cmctree_select( GTK_CMCTREE( addressbook_foldersel_dlg.tree_folder ), GTK_CMCTREE_NODE( folder_path_match.node ) ); else gtk_cmclist_select_row( GTK_CMCLIST( addressbook_foldersel_dlg.tree_folder ), 0, 0 ); gtk_widget_show(addressbook_foldersel_dlg.window); gtk_main(); gtk_widget_hide( addressbook_foldersel_dlg.window ); gtk_window_set_modal(GTK_WINDOW(addressbook_foldersel_dlg.window), FALSE); if ( ! addressbook_foldersel_cancelled ) { *book = NULL; *folder = NULL; if ( addressbook_foldersel_dlg.fiSelected ) { *book = addressbook_foldersel_dlg.fiSelected->book; *folder = addressbook_foldersel_dlg.fiSelected->folder; retVal = TRUE; } } gtk_cmclist_clear( GTK_CMCLIST( addressbook_foldersel_dlg.tree_folder ) ); return retVal; }
static void create_dialog (struct select_keys_s *sk) { GtkWidget *window; GtkWidget *vbox, *vbox2, *hbox; GtkWidget *bbox; GtkWidget *scrolledwin; GtkWidget *clist; GtkWidget *label; GtkWidget *select_btn, *cancel_btn, *dont_encrypt_btn, *other_btn; const char *titles[N_COL_TITLES]; g_assert (!sk->window); window = gtkut_window_new (GTK_WINDOW_TOPLEVEL, "select-keys"); gtk_widget_set_size_request (window, 560, 280); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_title (GTK_WINDOW (window), _("Select Keys")); gtk_window_set_modal (GTK_WINDOW (window), TRUE); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event_cb), sk); g_signal_connect (G_OBJECT (window), "key_press_event", G_CALLBACK (key_pressed_cb), sk); MANAGE_WINDOW_SIGNALS_CONNECT (window); vbox = gtk_vbox_new (FALSE, 8); gtk_container_add (GTK_CONTAINER (window), vbox); hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new ( "" ); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (hbox), scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); titles[COL_ALGO] = _("Size"); titles[COL_KEYID] = _("Key ID"); titles[COL_NAME] = _("Name"); titles[COL_EMAIL] = _("Address"); titles[COL_VALIDITY] = _("Trust"); clist = gtk_cmclist_new_with_titles (N_COL_TITLES, (char**)titles); gtk_container_add (GTK_CONTAINER (scrolledwin), clist); gtk_cmclist_set_column_width (GTK_CMCLIST(clist), COL_ALGO, 70); gtk_cmclist_set_column_width (GTK_CMCLIST(clist), COL_KEYID, 120); gtk_cmclist_set_column_width (GTK_CMCLIST(clist), COL_NAME, 115); gtk_cmclist_set_column_width (GTK_CMCLIST(clist), COL_EMAIL, 140); gtk_cmclist_set_column_width (GTK_CMCLIST(clist), COL_VALIDITY, 20); gtk_cmclist_set_selection_mode (GTK_CMCLIST(clist), GTK_SELECTION_BROWSE); g_signal_connect (G_OBJECT(GTK_CMCLIST(clist)->column[COL_NAME].button), "clicked", G_CALLBACK(sort_keys_name), sk); g_signal_connect (G_OBJECT(GTK_CMCLIST(clist)->column[COL_EMAIL].button), "clicked", G_CALLBACK(sort_keys_email), sk); hbox = gtk_hbox_new (FALSE, 8); gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); /* TRANSLATORS: check that the accelerators in _Select, _Other and * Do_n't encrypt are different than the one in the stock Cancel * button */ gtkut_stock_button_set_create (&bbox, &select_btn, _("_Select"), &other_btn, _("_Other"), &dont_encrypt_btn, _("Do_n't encrypt")); cancel_btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL); gtkut_widget_set_can_default(cancel_btn, TRUE); gtk_box_pack_start(GTK_BOX(bbox), cancel_btn, TRUE, TRUE, 0); gtk_widget_show(cancel_btn); gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0); gtk_widget_grab_default (select_btn); g_signal_connect (G_OBJECT (select_btn), "clicked", G_CALLBACK (select_btn_cb), sk); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK (cancel_btn_cb), sk); g_signal_connect (G_OBJECT(dont_encrypt_btn), "clicked", G_CALLBACK (dont_encrypt_btn_cb), sk); g_signal_connect (G_OBJECT (other_btn), "clicked", G_CALLBACK (other_btn_cb), sk); vbox2 = gtk_vbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0); sk->window = window; sk->toplabel = GTK_LABEL (label); sk->clist = GTK_CMCLIST (clist); }
static void grouplist_dialog_create(void) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *msg_label; GtkWidget *search_button; GtkWidget *confirm_area; GtkWidget *cancel_button; GtkWidget *refresh_button; GtkWidget *scrolledwin; static GdkGeometry geometry; gchar *titles[3]; gint i; dialog = gtk_dialog_new(); gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE); gtk_container_set_border_width (GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), 5); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); gtk_window_set_title(GTK_WINDOW(dialog), _("Newsgroup subscription")); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(window_deleted), NULL); g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(key_pressed), NULL); g_signal_connect(G_OBJECT(dialog), "size_allocate", G_CALLBACK(grouplist_size_allocate), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(dialog); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add(GTK_CONTAINER( gtk_dialog_get_content_area(GTK_DIALOG(dialog))), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); msg_label = gtk_label_new(_("Select newsgroups for subscription:")); gtk_box_pack_start(GTK_BOX(hbox), msg_label, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); msg_label = gtk_label_new(_("Find groups:")); gtk_box_pack_start(GTK_BOX(hbox), msg_label, FALSE, FALSE, 0); entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(entry_activated), NULL); search_button = gtk_button_new_with_label(_(" Search ")); gtk_box_pack_start(GTK_BOX(hbox), search_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(search_button), "clicked", G_CALLBACK(search_clicked), NULL); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX (vbox), scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); titles[0] = _("Newsgroup name"); titles[1] = _("Messages"); titles[2] = _("Type"); ctree = gtk_sctree_new_with_titles(3, 0, titles); gtk_container_add(GTK_CONTAINER(scrolledwin), ctree); gtk_cmclist_set_column_width (GTK_CMCLIST(ctree), 0, GROUPLIST_COL_NAME_WIDTH); gtk_cmclist_set_column_auto_resize(GTK_CMCLIST(ctree), 0, TRUE); gtk_cmclist_set_selection_mode(GTK_CMCLIST(ctree), GTK_SELECTION_MULTIPLE); gtk_cmctree_set_expander_style(GTK_CMCTREE(ctree), GTK_CMCTREE_EXPANDER_TRIANGLE); for (i = 0; i < 3; i++) gtk_widget_set_can_focus(GTK_CMCLIST(ctree)->column[i].button, FALSE); g_signal_connect(G_OBJECT(ctree), "button-press-event", G_CALLBACK(button_press_cb), NULL); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); status_label = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(hbox), status_label, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &refresh_button, GTK_STOCK_REFRESH, &cancel_button, GTK_STOCK_CANCEL, &ok_button, GTK_STOCK_OK); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), confirm_area); gtk_widget_grab_default(ok_button); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(ok_clicked), NULL); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_clicked), NULL); g_signal_connect(G_OBJECT(refresh_button), "clicked", G_CALLBACK(refresh_clicked), NULL); if (!geometry.min_width) { geometry.min_width = GROUPLIST_DIALOG_WIDTH; geometry.min_height = GROUPLIST_DIALOG_HEIGHT; } gtk_window_set_geometry_hints(GTK_WINDOW(dialog), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_window_set_default_size(GTK_WINDOW(dialog), prefs_common.news_subscribe_width, prefs_common.news_subscribe_height); gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); }