void master_passphrase_change_dialog() { static PangoFontDescription *font_desc; GtkWidget *dialog; GtkWidget *vbox, *hbox; GtkWidget *icon, *table, *label; GtkWidget *msg_title; GtkWidget *entry_old, *entry_new1, *entry_new2; GtkWidget *confirm_area; GtkWidget *ok_button, *cancel_button; struct _ctx *ctx; dialog = gtk_dialog_new(); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_window_set_default_size(GTK_WINDOW(dialog), 375, 100); gtk_window_set_title(GTK_WINDOW(dialog), ""); MANAGE_WINDOW_SIGNALS_CONNECT(dialog); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gtk_box_set_spacing(GTK_BOX(vbox), 14); hbox = gtk_hbox_new(FALSE, 12); gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0); gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); gtk_widget_show(vbox); msg_title = gtk_label_new(_("Changing master passphrase")); gtk_misc_set_alignment(GTK_MISC(msg_title), 0, 0.5); gtk_label_set_justify(GTK_LABEL(msg_title), GTK_JUSTIFY_LEFT); gtk_label_set_use_markup (GTK_LABEL (msg_title), TRUE); gtk_box_pack_start(GTK_BOX(vbox), msg_title, FALSE, FALSE, 0); gtk_label_set_line_wrap(GTK_LABEL(msg_title), TRUE); if (!font_desc) { gint size; size = pango_font_description_get_size (gtk_widget_get_style(msg_title)->font_desc); font_desc = pango_font_description_new(); pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); } if (font_desc) gtk_widget_modify_font(msg_title, font_desc); label = gtk_label_new( _("If a master passphrase is currently active, it\n" "needs to be entered.") ); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); table = gtk_table_new(4, 2, FALSE); /* Old passphrase */ label = gtk_label_new(_("Old passphrase:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); entry_old = gtk_entry_new(); gtk_entry_set_visibility(GTK_ENTRY(entry_old), FALSE); gtk_table_attach(GTK_TABLE(table), entry_old, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); /* Separator */ gtk_table_attach(GTK_TABLE(table), gtk_hseparator_new(), 0, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 5); /* New passphrase */ label = gtk_label_new(_("New passphrase:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0); entry_new1 = gtk_entry_new(); gtk_entry_set_visibility(GTK_ENTRY(entry_new1), FALSE); gtk_table_attach(GTK_TABLE(table), entry_new1, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0); /* New passphrase again */ label = gtk_label_new(_("Confirm passphrase:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, 0, 0, 0); entry_new2 = gtk_entry_new(); gtk_entry_set_visibility(GTK_ENTRY(entry_new2), FALSE); gtk_table_attach(GTK_TABLE(table), entry_new2, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); /* Dialog buttons */ gtkut_stock_button_set_create(&confirm_area, &cancel_button, GTK_STOCK_CANCEL, &ok_button, GTK_STOCK_OK, NULL, NULL); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), confirm_area, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5); gtk_widget_grab_default(ok_button); /* If no master passphrase is set, disable the "old passphrase" entry */ if (!master_passphrase_is_set()) gtk_widget_set_sensitive(entry_old, FALSE); g_signal_connect(G_OBJECT(entry_old), "activate", G_CALLBACK(entry_activated), entry_new1); g_signal_connect(G_OBJECT(entry_new1), "activate", G_CALLBACK(entry_activated), entry_new2); gtk_entry_set_activates_default(GTK_ENTRY(entry_new2), TRUE); ctx = g_new(struct _ctx, 1); ctx->done = FALSE; ctx->dialog = dialog; ctx->entry_old = entry_old; ctx->entry_new1 = entry_new1; ctx->entry_new2 = entry_new2; g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(ok_button_clicked), ctx); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_button_clicked), ctx); g_signal_connect(G_OBJECT(dialog), "destroy", G_CALLBACK(dialog_destroy), ctx); gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); gtk_window_present(GTK_WINDOW(dialog)); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); manage_window_set_transient(GTK_WINDOW(dialog)); while (!ctx->done) gtk_main_iteration(); if (ctx->dialog != NULL) gtk_widget_destroy(ctx->dialog); GTK_EVENTS_FLUSH(); g_free(ctx); }
static void prefs_custom_header_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *confirm_area; GtkWidget *vbox1; GtkWidget *table1; GtkWidget *hdr_label; GtkWidget *hdr_combo; GtkWidget *val_label; GtkWidget *val_entry; GtkWidget *val_btn; GtkWidget *reg_hbox; GtkWidget *btn_hbox; GtkWidget *arrow; GtkWidget *add_btn; GtkWidget *del_btn; GtkWidget *preview; GtkWidget *ch_hbox; GtkWidget *ch_scrolledwin; GtkWidget *list_view; GtkWidget *btn_vbox; GtkWidget *up_btn; GtkWidget *down_btn; debug_print("Creating custom header setting window...\n"); window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_customheader"); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW (window), TRUE); vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); gtkut_stock_button_set_create(&confirm_area, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); gtk_widget_show (confirm_area); gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default (ok_btn); gtk_window_set_title (GTK_WINDOW(window), _("Custom header configuration")); MANAGE_WINDOW_SIGNALS_CONNECT (window); g_signal_connect (G_OBJECT(window), "delete_event", G_CALLBACK(prefs_custom_header_deleted), NULL); g_signal_connect (G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_custom_header_key_pressed), NULL); g_signal_connect (G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_custom_header_ok), NULL); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_custom_header_cancel), NULL); vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); table1 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0); gtk_table_set_row_spacings (GTK_TABLE (table1), 8); gtk_table_set_col_spacings (GTK_TABLE (table1), 8); hdr_label = gtk_label_new (_("Header")); gtk_widget_show (hdr_label); gtk_table_attach (GTK_TABLE (table1), hdr_label, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0, 0); gtk_misc_set_alignment (GTK_MISC (hdr_label), 0, 0.5); hdr_combo = combobox_text_new(TRUE, "User-Agent", "Face", "X-Face", "X-Operating-System", NULL); gtk_table_attach (GTK_TABLE (table1), hdr_combo, 0, 1, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0, 0); gtk_widget_set_size_request (hdr_combo, 150, -1); val_label = gtk_label_new (_("Value")); gtk_widget_show (val_label); gtk_table_attach (GTK_TABLE (table1), val_label, 1, 2, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0, 0); gtk_misc_set_alignment (GTK_MISC (val_label), 0, 0.5); val_entry = gtk_entry_new (); gtk_widget_show (val_entry); gtk_table_attach (GTK_TABLE (table1), val_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0, 0); gtk_widget_set_size_request (val_entry, 200, -1); val_btn = gtkut_get_browse_file_btn(_("Bro_wse")); gtk_widget_show (val_btn); gtk_table_attach (GTK_TABLE (table1), val_btn, 2, 3, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0, 0); g_signal_connect (G_OBJECT (val_btn), "clicked", G_CALLBACK (prefs_custom_header_val_from_file_cb), NULL); /* add / delete */ reg_hbox = gtk_hbox_new (FALSE, 4); gtk_widget_show (reg_hbox); gtk_box_pack_start (GTK_BOX (vbox1), reg_hbox, FALSE, FALSE, 0); arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT); gtk_widget_show (arrow); gtk_box_pack_start (GTK_BOX (reg_hbox), arrow, FALSE, FALSE, 0); gtk_widget_set_size_request (arrow, -1, 16); btn_hbox = gtk_hbox_new (TRUE, 4); gtk_widget_show (btn_hbox); gtk_box_pack_start (GTK_BOX (reg_hbox), btn_hbox, FALSE, FALSE, 0); add_btn = gtk_button_new_from_stock (GTK_STOCK_ADD); gtk_widget_show (add_btn); gtk_box_pack_start (GTK_BOX (btn_hbox), add_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (add_btn), "clicked", G_CALLBACK (prefs_custom_header_add_cb), NULL); del_btn = gtk_button_new_from_stock (GTK_STOCK_DELETE); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_hbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_custom_header_delete_cb), NULL); ch_hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (ch_hbox); gtk_box_pack_start (GTK_BOX (vbox1), ch_hbox, TRUE, TRUE, 0); ch_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (ch_scrolledwin, -1, 200); gtk_widget_show (ch_scrolledwin); gtk_box_pack_start (GTK_BOX (ch_hbox), ch_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ch_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); list_view = prefs_custom_header_list_view_create(); gtk_widget_show (list_view); gtk_container_add (GTK_CONTAINER (ch_scrolledwin), list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (ch_hbox), btn_vbox, FALSE, FALSE, 0); up_btn = gtk_button_new_from_stock (GTK_STOCK_GO_UP); gtk_widget_show (up_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (up_btn), "clicked", G_CALLBACK (prefs_custom_header_up), NULL); down_btn = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN); gtk_widget_show (down_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (down_btn), "clicked", G_CALLBACK (prefs_custom_header_down), NULL); preview = gtk_image_new (); gtk_widget_show (preview); gtk_box_pack_start (GTK_BOX (btn_vbox), preview, FALSE, FALSE, 0); gtk_widget_show_all(window); customhdr.window = window; customhdr.ok_btn = ok_btn; customhdr.cancel_btn = cancel_btn; customhdr.preview = preview; customhdr.hdr_combo = hdr_combo; customhdr.hdr_entry = gtk_bin_get_child(GTK_BIN((hdr_combo))); customhdr.val_entry = val_entry; customhdr.list_view = list_view; }
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 addressbook_edit_jpilot_create( gboolean *cancelled ) { GtkWidget *window; GtkWidget *vbox; GtkWidget *table; GtkWidget *label; GtkWidget *name_entry; GtkWidget *file_entry; GtkWidget *vbox_custom; GtkWidget *frame_custom; GtkWidget *custom_check[JPILOT_NUM_CUSTOM_LABEL]; GtkWidget *custom_label[JPILOT_NUM_CUSTOM_LABEL]; GtkWidget *hlbox; GtkWidget *hbbox; GtkWidget *hsep; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *check_btn; GtkWidget *file_btn; GtkWidget *hsbox; GtkWidget *statusbar; gint top, i; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request(window, 450, -1); gtk_container_set_border_width(GTK_CONTAINER(window), 0); gtk_window_set_title(GTK_WINDOW(window), _("Edit JPilot Entry")); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(window), TRUE); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(edit_jpilot_delete_event), cancelled); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(edit_jpilot_key_pressed), cancelled); 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(2 + JPILOT_NUM_CUSTOM_LABEL, 3, 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(_("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); name_entry = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), name_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); check_btn = gtk_button_new_with_label( _(" Check File ")); gtk_table_attach(GTK_TABLE(table), check_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0); /* Second row */ top = 1; label = gtk_label_new(_("File")); 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); file_entry = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), file_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); file_btn = gtk_button_new_with_label( _(" ... ")); gtk_table_attach(GTK_TABLE(table), file_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0); /* Third row */ top = 2; frame_custom = gtk_frame_new(_("Additional e-Mail address item(s)")); gtk_table_attach(GTK_TABLE(table), frame_custom, 1, 2, top, (top + JPILOT_NUM_CUSTOM_LABEL), GTK_FILL, 0, 0, 0); /* Now do custom labels. */ vbox_custom = gtk_vbox_new (FALSE, 8); for( i = 0; i < JPILOT_NUM_CUSTOM_LABEL; i++ ) { hlbox = gtk_hbox_new( FALSE, 0 ); custom_check[i] = gtk_check_button_new(); custom_label[i] = gtk_label_new( "" ); gtk_box_pack_start( GTK_BOX(hlbox), custom_check[i], FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX(hlbox), custom_label[i], TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX(vbox_custom), hlbox, TRUE, TRUE, 0 ); gtk_misc_set_alignment(GTK_MISC(custom_label[i]), 0, 0.5); top++; } gtk_container_add (GTK_CONTAINER (frame_custom), vbox_custom); gtk_container_set_border_width( GTK_CONTAINER(vbox_custom), 8 ); /* Status line */ hsbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, 0); statusbar = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, 0); /* 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_jpilot_ok), cancelled); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(edit_jpilot_cancel), cancelled); g_signal_connect(G_OBJECT(file_btn), "clicked", G_CALLBACK(edit_jpilot_file_select), NULL); g_signal_connect(G_OBJECT(check_btn), "clicked", G_CALLBACK(edit_jpilot_file_check), NULL); gtk_widget_show_all(vbox); jpilotedit.window = window; jpilotedit.name_entry = name_entry; jpilotedit.file_entry = file_entry; jpilotedit.hbbox = hbbox; jpilotedit.ok_btn = ok_btn; jpilotedit.cancel_btn = cancel_btn; jpilotedit.statusbar = statusbar; jpilotedit.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit JPilot Dialog" ); for( i = 0; i < JPILOT_NUM_CUSTOM_LABEL; i++ ) { jpilotedit.custom_check[i] = custom_check[i]; jpilotedit.custom_label[i] = custom_label[i]; } }
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" ); }
/* Create the window for selecting folders with checkboxes */ static void foldercheck_create_window(SpecificFolderArrayEntry *entry) { GtkWidget *vbox; GtkWidget *scrolledwin; GtkWidget *confirm_area; GtkWidget *checkbox; GtkWidget *cancel_button; GtkWidget *ok_button; GtkTreeSelection *selection; GtkTreeViewColumn *column; GtkCellRenderer *renderer; static GdkGeometry geometry; /* Create window */ entry->window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "notification_foldercheck"); gtk_window_set_title(GTK_WINDOW(entry->window), _("Select folder(s)")); gtk_container_set_border_width(GTK_CONTAINER(entry->window), 4); gtk_window_set_position(GTK_WINDOW(entry->window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(entry->window), TRUE); gtk_window_set_resizable(GTK_WINDOW(entry->window), TRUE); gtk_window_set_wmclass (GTK_WINDOW(entry->window), "folder_selection", "Claws Mail"); g_signal_connect(G_OBJECT(entry->window), "delete_event", G_CALLBACK(delete_event), entry); g_signal_connect(G_OBJECT(entry->window), "key_press_event", G_CALLBACK(key_pressed), entry); MANAGE_WINDOW_SIGNALS_CONNECT(entry->window); /* vbox */ vbox = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(entry->window), vbox); /* scrolled window */ scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin), GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0); /* pixbufs */ if(!folder_pixbuf) stock_pixbuf_gdk(STOCK_PIXMAP_DIR_CLOSE, &folder_pixbuf); if(!folderopen_pixbuf) stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN, &folderopen_pixbuf); if(!foldernoselect_pixbuf) stock_pixbuf_gdk(STOCK_PIXMAP_DIR_NOSELECT_CLOSE, &foldernoselect_pixbuf); if(!foldernoselectopen_pixbuf) stock_pixbuf_gdk(STOCK_PIXMAP_DIR_NOSELECT_OPEN, &foldernoselectopen_pixbuf); /* Tree store */ foldercheck_set_tree(entry); gtk_tree_model_foreach(GTK_TREE_MODEL(entry->tree_store), foldercheck_foreach_update_to_list, entry); /* tree view */ entry->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(entry->tree_store)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(entry->treeview), FALSE); gtk_tree_view_set_search_column(GTK_TREE_VIEW(entry->treeview), FOLDERCHECK_FOLDERNAME); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(entry->treeview), prefs_common_get_prefs()->use_stripes_everywhere); gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(entry->treeview), FALSE); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(entry->treeview)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); gtk_tree_selection_set_select_function(selection, foldercheck_selected, NULL, NULL); gtk_container_add(GTK_CONTAINER(scrolledwin), entry->treeview); /* --- column 1 --- */ column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, "sel"); gtk_tree_view_column_set_spacing(column, 2); /* checkbox */ renderer = gtk_cell_renderer_toggle_new(); g_object_set(renderer, "xalign", 0.0, NULL); gtk_tree_view_column_pack_start(column, renderer, TRUE); g_signal_connect(renderer, "toggled", G_CALLBACK(folder_toggle_cb),entry); gtk_tree_view_column_set_attributes(column, renderer, "active", FOLDERCHECK_CHECK,NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(entry->treeview), column); /* --- column 2 --- */ column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, "Folder"); gtk_tree_view_column_set_spacing(column, 2); /* pixbuf */ renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_attributes (column, renderer, "pixbuf", FOLDERCHECK_PIXBUF, "pixbuf-expander-open", FOLDERCHECK_PIXBUF_OPEN, "pixbuf-expander-closed", FOLDERCHECK_PIXBUF, NULL); /* text */ renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_set_attributes(column, renderer, "text", FOLDERCHECK_FOLDERNAME, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(entry->treeview), column); /* recursive */ checkbox = gtk_check_button_new_with_label( _("select recursively")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), FALSE); g_signal_connect(G_OBJECT(checkbox), "toggled", G_CALLBACK(foldercheck_recursive_cb), entry); gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 10); gtkut_stock_button_set_create(&confirm_area, &cancel_button, GTK_STOCK_CANCEL, &ok_button, GTK_STOCK_OK, NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default(ok_button); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(foldercheck_ok), entry); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(foldercheck_cancel), entry); if(!geometry.min_height) { geometry.min_width = 360; geometry.min_height = 360; } gtk_window_set_geometry_hints(GTK_WINDOW(entry->window), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_tree_view_expand_all(GTK_TREE_VIEW(entry->treeview)); gtk_widget_show_all(vbox); }
static void imp_mutt_create( gboolean *cancelled ) { GtkWidget *window; GtkWidget *vbox; GtkWidget *table; GtkWidget *label; GtkWidget *file_entry; GtkWidget *name_entry; GtkWidget *hbbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *file_btn; GtkWidget *statusbar; GtkWidget *hsbox; gint top; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "importmutt"); gtk_widget_set_size_request(window, 450, -1); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title( GTK_WINDOW(window), _("Import MUTT file into Address Book") ); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(imp_mutt_delete_event), cancelled); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(imp_mutt_key_pressed), cancelled); 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(2, 3, 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(_("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); name_entry = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), name_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* Second row */ top = 1; label = gtk_label_new(_("File")); 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); file_entry = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), file_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); file_btn = gtkut_get_browse_file_btn(_("_Browse")); gtk_table_attach(GTK_TABLE(table), file_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0); /* 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, &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), 5); gtk_widget_grab_default(ok_btn); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(imp_mutt_ok), cancelled); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(imp_mutt_cancel), cancelled); g_signal_connect(G_OBJECT(file_btn), "clicked", G_CALLBACK(imp_mutt_file_select), NULL); gtk_widget_show_all(vbox); impmutt_dlg.window = window; impmutt_dlg.file_entry = file_entry; impmutt_dlg.name_entry = name_entry; impmutt_dlg.ok_btn = ok_btn; impmutt_dlg.cancel_btn = cancel_btn; impmutt_dlg.statusbar = statusbar; impmutt_dlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Import Mutt Dialog" ); }
/*! *\brief Create the matcher dialog */ static void prefs_filtering_action_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *confirm_area; GtkWidget *vbox1; GtkWidget *frame; GtkWidget *table; GtkWidget *hbox1; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *action_combo; GtkWidget *account_combo; GtkWidget *header_combo; GtkWidget *header_entry; #ifndef USE_NEW_ADDRBOOK GtkWidget *addressbook_btn; #endif GtkWidget *dest_entry; GtkWidget *dest_btn; GtkWidget *score_entry; GtkWidget *tags_combo; GtkWidget *reg_hbox; GtkWidget *btn_hbox; GtkWidget *arrow; GtkWidget *reg_btn; GtkWidget *subst_btn; GtkWidget *del_btn; GtkWidget *action_hbox; GtkWidget *action_scrolledwin; GtkWidget *action_list_view; GtkWidget *btn_vbox; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *exec_btn; #if !GTK_CHECK_VERSION(3, 0, 0) GtkWidget *color_optmenu; #endif static GdkGeometry geometry; GList * accounts; GSList *tmp, *tags; GtkSizeGroup *size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); GtkSizeGroup *size_action = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); GtkTreeModel *model; GtkCellRenderer *renderer; debug_print("Creating matcher configuration window...\n"); window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_filtering_action"); gtk_container_set_border_width(GTK_CONTAINER(window), VBOX_BORDER); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(window), TRUE); gtk_window_set_resizable(GTK_WINDOW(window), TRUE); vbox = gtk_vbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(window), vbox); gtkut_stock_button_set_create(&confirm_area, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default(ok_btn); gtk_window_set_title(GTK_WINDOW(window), _("Action configuration")); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(prefs_filtering_action_deleted), NULL); g_signal_connect(G_OBJECT(window), "size_allocate", G_CALLBACK(prefs_filtering_action_size_allocate_cb), NULL); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_filtering_action_key_pressed), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(window); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_filtering_action_ok), NULL); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_filtering_action_cancel), NULL); vbox1 = gtk_vbox_new(FALSE, VSPACING); gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER (vbox1), 2); frame = gtk_frame_new(_("Rule")); gtk_frame_set_label_align(GTK_FRAME(frame), 0.01, 0.5); gtk_box_pack_start (GTK_BOX (vbox1), frame, FALSE, FALSE, 0); gtk_widget_set_size_request(frame, -1, 110); table = gtk_table_new(3, 3, FALSE); gtk_container_set_border_width(GTK_CONTAINER(table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2); gtk_table_set_col_spacings (GTK_TABLE (table), HSPACING_NARROW); gtk_container_add(GTK_CONTAINER(frame), table); /* first row labels */ label1 = gtk_label_new (_("Action")); gtk_widget_set_size_request(label1, LABELS_WIDTH, -1); gtk_size_group_add_widget(size_group, label1); gtk_misc_set_alignment (GTK_MISC (label1), 1, 0.5); gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0); label2 = gtk_label_new (""); gtk_size_group_add_widget(size_group, label2); gtk_misc_set_alignment (GTK_MISC (label2), 1, 0.5); gtk_table_attach(GTK_TABLE(table), label2, 0, 1, 1, 2, GTK_FILL, GTK_SHRINK, 0, 0); label3 = gtk_label_new (""); gtk_size_group_add_widget(size_group, label3); gtk_misc_set_alignment (GTK_MISC (label3), 1, 0.5); gtk_table_attach(GTK_TABLE(table), label3, 0, 1, 2, 3, GTK_FILL, GTK_SHRINK, 0, 0); /* action combo */ hbox1 = gtk_hbox_new(FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox1, 1, 2, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0); model = prefs_filtering_action_create_model(); action_combo = gtk_combo_box_new_with_model(model); gtk_size_group_add_widget(size_action, action_combo); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(action_combo), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(action_combo), renderer, "text", ACTION_COMBO_TEXT, "sensitive", ACTION_COMBO_SENS, NULL); gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(action_combo), renderer, cell_is_sensitive, NULL, NULL); combobox_select_by_data(GTK_COMBO_BOX(action_combo), ACTION_MOVE); g_signal_connect(G_OBJECT(action_combo), "changed", G_CALLBACK(prefs_filtering_action_type_selection_changed), NULL); gtk_box_pack_start(GTK_BOX(hbox1), action_combo, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), gtk_label_new(""), TRUE, TRUE, 0); /* accounts */ hbox1 = gtk_hbox_new (FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox1, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); #if !GTK_CHECK_VERSION(2, 24, 0) account_combo = gtk_combo_box_new_text (); #else account_combo = gtk_combo_box_text_new (); #endif gtk_size_group_add_widget(size_action, account_combo); for (accounts = account_get_list() ; accounts != NULL; accounts = accounts->next) { PrefsAccount *ac = (PrefsAccount *)accounts->data; gchar *name = g_strdup(ac->account_name); #if !GTK_CHECK_VERSION(2, 24, 0) gtk_combo_box_append_text(GTK_COMBO_BOX(account_combo), (gpointer) name); #else gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(account_combo), (gpointer) name); #endif g_free(name); } prefs_filtering_action_check_widget_width(account_combo); gtk_combo_box_set_active(GTK_COMBO_BOX(account_combo), 0); gtk_box_pack_start (GTK_BOX (hbox1), account_combo, FALSE, FALSE, 0); /* header */ header_combo = combobox_text_new(TRUE, "From", "To", "Cc", "Reply-To", "Sender", NULL); gtk_size_group_add_widget(size_action, header_combo); gtk_box_pack_start (GTK_BOX (hbox1), header_combo, FALSE, FALSE, 0); header_entry = gtk_bin_get_child(GTK_BIN((header_combo))); /* destination */ hbox1 = gtk_hbox_new (FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox1, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); dest_entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (hbox1), dest_entry, TRUE, TRUE, 0); score_entry = gtk_spin_button_new_with_range(-1000, 1000, 1); gtk_box_pack_start(GTK_BOX(hbox1), score_entry, FALSE, FALSE, 0); #if !GTK_CHECK_VERSION(3, 0, 0) color_optmenu = gtk_cmoption_menu_new(); gtk_size_group_add_widget(size_action, color_optmenu); gtk_cmoption_menu_set_menu(GTK_CMOPTION_MENU(color_optmenu), colorlabel_create_color_menu()); prefs_filtering_action_check_widget_width(color_optmenu); gtk_box_pack_start(GTK_BOX(hbox1), color_optmenu, FALSE, FALSE, 0); #endif #if !GTK_CHECK_VERSION(2, 24, 0) tags_combo = gtk_combo_box_new_text (); #else tags_combo = gtk_combo_box_text_new (); #endif gtk_size_group_add_widget(size_action, tags_combo); for (tmp = tags = tags_get_list() ; tmp != NULL; tmp = tmp->next) { gchar *name = g_strdup(tags_get_tag(GPOINTER_TO_INT(tmp->data))); #if !GTK_CHECK_VERSION(2, 24, 0) gtk_combo_box_append_text(GTK_COMBO_BOX(tags_combo), (gpointer) name); #else gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(tags_combo), (gpointer) name); #endif g_free(name); } g_slist_free(tags); prefs_filtering_action_check_widget_width(tags_combo); gtk_combo_box_set_active(GTK_COMBO_BOX(tags_combo), 0); gtk_box_pack_start (GTK_BOX (hbox1), tags_combo, FALSE, FALSE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_table_attach(GTK_TABLE(table), hbox1, 2, 3, 2, 3, GTK_FILL, GTK_SHRINK, 0, 0); dest_btn = gtk_button_new_with_label (_("Select...")); gtk_box_pack_start (GTK_BOX (hbox1), dest_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (dest_btn), "clicked", G_CALLBACK(prefs_filtering_action_select_dest), NULL); #ifndef USE_NEW_ADDRBOOK addressbook_btn = gtk_button_new_with_label (_("Select...")); gtk_box_pack_start (GTK_BOX (hbox1), addressbook_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (addressbook_btn), "clicked", G_CALLBACK(prefs_filtering_action_select_addressbook), NULL); #endif exec_btn = gtk_button_new_from_stock(GTK_STOCK_INFO); gtk_box_pack_start (GTK_BOX (hbox1), exec_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (exec_btn), "clicked", G_CALLBACK(prefs_filtering_action_exec_info), window); /* register / substitute / delete */ reg_hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox1), reg_hbox, FALSE, FALSE, 0); arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT); gtk_box_pack_start(GTK_BOX(reg_hbox), arrow, FALSE, FALSE, 0); gtk_widget_set_size_request(arrow, -1, 16); btn_hbox = gtk_hbox_new(TRUE, 4); gtk_box_pack_start(GTK_BOX(reg_hbox), btn_hbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_from_stock(GTK_STOCK_ADD); gtk_box_pack_start(GTK_BOX(btn_hbox), reg_btn, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(reg_btn), "clicked", G_CALLBACK(prefs_filtering_action_register_cb), NULL); subst_btn = gtkut_get_replace_btn(_("_Replace")); gtk_box_pack_start(GTK_BOX(btn_hbox), subst_btn, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(subst_btn), "clicked", G_CALLBACK(prefs_filtering_action_substitute_cb), NULL); del_btn = gtk_button_new_with_mnemonic (_("Re_move")); gtk_button_set_image(GTK_BUTTON(del_btn), gtk_image_new_from_stock(GTK_STOCK_REMOVE,GTK_ICON_SIZE_BUTTON)); gtk_box_pack_start(GTK_BOX(btn_hbox), del_btn, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(del_btn), "clicked", G_CALLBACK(prefs_filtering_action_delete_cb), NULL); action_hbox = gtk_hbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(vbox1), action_hbox, TRUE, TRUE, 0); action_scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_widget_set_size_request(action_scrolledwin, -1, 150); gtk_box_pack_start(GTK_BOX(action_hbox), action_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(action_scrolledwin), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(action_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); action_list_view = prefs_filtering_action_list_view_create(); gtk_container_add(GTK_CONTAINER(action_scrolledwin), action_list_view); btn_vbox = gtk_vbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(action_hbox), btn_vbox, FALSE, FALSE, 0); up_btn = gtk_button_new_from_stock(GTK_STOCK_GO_UP); gtk_box_pack_start(GTK_BOX(btn_vbox), up_btn, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(up_btn), "clicked", G_CALLBACK(prefs_filtering_action_up), NULL); down_btn = gtk_button_new_from_stock(GTK_STOCK_GO_DOWN); gtk_box_pack_start(GTK_BOX(btn_vbox), down_btn, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(down_btn), "clicked", G_CALLBACK(prefs_filtering_action_down), NULL); if (!geometry.min_height) { geometry.min_width = 490; geometry.min_height = 348; } gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_widget_set_size_request(window, prefs_common.filteringactionwin_width, prefs_common.filteringactionwin_height); gtk_widget_show_all(window); filtering_action.window = window; filtering_action.label1 = label1; filtering_action.label2 = label2; filtering_action.label3 = label3; filtering_action.action_combo = action_combo; filtering_action.account_combo = account_combo; filtering_action.tags_combo = tags_combo; filtering_action.dest_entry = dest_entry; filtering_action.dest_btn = dest_btn; filtering_action.exec_btn = exec_btn; #if !GTK_CHECK_VERSION(3, 0, 0) filtering_action.color_optmenu = color_optmenu; #endif filtering_action.score_entry = score_entry; filtering_action.header_combo = header_combo; filtering_action.header_entry = header_entry; #ifndef USE_NEW_ADDRBOOK filtering_action.addressbook_btn = addressbook_btn; #endif filtering_action.ok_btn = ok_btn; filtering_action.action_list_view = action_list_view; prefs_filtering_action_type_selection_changed(NULL, NULL); }
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))); }
/** * Create main dialog decorations (excluding notebook pages). */ static void imp_ldif_dialog_create() { GtkWidget *window; GtkWidget *vbox; GtkWidget *vnbox; GtkWidget *notebook; GtkWidget *hbbox; GtkWidget *btnPrev; GtkWidget *btnNext; GtkWidget *btnProceed; GtkWidget *btnCancel; GtkWidget *hsbox; GtkWidget *statusbar; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "importldif"); gtk_widget_set_size_request(window, IMPORTLDIF_WIDTH, IMPORTLDIF_HEIGHT ); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title( GTK_WINDOW(window), _("Import LDIF file into Address Book") ); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(imp_ldif_delete_event), NULL ); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(imp_ldif_key_pressed), NULL ); vbox = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(window), vbox); vnbox = gtk_vbox_new(FALSE, 4); gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4); gtk_widget_show(vnbox); gtk_box_pack_start(GTK_BOX(vbox), vnbox, TRUE, TRUE, 0); /* Notebook */ notebook = gtk_notebook_new(); gtk_notebook_set_show_tabs( GTK_NOTEBOOK(notebook), FALSE ); gtk_widget_show(notebook); gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(notebook), 6); /* 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, &btnCancel, GTK_STOCK_CANCEL, &btnPrev, GTK_STOCK_GO_BACK, &btnNext, GTK_STOCK_GO_FORWARD); btnProceed = gtk_button_new_with_mnemonic(_("Proceed")); gtk_button_set_image(GTK_BUTTON(btnProceed), gtk_image_new_from_stock(GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON)); gtkut_widget_set_can_default(btnProceed, TRUE); gtk_box_pack_start(GTK_BOX(hbbox), btnProceed, TRUE, TRUE, 0); gtk_widget_hide(btnProceed); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2); gtk_widget_grab_default(btnNext); /* Button handlers */ g_signal_connect(G_OBJECT(btnPrev), "clicked", G_CALLBACK(imp_ldif_prev), NULL); g_signal_connect(G_OBJECT(btnNext), "clicked", G_CALLBACK(imp_ldif_next), NULL); g_signal_connect(G_OBJECT(btnProceed), "clicked", G_CALLBACK(imp_ldif_next), NULL); g_signal_connect(G_OBJECT(btnCancel), "clicked", G_CALLBACK(imp_ldif_cancel), NULL); gtk_widget_show_all(vbox); impldif_dlg.window = window; impldif_dlg.notebook = notebook; impldif_dlg.btnPrev = btnPrev; impldif_dlg.btnNext = btnNext; impldif_dlg.btnProceed = btnProceed; impldif_dlg.btnCancel = btnCancel; impldif_dlg.statusbar = statusbar; impldif_dlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Import LDIF Dialog" ); }
static void input_dialog_create(gboolean is_password) { static PangoFontDescription *font_desc; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *cancel_button; GtkWidget *confirm_area; dialog = gtk_dialog_new(); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_window_set_default_size(GTK_WINDOW(dialog), 375, 100); gtk_window_set_title(GTK_WINDOW(dialog), ""); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(key_pressed), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(dialog); vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_box_set_spacing (GTK_BOX (vbox), 14); hbox = gtk_hbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); /* for title label */ icon_q = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment (GTK_MISC (icon_q), 0.5, 0.0); gtk_box_pack_start (GTK_BOX (hbox), icon_q, FALSE, FALSE, 0); icon_p = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment (GTK_MISC (icon_p), 0.5, 0.0); gtk_box_pack_start (GTK_BOX (hbox), icon_p, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); msg_title = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(msg_title), 0, 0.5); gtk_label_set_justify(GTK_LABEL(msg_title), GTK_JUSTIFY_LEFT); gtk_label_set_use_markup (GTK_LABEL (msg_title), TRUE); gtk_box_pack_start(GTK_BOX(vbox), msg_title, FALSE, FALSE, 0); gtk_label_set_line_wrap(GTK_LABEL(msg_title), TRUE); if (!font_desc) { gint size; size = pango_font_description_get_size (gtk_widget_get_style(msg_title)->font_desc); font_desc = pango_font_description_new(); pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); } if (font_desc) gtk_widget_modify_font(msg_title, font_desc); msg_label = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(msg_label), 0, 0.5); gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_LEFT); gtk_box_pack_start(GTK_BOX(vbox), msg_label, FALSE, FALSE, 0); gtk_widget_show(msg_label); entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(entry_activated), NULL); #if !GTK_CHECK_VERSION(2, 24, 0) combo = gtk_combo_box_entry_new_text(); #else combo = gtk_combo_box_text_new_with_entry(); #endif gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((combo)))), "activate", G_CALLBACK(combo_activated), NULL); remember_checkbtn = gtk_check_button_new_with_label(_("Remember this")); gtk_box_pack_start(GTK_BOX(vbox), remember_checkbtn, FALSE, FALSE, 0); hbox = gtk_hbox_new(TRUE, 0); gtkut_stock_button_set_create(&confirm_area, &cancel_button, GTK_STOCK_CANCEL, &ok_button, GTK_STOCK_OK, NULL, NULL); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), confirm_area, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5); gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); gtk_widget_hide(remember_checkbtn); if (is_password) gtk_widget_hide(icon_q); else gtk_widget_hide(icon_p); is_pass = is_password; 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); }
static void prefs_display_header_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *btn_hbox; GtkWidget *confirm_area; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *hdr_label; GtkWidget *hdr_combo; GtkWidget *btn_vbox; GtkWidget *reg_btn; GtkWidget *del_btn; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *clist_hbox; GtkWidget *clist_hbox1; GtkWidget *clist_hbox2; GtkWidget *clist_scrolledwin; GtkWidget *headers_clist; GtkWidget *hidden_headers_clist; GtkWidget *checkbtn_other_headers; gchar *title[1]; debug_print(_("Creating display header setting window...\n")); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (window), TRUE); gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE); vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); btn_hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (btn_hbox); gtk_box_pack_end (GTK_BOX (vbox), btn_hbox, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK, &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL); gtk_widget_show (confirm_area); gtk_box_pack_end (GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default (ok_btn); gtk_window_set_title (GTK_WINDOW(window), _("Display header setting")); MANAGE_WINDOW_SIGNALS_CONNECT(window); g_signal_connect (G_OBJECT(window), "delete_event", G_CALLBACK(prefs_display_header_deleted), NULL); g_signal_connect (G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_display_header_key_pressed), NULL); g_signal_connect (G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_display_header_ok), NULL); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_display_header_cancel), NULL); vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); hdr_label = gtk_label_new (_("Header name")); gtk_widget_show (hdr_label); gtk_box_pack_start (GTK_BOX (hbox1), hdr_label, FALSE, FALSE, 0); hdr_combo = gtk_combo_new (); gtk_widget_show (hdr_combo); gtk_box_pack_start (GTK_BOX (hbox1), hdr_combo, TRUE, TRUE, 0); gtk_widget_set_size_request (hdr_combo, 150, -1); gtkut_combo_set_items (GTK_COMBO (hdr_combo), "From", "To", "Cc", "Subject", "Date", "Reply-To", "Sender", "User-Agent", "X-Mailer", NULL); clist_hbox = gtk_hbox_new (FALSE, 10); gtk_widget_show (clist_hbox); gtk_box_pack_start (GTK_BOX (vbox1), clist_hbox, TRUE, TRUE, 0); /* display headers list */ clist_hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (clist_hbox1); gtk_box_pack_start (GTK_BOX (clist_hbox), clist_hbox1, TRUE, TRUE, 0); clist_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (clist_scrolledwin, 200, 210); gtk_widget_show (clist_scrolledwin); gtk_box_pack_start (GTK_BOX (clist_hbox1), clist_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (clist_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); title[0] = _("Displayed Headers"); headers_clist = gtk_clist_new_with_titles(1, title); gtk_widget_show (headers_clist); gtk_container_add (GTK_CONTAINER (clist_scrolledwin), headers_clist); gtk_clist_set_selection_mode (GTK_CLIST (headers_clist), GTK_SELECTION_BROWSE); gtk_clist_set_reorderable (GTK_CLIST (headers_clist), TRUE); gtk_clist_set_use_drag_icons (GTK_CLIST (headers_clist), FALSE); gtkut_clist_set_redraw (GTK_CLIST (headers_clist)); GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (headers_clist)->column[0].button, GTK_CAN_FOCUS); g_signal_connect_after (G_OBJECT (headers_clist), "row_move", G_CALLBACK (prefs_display_header_row_moved), NULL); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (clist_hbox1), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_with_label (_("Add")); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER(FALSE)); del_btn = gtk_button_new_with_label (_("Delete")); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), headers_clist); up_btn = gtk_button_new_with_label (_("Up")); gtk_widget_show (up_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (up_btn), "clicked", G_CALLBACK (prefs_display_header_up), NULL); down_btn = gtk_button_new_with_label (_("Down")); gtk_widget_show (down_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (down_btn), "clicked", G_CALLBACK (prefs_display_header_down), NULL); /* hidden headers list */ clist_hbox2 = gtk_hbox_new (FALSE, 8); gtk_widget_show (clist_hbox2); gtk_box_pack_start (GTK_BOX (clist_hbox), clist_hbox2, TRUE, TRUE, 0); clist_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (clist_scrolledwin, 200, 210); gtk_widget_show (clist_scrolledwin); gtk_box_pack_start (GTK_BOX (clist_hbox2), clist_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (clist_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); title[0] = _("Hidden headers"); hidden_headers_clist = gtk_clist_new_with_titles(1, title); gtk_widget_show (hidden_headers_clist); gtk_container_add (GTK_CONTAINER (clist_scrolledwin), hidden_headers_clist); gtk_clist_set_selection_mode (GTK_CLIST (hidden_headers_clist), GTK_SELECTION_BROWSE); gtk_clist_set_auto_sort(GTK_CLIST (hidden_headers_clist), TRUE); gtkut_clist_set_redraw (GTK_CLIST (hidden_headers_clist)); GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (hidden_headers_clist)-> column[0].button, GTK_CAN_FOCUS); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (clist_hbox2), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_with_label (_("Add")); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER (TRUE)); del_btn = gtk_button_new_with_label (_("Delete")); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), hidden_headers_clist); PACK_CHECK_BUTTON (btn_hbox, checkbtn_other_headers, _("Show all unspecified headers")); SET_TOGGLE_SENSITIVITY (checkbtn_other_headers, clist_hbox2); gtk_widget_show_all(window); dispheader.window = window; dispheader.confirm_area = confirm_area; dispheader.ok_btn = ok_btn; dispheader.cancel_btn = cancel_btn; dispheader.hdr_combo = hdr_combo; dispheader.hdr_entry = GTK_COMBO (hdr_combo)->entry; dispheader.headers_clist = headers_clist; dispheader.hidden_headers_clist = hidden_headers_clist; dispheader.other_headers = checkbtn_other_headers; }
static void input_dialog_create(InputDialogType dialog_type) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *sel_btn; GtkWidget *cancel_button; dialog = gtk_dialog_new(); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_widget_set_size_request(dialog, DIALOG_WIDTH * gtkut_get_dpi_multiplier(), -1); gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 5 * gtkut_get_dpi_multiplier()); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); manage_window_set_transient(GTK_WINDOW(dialog)); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(key_pressed), NULL); g_signal_connect(G_OBJECT(dialog), "focus_out_event", G_CALLBACK(focus_out), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(dialog); vbox = gtk_vbox_new(FALSE, 8 * gtkut_get_dpi_multiplier()); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 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(""); gtk_box_pack_start(GTK_BOX(hbox), msg_label, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_LEFT); hbox = gtk_hbox_new(FALSE, 4 * gtkut_get_dpi_multiplier()); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); type = dialog_type; if (dialog_type == INPUT_DIALOG_COMBO) { combo = gtk_combo_new(); gtk_box_pack_start(GTK_BOX(hbox), combo, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(GTK_COMBO(combo)->entry), "activate", G_CALLBACK(combo_activated), NULL); } else { 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); if (dialog_type == INPUT_DIALOG_FILESEL) { sel_btn = gtk_button_new_with_label("..."); gtk_box_pack_start(GTK_BOX(hbox), sel_btn, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(sel_btn), "clicked", G_CALLBACK(sel_btn_clicked), NULL); } if (dialog_type == INPUT_DIALOG_INVISIBLE) gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); } gtkut_stock_button_set_create(&confirm_area, &ok_button, GTK_STOCK_OK, &cancel_button, GTK_STOCK_CANCEL, NULL, NULL); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 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); gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); }
static void uri_opener_create(void) { GtkWidget *window; GtkWidget *hbox_scroll; GtkWidget *hbox; GtkWidget *hbox1; GtkWidget *vbox1; GtkWidget *label; GtkWidget *urilist; GtkWidget *select_all_btn; GtkWidget *open_btn; GtkWidget *close_btn; GtkWidget *scrolledwin; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "uri_opener"); gtk_window_set_title (GTK_WINDOW(window), C_("Dialog title", "Open URLs")); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW (window), TRUE); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(uri_opener_close_cb), NULL); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(key_pressed), NULL); MANAGE_WINDOW_SIGNALS_CONNECT (window); vbox1 = gtk_vbox_new(FALSE, 6); gtkut_stock_button_set_create(&hbox1, &open_btn, GTK_STOCK_OPEN, &close_btn, GTK_STOCK_CLOSE, NULL, NULL); g_signal_connect(G_OBJECT(open_btn), "clicked", G_CALLBACK(uri_opener_open_cb), NULL); g_signal_connect(G_OBJECT(close_btn), "clicked", G_CALLBACK(uri_opener_close_cb), NULL); urilist = uri_opener_list_view_create(); label = gtk_label_new(_("Please select the URL to open.")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox1), label, FALSE, TRUE, 0); scrolledwin = uri_opener_scrolled_win_create(); hbox_scroll = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox_scroll), scrolledwin, TRUE, TRUE, 0); select_all_btn = gtk_button_new_with_label(_("Select All")); g_signal_connect(G_OBJECT(select_all_btn), "clicked", G_CALLBACK(uri_opener_select_all_cb), NULL); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), select_all_btn, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(""), TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(scrolledwin), urilist); gtk_box_pack_start(GTK_BOX(vbox1), hbox_scroll, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0); gtk_widget_show_all(vbox1); gtk_container_add(GTK_CONTAINER (window), vbox1); opener.window = window; opener.hbox_scroll = hbox_scroll; opener.hbox1 = hbox1; opener.vbox1 = vbox1; opener.label = label; opener.urilist = urilist; opener.scrolledwin = scrolledwin; opener.open_btn = open_btn; opener.close_btn = close_btn; }
static void prefs_summary_open_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *btn_hbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *confirm_area; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *btn_vbox; GtkWidget *reg_btn; GtkWidget *del_btn; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *list_view_hbox; GtkWidget *list_view_hbox1; GtkWidget *list_view_hbox2; GtkWidget *list_view_scrolledwin; GtkWidget *possible_actions_list_view; GtkWidget *actions_list_view; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_summary_open"); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW (window), TRUE); vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); btn_hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (btn_hbox); gtk_box_pack_end (GTK_BOX (vbox), btn_hbox, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); gtk_widget_show (confirm_area); gtk_box_pack_end (GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default (ok_btn); gtk_window_set_title (GTK_WINDOW(window), _(" Selection when entering a folder")); MANAGE_WINDOW_SIGNALS_CONNECT(window); g_signal_connect (G_OBJECT(window), "delete_event", G_CALLBACK(prefs_summary_open_deleted), NULL); g_signal_connect (G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_summary_open_key_pressed), NULL); g_signal_connect (G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_summary_open_ok), NULL); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_summary_open_cancel), NULL); vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); /* display headers list */ list_view_hbox = gtk_hbox_new (FALSE, 10); gtk_widget_show (list_view_hbox); gtk_box_pack_start (GTK_BOX (vbox1), list_view_hbox, TRUE, TRUE, 0); list_view_hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (list_view_hbox1); gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox1, TRUE, TRUE, 0); list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (list_view_scrolledwin, 200, 210); gtk_widget_show (list_view_scrolledwin); gtk_box_pack_start (GTK_BOX (list_view_hbox1), list_view_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin), GTK_SHADOW_IN); possible_actions_list_view = prefs_summary_open_list_view_create (_("Possible selections")); gtk_widget_show (possible_actions_list_view); gtk_container_add(GTK_CONTAINER(list_view_scrolledwin), possible_actions_list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (list_view_hbox1), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_from_stock (GTK_STOCK_ADD); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_summary_open_register_cb), possible_actions_list_view); del_btn = gtk_button_new_from_stock (GTK_STOCK_REMOVE); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); /* actions list */ list_view_hbox2 = gtk_hbox_new (FALSE, 8); gtk_widget_show (list_view_hbox2); gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox2, TRUE, TRUE, 0); list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (list_view_scrolledwin, 200, 230); gtk_widget_show (list_view_scrolledwin); gtk_box_pack_start (GTK_BOX (list_view_hbox2), list_view_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin), GTK_SHADOW_IN); actions_list_view = prefs_summary_open_list_view_create (_("Selection on folder opening")); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_summary_open_delete_cb), actions_list_view); gtk_widget_show (actions_list_view); gtk_container_add (GTK_CONTAINER (list_view_scrolledwin), actions_list_view); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(actions_list_view), TRUE); g_signal_connect(G_OBJECT(actions_list_view), "drag_begin", G_CALLBACK(drag_begin), actions_list_view); g_signal_connect(G_OBJECT(actions_list_view), "drag_end", G_CALLBACK(drag_end), actions_list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (list_view_hbox2), btn_vbox, FALSE, FALSE, 0); up_btn = gtk_button_new_from_stock (GTK_STOCK_GO_UP); gtk_widget_show (up_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (up_btn), "clicked", G_CALLBACK (prefs_summary_open_up), NULL); down_btn = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN); gtk_widget_show (down_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (down_btn), "clicked", G_CALLBACK (prefs_summary_open_down), NULL); gtk_widget_show_all(window); summaryopen.window = window; summaryopen.ok_btn = ok_btn; summaryopen.cancel_btn = cancel_btn; summaryopen.possible_actions_list_view = possible_actions_list_view; summaryopen.actions_list_view = actions_list_view; }
static void alertpanel_create(const gchar *title, const gchar *message, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, AlertFocus focus, gboolean can_disable, GtkWidget *custom_widget, gint alert_type) { static PangoFontDescription *font_desc; GtkWidget *image; GtkWidget *label; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *disable_checkbtn; GtkWidget *confirm_area; GtkWidget *button1; GtkWidget *button2; GtkWidget *button3; GtkWidget *focusbutton; const gchar *label2; const gchar *label3; gchar *tmp = title?g_markup_printf_escaped("%s", title) :g_strdup(""); gchar *title_full = g_strdup_printf("<span weight=\"bold\" " "size=\"larger\">%s</span>", tmp); g_free(tmp); debug_print("Creating alert panel dialog...\n"); dialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(dialog), title); gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE); gtk_window_set_default_size(GTK_WINDOW(dialog), 375, 100); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(alertpanel_deleted), (gpointer)G_ALERTCANCEL); g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(alertpanel_close), (gpointer)G_ALERTCANCEL); /* for title icon, label and message */ hbox = gtk_hbox_new(FALSE, 12); gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, FALSE, FALSE, 0); /* title icon */ switch (alert_type) { case ALERT_QUESTION: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); break; case ALERT_WARNING: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); break; case ALERT_ERROR: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); break; case ALERT_NOTICE: default: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); break; } gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); label = gtk_label_new(title_full); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_use_markup(GTK_LABEL (label), TRUE); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); if (!font_desc) { gint size; size = pango_font_description_get_size (gtk_widget_get_style(label)->font_desc); font_desc = pango_font_description_new(); pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); } if (font_desc) gtk_widget_modify_font(label, font_desc); g_free(title_full); label = gtk_label_new(message); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_selectable(GTK_LABEL(label), TRUE); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); gtk_widget_set_can_focus(label, FALSE); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); /* Claws: custom widget */ if (custom_widget) { gtk_box_pack_start(GTK_BOX(vbox), custom_widget, FALSE, FALSE, 0); } if (can_disable) { hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX( gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, FALSE, FALSE, 0); disable_checkbtn = gtk_check_button_new_with_label (_("Show this message next time")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_checkbtn), TRUE); gtk_box_pack_start(GTK_BOX(hbox), disable_checkbtn, FALSE, FALSE, 12); g_signal_connect(G_OBJECT(disable_checkbtn), "toggled", G_CALLBACK(alertpanel_button_toggled), GUINT_TO_POINTER(G_ALERTDISABLE)); } /* for button(s) */ if (!button1_label) button1_label = GTK_STOCK_OK; label2 = button2_label; label3 = button3_label; gtkut_stock_button_set_create(&confirm_area, &button1, button1_label, button2_label ? &button2 : NULL, label2, button3_label ? &button3 : NULL, label3); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), confirm_area, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5); /* Set focus on correct button as requested. */ focusbutton = button1; switch (focus) { case ALERTFOCUS_SECOND: if (button2_label != NULL) focusbutton = button2; break; case ALERTFOCUS_THIRD: if (button3_label != NULL) focusbutton = button3; break; case ALERTFOCUS_FIRST: default: focusbutton = button1; break; } gtk_widget_grab_default(focusbutton); gtk_widget_grab_focus(focusbutton); g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(alertpanel_button_clicked), GUINT_TO_POINTER(G_ALERTDEFAULT)); if (button2_label) g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(alertpanel_button_clicked), GUINT_TO_POINTER(G_ALERTALTERNATE)); if (button3_label) g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(alertpanel_button_clicked), GUINT_TO_POINTER(G_ALERTOTHER)); gtk_widget_show_all(dialog); }
static void imp_ldif_dialog_create() { GtkWidget *window; GtkWidget *vbox; GtkWidget *vnbox; GtkWidget *notebook; GtkWidget *hbbox; GtkWidget *btnPrev; GtkWidget *btnNext; GtkWidget *btnCancel; GtkWidget *hsbox; GtkWidget *statusbar; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request(window, IMPORTLDIF_WIDTH, IMPORTLDIF_HEIGHT ); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title( GTK_WINDOW(window), _("Import LDIF file into Address Book") ); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(window), TRUE); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(imp_ldif_delete_event), NULL); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(imp_ldif_key_pressed), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(window); vbox = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(window), vbox); vnbox = gtk_vbox_new(FALSE, 4); gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4); gtk_widget_show(vnbox); gtk_box_pack_start(GTK_BOX(vbox), vnbox, TRUE, TRUE, 0); /* Notebook */ notebook = gtk_notebook_new(); gtk_notebook_set_show_tabs( GTK_NOTEBOOK(notebook), FALSE ); gtk_widget_show(notebook); gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(notebook), 6); /* Status line */ hsbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, 0); statusbar = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, 0); /* Button panel */ gtkut_stock_button_set_create(&hbbox, &btnNext, _("Next"), &btnPrev, _("Prev"), &btnCancel, GTK_STOCK_CANCEL); gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(hbbox), btnCancel, TRUE); gtkut_box_set_reverse_order(GTK_BOX(hbbox), FALSE); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2); gtk_widget_grab_default(btnNext); /* Button handlers */ g_signal_connect(G_OBJECT(btnPrev), "clicked", G_CALLBACK(imp_ldif_prev), NULL); g_signal_connect(G_OBJECT(btnNext), "clicked", G_CALLBACK(imp_ldif_next), NULL); g_signal_connect(G_OBJECT(btnCancel), "clicked", G_CALLBACK(imp_ldif_cancel), NULL); gtk_widget_show_all(vbox); impldif_dlg.window = window; impldif_dlg.notebook = notebook; impldif_dlg.btnPrev = btnPrev; impldif_dlg.btnNext = btnNext; impldif_dlg.btnCancel = btnCancel; impldif_dlg.statusbar = statusbar; impldif_dlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Import LDIF Dialog" ); }
static void addressbook_edit_book_create( gboolean *cancelled ) { GtkWidget *window; GtkWidget *vbox; GtkWidget *table; GtkWidget *label; GtkWidget *name_entry; GtkWidget *file_label; GtkWidget *hbbox; GtkWidget *hsep; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *check_btn; /* GtkWidget *file_btn; */ GtkWidget *statusbar; GtkWidget *hsbox; gint top; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "editbook"); gtk_widget_set_size_request(window, 450, -1); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title(GTK_WINDOW(window), _("Edit Addressbook")); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(edit_book_delete_event), cancelled); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(edit_book_key_pressed), cancelled); 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(2, 3, 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(_("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); name_entry = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), name_entry, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); check_btn = gtk_button_new_with_label( _(" Check File ")); gtk_table_attach(GTK_TABLE(table), check_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0); /* Second row */ top = 1; label = gtk_label_new(_("File")); 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); file_label = gtk_label_new( "" ); gtk_misc_set_alignment(GTK_MISC(file_label), 0, 0.5); gtk_table_attach(GTK_TABLE(table), file_label, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); /* file_btn = gtk_button_new_with_label( _(" ... ")); */ /* gtk_table_attach(GTK_TABLE(table), file_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0); */ /* 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, &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); hsep = gtk_hseparator_new(); gtk_box_pack_end(GTK_BOX(vbox), hsep, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(name_entry), "focus_in_event", G_CALLBACK(edit_book_name_focus), NULL ); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(edit_book_ok), cancelled); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(edit_book_cancel), cancelled); /* g_signal_connect(G_OBJECT(file_btn), "clicked", */ /* G_CALLBACK(edit_book_file_select), NULL); */ g_signal_connect(G_OBJECT(check_btn), "clicked", G_CALLBACK(edit_book_file_check), NULL); gtk_widget_show_all(vbox); addrbookedit_dlg.window = window; addrbookedit_dlg.name_entry = name_entry; addrbookedit_dlg.file_label = file_label; addrbookedit_dlg.ok_btn = ok_btn; addrbookedit_dlg.cancel_btn = cancel_btn; addrbookedit_dlg.check_btn = check_btn; /* addrbookedit_dlg.file_btn = file_btn; */ addrbookedit_dlg.statusbar = statusbar; addrbookedit_dlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit Addressbook Dialog" ); }
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); }
void pluginwindow_create() { PluginWindow *pluginwindow; GtkWidget *window; GtkWidget *vbox1; GtkWidget *hbox2; GtkWidget *scrolledwindow2; GtkWidget *plugin_list_view; GtkWidget *vbox2; GtkWidget *frame2; GtkWidget *label13; GtkWidget *scrolledwindow3; GtkWidget *plugin_desc; GtkWidget *hbuttonbox1; GtkWidget *hbuttonbox2; GtkWidget *help_btn; GtkWidget *load_btn; GtkWidget *unload_btn; GtkWidget *close_btn; gchar *markup; GtkWidget *desc_lbl; GtkWidget *vbox3; GtkWidget *hbox_info; static GdkGeometry geometry; debug_print("Creating plugins window...\n"); pluginwindow = g_new0(PluginWindow, 1); window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "pluginwindow"); gtk_container_set_border_width(GTK_CONTAINER(window), 8); gtk_window_set_title(GTK_WINDOW(window), _("Plugins")); gtk_window_set_modal(GTK_WINDOW(window), TRUE); manage_window_set_transient(GTK_WINDOW(window)); vbox1 = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(window), vbox1); gtk_box_set_homogeneous(GTK_BOX(vbox1), FALSE); gtk_widget_realize(window); hbox2 = gtk_hbox_new(FALSE, 8); gtk_widget_show(hbox2); gtk_box_pack_start(GTK_BOX(vbox1), hbox2, TRUE, TRUE, 0); vbox3 = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox3); gtk_box_pack_start(GTK_BOX(hbox2), vbox3, FALSE, FALSE, 0); scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow2); gtk_box_pack_start(GTK_BOX(vbox3), scrolledwindow2, TRUE, TRUE, 0); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); plugin_list_view = pluginwindow_list_view_create(pluginwindow); gtk_widget_show(plugin_list_view); gtk_container_add(GTK_CONTAINER(scrolledwindow2), plugin_list_view); gtk_widget_grab_focus(GTK_WIDGET(plugin_list_view)); gtkut_stock_button_set_create(&hbuttonbox1, &load_btn, _("Load..."), &unload_btn, _("Unload"), NULL, NULL); gtk_widget_show(hbuttonbox1); gtk_box_pack_start(GTK_BOX(vbox3), hbuttonbox1, FALSE, FALSE, 0); vbox2 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox2); gtk_box_pack_start(GTK_BOX(hbox2), vbox2, TRUE, TRUE, 0); frame2 = gtk_frame_new(NULL); gtk_widget_show(frame2); gtk_box_pack_start(GTK_BOX(vbox2), frame2, FALSE, TRUE, 0); label13 = gtk_label_new(_("Description")); gtk_widget_show(label13); gtk_container_add(GTK_CONTAINER(frame2), label13); gtk_misc_set_alignment(GTK_MISC(label13), 0, 0.5); gtk_misc_set_padding(GTK_MISC(label13), 2, 2); scrolledwindow3 = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow3); gtk_box_pack_start(GTK_BOX(vbox2), scrolledwindow3, TRUE, TRUE, 0); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow3), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); plugin_desc = gtk_text_view_new(); gtk_widget_show(plugin_desc); gtk_container_add(GTK_CONTAINER(scrolledwindow3), plugin_desc); hbox_info = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox_info); desc_lbl = gtk_label_new(""); markup = g_markup_printf_escaped(_("For more information about plugins see the " "<a href=\"%s\"><span underline=\"none\">Claws Mail website</span></a>."),PLUGINS_URI); gtk_label_set_markup(GTK_LABEL(desc_lbl), markup); g_free(markup); gtk_misc_set_alignment(GTK_MISC(desc_lbl), 0, 0.5); gtk_widget_show(desc_lbl); gtk_box_pack_start(GTK_BOX(hbox_info), desc_lbl, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox_info), gtk_label_new(""), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox_info, FALSE, FALSE, 0); gtkut_stock_button_set_create_with_help(&hbuttonbox2, &help_btn, &close_btn, GTK_STOCK_CLOSE, NULL, NULL, NULL, NULL); gtk_box_set_spacing(GTK_BOX(hbuttonbox2), 6); gtk_widget_show(hbuttonbox2); gtk_box_pack_end(GTK_BOX(vbox1), hbuttonbox2, FALSE, FALSE, 0); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(plugin_desc), GTK_WRAP_WORD); gtk_widget_set_sensitive(GTK_WIDGET(unload_btn), FALSE); g_signal_connect(G_OBJECT(help_btn), "clicked", G_CALLBACK(manual_open_with_anchor_cb), MANUAL_ANCHOR_PLUGINS); g_signal_connect(G_OBJECT(load_btn), "clicked", G_CALLBACK(load_cb), pluginwindow); g_signal_connect(G_OBJECT(unload_btn), "clicked", G_CALLBACK(unload_cb), pluginwindow); g_signal_connect(G_OBJECT(close_btn), "clicked", G_CALLBACK(close_cb), pluginwindow); g_signal_connect(G_OBJECT(window), "size_allocate", G_CALLBACK(pluginwindow_size_allocate_cb), NULL); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(pluginwindow_key_pressed), pluginwindow); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(pluginwindow_delete_cb), pluginwindow); MANAGE_WINDOW_SIGNALS_CONNECT(window); CLAWS_SET_TIP(load_btn, _("Click here to load one or more plugins")); CLAWS_SET_TIP(unload_btn, _("Unload the selected plugin")); pluginwindow->window = window; pluginwindow->plugin_list_view = plugin_list_view; pluginwindow->plugin_desc = plugin_desc; pluginwindow->unload_btn = unload_btn; pluginwindow->selected_plugin = NULL; set_plugin_list(pluginwindow); inc_lock(); if (!geometry.min_height) { geometry.min_width = -1; geometry.min_height = 300; } gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_window_set_default_size(GTK_WINDOW(window), prefs_common.pluginswin_width, prefs_common.pluginswin_height); gtk_widget_show(window); }
static void foldersel_create(void) { GtkWidget *vbox; GtkWidget *scrolledwin; GtkWidget *confirm_area; GtkTreeViewColumn *column; GtkCellRenderer *renderer; GtkTreeSelection *selection; static GdkGeometry geometry; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "foldersel"); gtk_window_set_title(GTK_WINDOW(window), _("Select folder")); gtk_container_set_border_width(GTK_CONTAINER(window), 4); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW(window), TRUE); gtk_widget_realize(window); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(key_pressed), NULL); g_signal_connect(G_OBJECT(window), "size_allocate", G_CALLBACK(foldersel_size_allocate_cb), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(window); vbox = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(window), vbox); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin), GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0); tree_store = gtk_tree_store_new(N_FOLDERSEL_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, GDK_TYPE_COLOR, G_TYPE_INT); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(tree_store), FOLDERSEL_FOLDERNAME, foldersel_folder_name_compare, NULL, NULL); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(tree_store)); g_object_unref(G_OBJECT(tree_store)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), prefs_common.use_stripes_everywhere); gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(treeview), FALSE); gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), FOLDERSEL_FOLDERNAME); if (prefs_common.folder_search_wildcard) gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(treeview), foldersel_search_name_func, NULL, NULL); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); gtk_tree_selection_set_select_function(selection, foldersel_selected, NULL, NULL); g_signal_connect(G_OBJECT(treeview), "row-activated", G_CALLBACK(foldersel_tree_activated), NULL); gtk_container_add(GTK_CONTAINER(scrolledwin), treeview); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_spacing(column, 2); renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_attributes (column, renderer, "pixbuf", FOLDERSEL_PIXBUF, "pixbuf-expander-open", FOLDERSEL_PIXBUF_OPEN, "pixbuf-expander-closed", FOLDERSEL_PIXBUF, NULL); /* create text renderer */ renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_set_attributes (column, renderer, "text", FOLDERSEL_FOLDERNAME, "foreground-gdk", FOLDERSEL_FOREGROUND, "weight", FOLDERSEL_BOLD, NULL); g_object_set(G_OBJECT(renderer), "weight", PANGO_WEIGHT_BOLD, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); entry = gtk_entry_new(); gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE); gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(foldersel_entry_activated), NULL); gtkut_stock_button_set_create(&confirm_area, &new_button, GTK_STOCK_NEW, &cancel_button, GTK_STOCK_CANCEL, &ok_button, GTK_STOCK_OK); gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default(ok_button); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(foldersel_ok), NULL); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(foldersel_cancel), NULL); g_signal_connect(G_OBJECT(new_button), "clicked", G_CALLBACK(foldersel_new_folder), NULL); if (!geometry.min_height) { geometry.min_width = 300; geometry.min_height = 360; } gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_widget_set_size_request(window, prefs_common.folderselwin_width, prefs_common.folderselwin_height); gtk_widget_show_all(vbox); }
static GtkWidget *date_format_create(GtkButton *button, void *data) { static GtkWidget *datefmt_win = NULL; GtkWidget *vbox1; GtkWidget *scrolledwindow1; GtkWidget *datefmt_list_view; GtkWidget *table; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *confirm_area; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *datefmt_entry; GtkListStore *store; struct { gchar *fmt; gchar *txt; } time_format[] = { { "%a", NULL }, { "%A", NULL }, { "%b", NULL }, { "%B", NULL }, { "%c", NULL }, { "%C", NULL }, { "%d", NULL }, { "%H", NULL }, { "%I", NULL }, { "%j", NULL }, { "%m", NULL }, { "%M", NULL }, { "%p", NULL }, { "%S", NULL }, { "%w", NULL }, { "%x", NULL }, { "%y", NULL }, { "%Y", NULL }, { "%Z", NULL } }; gint i; const gint TIME_FORMAT_ELEMS = sizeof time_format / sizeof time_format[0]; GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkTreeSelection *selection; time_format[0].txt = _("the abbreviated weekday name"); time_format[1].txt = _("the full weekday name"); time_format[2].txt = _("the abbreviated month name"); time_format[3].txt = _("the full month name"); time_format[4].txt = _("the preferred date and time for the current locale"); time_format[5].txt = _("the century number (year/100)"); time_format[6].txt = _("the day of the month as a decimal number"); time_format[7].txt = _("the hour as a decimal number using a 24-hour clock"); time_format[8].txt = _("the hour as a decimal number using a 12-hour clock"); time_format[9].txt = _("the day of the year as a decimal number"); time_format[10].txt = _("the month as a decimal number"); time_format[11].txt = _("the minute as a decimal number"); time_format[12].txt = _("either AM or PM"); time_format[13].txt = _("the second as a decimal number"); time_format[14].txt = _("the day of the week as a decimal number"); time_format[15].txt = _("the preferred date for the current locale"); time_format[16].txt = _("the last two digits of a year"); time_format[17].txt = _("the year as a decimal number"); time_format[18].txt = _("the time zone or name or abbreviation"); if (datefmt_win) return datefmt_win; store = gtk_list_store_new(N_DATEFMT_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, -1); for (i = 0; i < TIME_FORMAT_ELEMS; i++) { GtkTreeIter iter; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, DATEFMT_FMT, time_format[i].fmt, DATEFMT_TXT, time_format[i].txt, -1); } datefmt_win = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_summaries"); gtk_container_set_border_width(GTK_CONTAINER(datefmt_win), 8); gtk_window_set_title(GTK_WINDOW(datefmt_win), _("Date format")); gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER); gtk_widget_set_size_request(datefmt_win, 440, 280); vbox1 = gtk_vbox_new(FALSE, 10); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(datefmt_win), vbox1); scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show(scrolledwindow1); gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0); datefmt_list_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(datefmt_list_view), prefs_common.use_stripes_everywhere); gtk_widget_show(datefmt_list_view); gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_list_view); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes (_("Specifier"), renderer, "text", DATEFMT_FMT, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes (_("Description"), renderer, "text", DATEFMT_TXT, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view), column); /* gtk_cmclist_set_column_width(GTK_CMCLIST(datefmt_clist), 0, 80); */ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(datefmt_list_view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); g_signal_connect(G_OBJECT(datefmt_list_view), "row_activated", G_CALLBACK(date_format_select_row), datefmt_win); table = gtk_table_new(2, 2, FALSE); gtk_widget_show(table); gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0); gtk_table_set_row_spacings(GTK_TABLE(table), 4); gtk_table_set_col_spacings(GTK_TABLE(table), 8); label1 = gtk_label_new(_("Date format")); gtk_widget_show(label1); gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); datefmt_entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(datefmt_entry), 256); gtk_widget_show(datefmt_entry); gtk_table_attach(GTK_TABLE(table), datefmt_entry, 1, 2, 0, 1, (GTK_EXPAND | GTK_FILL), 0, 0, 0); /* we need the "sample" entry box; add it as data so callbacks can * get the entry box */ g_object_set_data(G_OBJECT(datefmt_win), "datefmt_sample", datefmt_entry); label2 = gtk_label_new(_("Example")); gtk_widget_show(label2); gtk_table_attach(GTK_TABLE(table), label2, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); label3 = gtk_label_new(""); gtk_widget_show(label3); gtk_table_attach(GTK_TABLE(table), label3, 1, 2, 1, 2, (GTK_EXPAND | GTK_FILL), 0, 0, 0); gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); gtkut_stock_button_set_create(&confirm_area, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); gtk_box_pack_start(GTK_BOX(vbox1), confirm_area, FALSE, FALSE, 0); gtk_widget_show(confirm_area); gtk_widget_grab_default(ok_btn); /* set the current format */ gtk_entry_set_text(GTK_ENTRY(datefmt_entry), prefs_common.date_format); date_format_entry_on_change(GTK_EDITABLE(datefmt_entry), GTK_LABEL(label3)); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(date_format_ok_btn_clicked), &datefmt_win); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(date_format_cancel_btn_clicked), &datefmt_win); g_signal_connect(G_OBJECT(datefmt_win), "key_press_event", G_CALLBACK(date_format_key_pressed), &datefmt_win); g_signal_connect(G_OBJECT(datefmt_win), "delete_event", G_CALLBACK(date_format_on_delete), &datefmt_win); g_signal_connect(G_OBJECT(datefmt_entry), "changed", G_CALLBACK(date_format_entry_on_change), label3); gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER); gtk_widget_show(datefmt_win); manage_window_set_transient(GTK_WINDOW(datefmt_win)); gtk_window_set_modal(GTK_WINDOW(datefmt_win), TRUE); gtk_widget_grab_focus(ok_btn); return datefmt_win; }
static void alertpanel_create(const gchar *title, const gchar *message, AlertType type, AlertValue default_value, gboolean can_disable, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label) { static PangoFontDescription *font_desc; GtkWidget *image; GtkWidget *label; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *disable_chkbtn; GtkWidget *confirm_area; GtkWidget *button1; GtkWidget *button2; GtkWidget *button3; const gchar *label2; const gchar *label3; debug_print(_("Creating alert panel dialog...\n")); dialog = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(dialog), title); gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, FALSE); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); manage_window_set_transient(GTK_WINDOW(dialog)); gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_widget_realize(dialog); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(alertpanel_deleted), (gpointer)G_ALERTCANCEL); g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(alertpanel_close), (gpointer)G_ALERTCANCEL); g_signal_connect(G_OBJECT(dialog), "focus_out_event", G_CALLBACK(alertpanel_focus_out), NULL); /* for title icon, label and message */ hbox = gtk_hbox_new(FALSE, 12); gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); /* title icon */ switch (type) { case ALERT_QUESTION: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); break; case ALERT_WARNING: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); break; case ALERT_ERROR: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); break; case ALERT_NOTICE: default: image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); break; } gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); /* for title and message */ vbox = gtk_vbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); label = gtk_label_new(title); gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); if (!font_desc) { gint size; size = pango_font_description_get_size (label->style->font_desc); font_desc = pango_font_description_new(); pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); } if (font_desc) gtk_widget_modify_font(label, font_desc); /* message label */ label = gtk_label_new(message); gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_selectable(GTK_LABEL(label), TRUE); GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS); #ifdef G_OS_WIN32 { GtkStyle *style; style = gtk_widget_get_style(dialog); gtk_widget_modify_base(label, GTK_STATE_ACTIVE, &style->base[GTK_STATE_SELECTED]); gtk_widget_modify_text(label, GTK_STATE_ACTIVE, &style->text[GTK_STATE_SELECTED]); } #endif if (can_disable) { hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); disable_chkbtn = gtk_check_button_new_with_label (_("Show this message next time")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_chkbtn), TRUE); gtk_box_pack_start(GTK_BOX(hbox), disable_chkbtn, FALSE, FALSE, 12); g_signal_connect(G_OBJECT(disable_chkbtn), "toggled", G_CALLBACK(alertpanel_button_toggled), GUINT_TO_POINTER(G_ALERTDISABLE)); } /* for button(s) */ if (!button1_label) button1_label = GTK_STOCK_OK; label2 = button2_label; label3 = button3_label; if (label2 && *label2 == '+') label2++; if (label3 && *label3 == '+') label3++; gtkut_stock_button_set_create(&confirm_area, &button1, button1_label, button2_label ? &button2 : NULL, label2, button3_label ? &button3 : NULL, label3); gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->action_area), confirm_area, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5); gtk_widget_grab_default(button1); gtk_widget_grab_focus(button1); if (button2_label && (default_value == G_ALERTALTERNATE || *button2_label == '+')) { gtk_widget_grab_default(button2); gtk_widget_grab_focus(button2); } if (button3_label && (default_value == G_ALERTOTHER || *button3_label == '+')) { gtk_widget_grab_default(button3); gtk_widget_grab_focus(button3); } g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(alertpanel_button_clicked), GUINT_TO_POINTER(G_ALERTDEFAULT)); if (button2_label) g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(alertpanel_button_clicked), GUINT_TO_POINTER(G_ALERTALTERNATE)); if (button3_label) g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(alertpanel_button_clicked), GUINT_TO_POINTER(G_ALERTOTHER)); gtk_widget_show_all(dialog); }
static gchar* passphrase_mbox(const gchar *uid_hint, const gchar *pass_hint, gint prev_bad) { gchar *the_passphrase = NULL; GtkWidget *vbox; GtkWidget *confirm_box; GtkWidget *window; GtkWidget *pass_entry; GtkWidget *ok_button; GtkWidget *cancel_button; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), _("Passphrase")); gtk_widget_set_size_request(window, 450, -1); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(window), TRUE); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(passphrase_deleted), NULL); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(passphrase_key_pressed), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(window); manage_window_set_transient(GTK_WINDOW(window)); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); if (uid_hint || pass_hint) { GtkWidget *label; label = create_description (uid_hint, pass_hint, prev_bad); gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 0); } pass_entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(vbox), pass_entry, FALSE, FALSE, 0); gtk_entry_set_visibility(GTK_ENTRY(pass_entry), FALSE); gtk_widget_grab_focus(pass_entry); gtkut_stock_button_set_create(&confirm_box, &ok_button, GTK_STOCK_OK, &cancel_button, GTK_STOCK_CANCEL, NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), confirm_box, FALSE, FALSE, 0); gtk_widget_grab_default(ok_button); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(passphrase_ok_cb), NULL); g_signal_connect(G_OBJECT(pass_entry), "activate", G_CALLBACK(passphrase_ok_cb), NULL); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(passphrase_cancel_cb), NULL); gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER); if (grab_all) gtk_window_set_policy (GTK_WINDOW(window), FALSE, FALSE, TRUE); gtk_widget_show_all(window); if (grab_all) { /* make sure that window is viewable * FIXME: this is still not enough */ gtk_widget_show_now(window); gdk_flush(); #ifdef GDK_WINDOWING_X11 gdk_x11_display_grab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ if (gdk_pointer_grab(window->window, TRUE, 0, window->window, NULL, GDK_CURRENT_TIME)) { #ifdef GDK_WINDOWING_X11 gdk_x11_display_ungrab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ g_warning("OOPS: Could not grab mouse\n"); gtk_widget_destroy(window); return NULL; } if (gdk_keyboard_grab(window->window, FALSE, GDK_CURRENT_TIME)) { gdk_display_pointer_ungrab(gdk_display_get_default(), GDK_CURRENT_TIME); #ifdef GDK_WINDOWING_X11 gdk_x11_display_ungrab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ g_warning("OOPS: Could not grab keyboard\n"); gtk_widget_destroy(window); return NULL; } } gtk_main(); if (grab_all) { gdk_display_keyboard_ungrab(gdk_display_get_default(), GDK_CURRENT_TIME); gdk_display_pointer_ungrab(gdk_display_get_default(), GDK_CURRENT_TIME); #ifdef GDK_WINDOWING_X11 gdk_x11_display_ungrab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ gdk_flush(); } manage_window_focus_out(window, NULL, NULL); if (pass_ack) { const gchar *entry_text; entry_text = gtk_entry_get_text(GTK_ENTRY(pass_entry)); the_passphrase = g_locale_from_utf8(entry_text, -1, NULL, NULL, NULL); if (!the_passphrase) the_passphrase = g_strdup(entry_text); } gtk_widget_destroy(window); return the_passphrase; }
static void prefs_display_header_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *btn_hbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *confirm_area; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *hdr_label; GtkWidget *hdr_combo; GtkWidget *btn_vbox; GtkWidget *reg_btn; GtkWidget *del_btn; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *list_view_hbox; GtkWidget *list_view_hbox1; GtkWidget *list_view_hbox2; GtkWidget *list_view_scrolledwin; GtkWidget *headers_list_view; GtkWidget *hidden_headers_list_view; GtkWidget *checkbtn_other_headers; gint i; debug_print("Creating display header setting window...\n"); window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_display_header"); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_resizable(GTK_WINDOW (window), TRUE); vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); btn_hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (btn_hbox); gtk_box_pack_end (GTK_BOX (vbox), btn_hbox, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); gtk_widget_show (confirm_area); gtk_box_pack_end (GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default (ok_btn); gtk_window_set_title (GTK_WINDOW(window), _("Displayed header configuration")); MANAGE_WINDOW_SIGNALS_CONNECT(window); g_signal_connect (G_OBJECT(window), "delete_event", G_CALLBACK(prefs_display_header_deleted), NULL); g_signal_connect (G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_display_header_key_pressed), NULL); g_signal_connect (G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_display_header_ok), NULL); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_display_header_cancel), NULL); vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); hdr_label = gtk_label_new (_("Header name")); gtk_widget_show (hdr_label); gtk_box_pack_start (GTK_BOX (hbox1), hdr_label, FALSE, FALSE, 0); hdr_combo = gtk_combo_box_text_new_with_entry(); for(i=0; i < 9 ; i++) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (hdr_combo), (*defaults[i] == '-') ? defaults[i]+1 : defaults[i]); gtk_combo_box_set_active(GTK_COMBO_BOX(hdr_combo), 0); gtk_widget_show (hdr_combo); gtk_box_pack_start (GTK_BOX (hbox1), hdr_combo, TRUE, TRUE, 0); gtk_widget_set_size_request (hdr_combo, 150, -1); list_view_hbox = gtk_hbox_new (FALSE, 10); gtk_widget_show (list_view_hbox); gtk_box_pack_start (GTK_BOX (vbox1), list_view_hbox, TRUE, TRUE, 0); /* display headers list */ list_view_hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (list_view_hbox1); gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox1, TRUE, TRUE, 0); list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (list_view_scrolledwin, 200, 210); gtk_widget_show (list_view_scrolledwin); gtk_box_pack_start (GTK_BOX (list_view_hbox1), list_view_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin), GTK_SHADOW_IN); headers_list_view = prefs_display_header_list_view_create (_("Displayed Headers")); gtk_widget_show (headers_list_view); gtk_container_add(GTK_CONTAINER(list_view_scrolledwin), headers_list_view); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(headers_list_view), TRUE); g_signal_connect(G_OBJECT(headers_list_view), "drag_end", G_CALLBACK(drag_end), headers_list_view); /* connect rows change for this list view's model */ g_signal_connect(G_OBJECT(gtk_tree_view_get_model(GTK_TREE_VIEW(headers_list_view))), "rows-reordered", G_CALLBACK(headers_list_model_rows_reordered), headers_list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (list_view_hbox1), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_from_stock (GTK_STOCK_ADD); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER(FALSE)); del_btn = gtk_button_new_from_stock (GTK_STOCK_REMOVE); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), headers_list_view); up_btn = gtk_button_new_from_stock (GTK_STOCK_GO_UP); gtk_widget_show (up_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (up_btn), "clicked", G_CALLBACK (prefs_display_header_up), NULL); down_btn = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN); gtk_widget_show (down_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (down_btn), "clicked", G_CALLBACK (prefs_display_header_down), NULL); /* hidden headers list */ list_view_hbox2 = gtk_hbox_new (FALSE, 8); gtk_widget_show (list_view_hbox2); gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox2, TRUE, TRUE, 0); list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (list_view_scrolledwin, 200, 210); gtk_widget_show (list_view_scrolledwin); gtk_box_pack_start (GTK_BOX (list_view_hbox2), list_view_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin), GTK_SHADOW_IN); hidden_headers_list_view = prefs_display_header_list_view_create (_("Hidden headers")); gtk_widget_show (hidden_headers_list_view); gtk_container_add (GTK_CONTAINER (list_view_scrolledwin), hidden_headers_list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (list_view_hbox2), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_from_stock (GTK_STOCK_ADD); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER(TRUE)); del_btn = gtk_button_new_from_stock (GTK_STOCK_DELETE); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), hidden_headers_list_view); PACK_CHECK_BUTTON (vbox, checkbtn_other_headers, _("Show all unspecified headers")); SET_TOGGLE_SENSITIVITY (checkbtn_other_headers, list_view_hbox2); gtk_widget_show_all(window); dispheader.window = window; dispheader.ok_btn = ok_btn; dispheader.cancel_btn = cancel_btn; dispheader.hdr_combo = hdr_combo; dispheader.headers_list_view = headers_list_view; dispheader.hidden_headers_list_view = hidden_headers_list_view; dispheader.other_headers = checkbtn_other_headers; }
void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer data, GDestroyNotify func, gint *save_width, gint *save_height, gboolean preload_pages, PrefsOpenCallbackFunc open_cb, PrefsApplyCallbackFunc apply_cb, PrefsCloseCallbackFunc close_cb) { PrefsWindow *prefswindow; gint x = gdk_screen_width(); gint y = gdk_screen_height(); static GdkGeometry geometry; GtkAdjustment *adj; prefswindow = g_new0(PrefsWindow, 1); prefswindow->data = data; prefswindow->func = func; prefswindow->prefs_pages = g_slist_copy(prefs_pages); prefswindow->save_width = save_width; prefswindow->save_height = save_height; prefswindow->open_cb = open_cb; prefswindow->apply_cb = apply_cb; prefswindow->close_cb = close_cb; prefswindow->dialog_response = PREFSWINDOW_RESPONSE_CANCEL; prefswindow->window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefswindow"); gtk_window_set_title(GTK_WINDOW(prefswindow->window), title); gtk_window_set_position (GTK_WINDOW(prefswindow->window), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (prefswindow->window), TRUE); gtk_window_set_resizable (GTK_WINDOW(prefswindow->window), TRUE); gtk_window_set_transient_for (GTK_WINDOW(prefswindow->window), GTK_WINDOW(mainwindow_get_mainwindow()->window)); gtk_container_set_border_width(GTK_CONTAINER(prefswindow->window), 4); prefswindow->vbox = gtk_vbox_new(FALSE, 6); gtk_widget_show(prefswindow->vbox); prefswindow->paned = gtk_hpaned_new(); gtk_widget_show(prefswindow->paned); gtk_container_add(GTK_CONTAINER(prefswindow->window), prefswindow->vbox); gtk_box_pack_start(GTK_BOX(prefswindow->vbox), prefswindow->paned, TRUE, TRUE, 0); prefswindow->scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(prefswindow->scrolledwindow1); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(prefswindow->scrolledwindow1), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(prefswindow->scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_paned_add1(GTK_PANED(prefswindow->paned), prefswindow->scrolledwindow1); prefswindow->tree_view = prefswindow_tree_view_create(prefswindow); gtk_widget_show(prefswindow->tree_view); gtk_container_add(GTK_CONTAINER(prefswindow->scrolledwindow1), prefswindow->tree_view); prefswindow->vbox2 = gtk_vbox_new(FALSE, 2); gtk_widget_show(prefswindow->vbox2); gtk_paned_add2(GTK_PANED(prefswindow->paned), prefswindow->vbox2); prefswindow->table2 = gtk_table_new(1, 2, FALSE); gtk_widget_show(prefswindow->table2); gtk_container_add(GTK_CONTAINER(prefswindow->vbox2), prefswindow->table2); prefswindow->labelframe = gtk_frame_new(NULL); gtk_widget_show(prefswindow->labelframe); gtk_frame_set_shadow_type(GTK_FRAME(prefswindow->labelframe), GTK_SHADOW_OUT); gtk_table_attach(GTK_TABLE(prefswindow->table2), prefswindow->labelframe, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 1, 1); prefswindow->pagelabel = gtk_label_new(""); gtk_widget_show(prefswindow->pagelabel); gtk_label_set_justify(GTK_LABEL(prefswindow->pagelabel), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(prefswindow->pagelabel), 0, 0.0); gtk_container_add(GTK_CONTAINER(prefswindow->labelframe), prefswindow->pagelabel); prefswindow->notebook = gtk_notebook_new(); gtk_widget_show(prefswindow->notebook); gtk_notebook_set_scrollable(GTK_NOTEBOOK(prefswindow->notebook), TRUE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(prefswindow->notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(prefswindow->notebook), FALSE); gtk_table_attach(GTK_TABLE(prefswindow->table2), prefswindow->notebook, 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 4); prefswindow->empty_page = gtk_label_new(""); gtk_widget_show(prefswindow->empty_page); gtk_container_add(GTK_CONTAINER(prefswindow->notebook), prefswindow->empty_page); prefswindow_build_tree(prefswindow->tree_view, prefs_pages, prefswindow, preload_pages); if (open_cb) open_cb(prefswindow); gtk_widget_grab_focus(prefswindow->tree_view); #ifndef GENERIC_UMPC gtkut_stock_button_set_create(&prefswindow->confirm_area, &prefswindow->apply_btn, GTK_STOCK_APPLY, &prefswindow->cancel_btn, GTK_STOCK_CANCEL, &prefswindow->ok_btn, GTK_STOCK_OK); #else gtkut_stock_button_set_create(&prefswindow->confirm_area, &prefswindow->apply_btn, GTK_STOCK_APPLY, &prefswindow->ok_btn, GTK_STOCK_CLOSE, NULL, NULL); #endif gtk_widget_show_all(prefswindow->confirm_area); gtk_widget_show(prefswindow->vbox); gtk_widget_show(prefswindow->scrolledwindow1); gtk_box_pack_start(GTK_BOX(prefswindow->vbox), prefswindow->confirm_area, FALSE, FALSE, 0); #ifndef GENERIC_UMPC g_signal_connect(G_OBJECT(prefswindow->ok_btn), "clicked", G_CALLBACK(ok_button_clicked), prefswindow); g_signal_connect(G_OBJECT(prefswindow->cancel_btn), "clicked", G_CALLBACK(cancel_button_clicked), prefswindow); g_signal_connect(G_OBJECT(prefswindow->apply_btn), "clicked", G_CALLBACK(apply_button_clicked), prefswindow); #else g_signal_connect(G_OBJECT(prefswindow->ok_btn), "clicked", G_CALLBACK(ok_button_clicked), prefswindow); g_signal_connect(G_OBJECT(prefswindow->apply_btn), "clicked", G_CALLBACK(apply_button_clicked), prefswindow); #endif g_signal_connect(G_OBJECT(prefswindow->window), "delete_event", G_CALLBACK(window_closed), prefswindow); g_signal_connect(G_OBJECT(prefswindow->window), "key_press_event", G_CALLBACK(prefswindow_key_pressed), &(prefswindow->window)); /* connect to callback only if we have non-NULL pointers to store size to */ if (prefswindow->save_width && prefswindow->save_height) { g_signal_connect(G_OBJECT(prefswindow->window), "size_allocate", G_CALLBACK(prefs_size_allocate_cb), prefswindow); } MANAGE_WINDOW_SIGNALS_CONNECT(prefswindow->window); if (!geometry.min_height) { if (x < 800 && y < 600) { geometry.min_width = 600; geometry.min_height = 440; } else { geometry.min_width = 700; geometry.min_height = 550; } } gtk_window_set_geometry_hints(GTK_WINDOW(prefswindow->window), NULL, &geometry, GDK_HINT_MIN_SIZE); if (prefswindow->save_width && prefswindow->save_height) { gtk_widget_set_size_request(prefswindow->window, *(prefswindow->save_width), *(prefswindow->save_height)); } #ifdef GENERIC_UMPC prefs_show_sections(prefswindow); #endif gtk_widget_show(prefswindow->window); adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(prefswindow->scrolledwindow1)); gtk_adjustment_set_value(adj, gtk_adjustment_get_lower(adj)); gtk_adjustment_changed(adj); }
static void description_create(DescriptionWindow * dwindow) { GtkWidget *hbox; GtkWidget *label; GtkWidget *vbox; GtkWidget *table; GtkWidget *hbbox; GtkWidget *close_btn; GtkWidget *scrolledwin; int i; int sz; int line; int j; int *max_width = g_new0(int, dwindow->columns), width=0; GtkRequisition req; dwindow->window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "description_window"); gtk_window_set_title(GTK_WINDOW(dwindow->window), gettext(dwindow->title)); gtk_container_set_border_width(GTK_CONTAINER(dwindow->window), 8); gtk_window_set_resizable(GTK_WINDOW(dwindow->window), TRUE); /* Check number of lines to be show */ sz = 0; for (i = 0; dwindow->symbol_table[i] != NULL; i = i + dwindow->columns) { sz++; } scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); table = gtk_table_new(sz, dwindow->columns, FALSE); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwin), table); gtk_container_set_border_width(GTK_CONTAINER(table), 4); gtk_table_set_col_spacings(GTK_TABLE(table), 8); line = 0; for(i = 0; dwindow->symbol_table[i] != NULL; i = i + dwindow->columns) { if(dwindow->symbol_table[i][0] != '\0') { GtkWidget *label; for (j = 0; j < dwindow->columns; j++) { gint col = j; gint colend = j+1; /* Expand using next NULL columns */ while ((colend < dwindow->columns) && (dwindow->symbol_table[i+colend] == NULL)) { colend++; j++; } label = gtk_label_new(gettext(dwindow->symbol_table[i+col])); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); gtk_misc_set_alignment (GTK_MISC(label), 0, 0); gtk_table_attach(GTK_TABLE(table), label, col, colend, line, line+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 2); gtk_widget_size_request(label, &req); if(req.width > max_width[j]) max_width[j] = req.width; } } else { GtkWidget *separator; separator = gtk_hseparator_new(); gtk_table_attach(GTK_TABLE(table), separator, 0, dwindow->columns, line, line+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 4); } line++; } for(j=0; j<dwindow->columns; j++) width += max_width[j]; g_free(max_width); width += 100; gtkut_stock_button_set_create(&hbbox, &close_btn, GTK_STOCK_CLOSE, NULL, NULL, NULL, NULL); vbox = gtk_vbox_new(FALSE, VSPACING_NARROW); gtk_container_add(GTK_CONTAINER(dwindow->window), vbox); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new(gettext(dwindow->description)); gtk_widget_set_size_request(GTK_WIDGET(label), width-2, -1); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(scrolledwin), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbbox), FALSE, FALSE, 3); gtk_widget_grab_default(close_btn); g_signal_connect(G_OBJECT(close_btn), "clicked", G_CALLBACK(description_window_destroy), dwindow); g_signal_connect(G_OBJECT(dwindow->window), "key_press_event", G_CALLBACK(description_window_key_pressed), dwindow); g_signal_connect(G_OBJECT(dwindow->window), "focus_in_event", G_CALLBACK(description_window_focus_in_event), NULL); g_signal_connect(G_OBJECT(dwindow->window), "focus_out_event", G_CALLBACK(description_window_focus_out_event), NULL); g_signal_connect(G_OBJECT(dwindow->window), "delete_event", G_CALLBACK(description_window_destroy), dwindow); if(dwindow->parent) g_signal_connect(G_OBJECT(dwindow->parent), "hide", G_CALLBACK(description_window_destroy), dwindow); gtk_widget_show_all(vbox); gtk_widget_set_size_request(dwindow->window, (width < 400) ? 400 : width, 450); }
/** * Create main dialog decorations (excluding notebook pages). */ static void export_html_dialog_create( void ) { GtkWidget *window; GtkWidget *vbox; GtkWidget *vnbox; GtkWidget *notebook; GtkWidget *hbbox; GtkWidget *btnPrev; GtkWidget *btnNext; GtkWidget *btnCancel; GtkWidget *hsbox; GtkWidget *statusbar; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "exphtmldlg"); gtk_widget_set_size_request(window, -1, -1 ); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title( GTK_WINDOW(window), _("Export Address Book to HTML File") ); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(export_html_delete_event), NULL ); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(export_html_key_pressed), NULL ); vbox = gtk_vbox_new(FALSE, 4); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(window), vbox); vnbox = gtk_vbox_new(FALSE, 4); gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4); gtk_widget_show(vnbox); gtk_box_pack_start(GTK_BOX(vbox), vnbox, TRUE, TRUE, 0); /* Notebook */ notebook = gtk_notebook_new(); gtk_notebook_set_show_tabs( GTK_NOTEBOOK(notebook), FALSE ); /* Hide */ /* gtk_notebook_set_show_tabs( GTK_NOTEBOOK(notebook), TRUE ); */ gtk_widget_show(notebook); gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(notebook), 6); /* 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, &btnPrev, GTK_STOCK_GO_BACK, &btnNext, GTK_STOCK_GO_FORWARD, &btnCancel, GTK_STOCK_CANCEL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2); gtk_widget_grab_default(btnNext); /* Button handlers */ g_signal_connect(G_OBJECT(btnPrev), "clicked", G_CALLBACK(export_html_prev), NULL); g_signal_connect(G_OBJECT(btnNext), "clicked", G_CALLBACK(export_html_next), NULL); g_signal_connect(G_OBJECT(btnCancel), "clicked", G_CALLBACK(export_html_cancel), NULL); gtk_widget_show_all(vbox); exphtml_dlg.window = window; exphtml_dlg.notebook = notebook; exphtml_dlg.btnPrev = btnPrev; exphtml_dlg.btnNext = btnNext; exphtml_dlg.btnCancel = btnCancel; exphtml_dlg.statusbar = statusbar; exphtml_dlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Export HTML Dialog" ); }
PrefsDisplayItemsDialog *prefs_display_items_dialog_create(void) { PrefsDisplayItemsDialog *dialog; GtkWidget *window; GtkWidget *vbox; GtkWidget *label_hbox; GtkWidget *label; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *clist_hbox; GtkWidget *scrolledwin; GtkWidget *stock_clist; GtkWidget *shown_clist; GtkWidget *btn_vbox; GtkWidget *btn_vbox1; GtkWidget *add_btn; GtkWidget *remove_btn; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *btn_hbox; GtkWidget *default_btn; GtkWidget *confirm_area; GtkWidget *ok_btn; GtkWidget *cancel_btn; gchar *title[1]; dialog = g_new0(PrefsDisplayItemsDialog, 1); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width(GTK_CONTAINER(window), 8); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_modal(GTK_WINDOW(window), TRUE); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); gtk_window_set_title(GTK_WINDOW(window), _("Display items setting")); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(prefs_display_items_delete_event), dialog); g_signal_connect(G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_display_items_key_pressed), dialog); vbox = gtk_vbox_new(FALSE, 6); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(window), vbox); label_hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(label_hbox); gtk_box_pack_start(GTK_BOX(vbox), label_hbox, FALSE, FALSE, 4); label = gtk_label_new(""); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(label_hbox), label, FALSE, FALSE, 4); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); vbox1 = gtk_vbox_new(FALSE, VSPACING); gtk_widget_show(vbox1); gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox1), 2); hbox1 = gtk_hbox_new(FALSE, 8); gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, TRUE, 0); clist_hbox = gtk_hbox_new(FALSE, 8); gtk_widget_show(clist_hbox); gtk_box_pack_start(GTK_BOX(hbox1), clist_hbox, TRUE, TRUE, 0); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_widget_set_size_request (scrolledwin, SCROLLED_WINDOW_WIDTH * gtkut_get_dpi_multiplier(), SCROLLED_WINDOW_HEIGHT * gtkut_get_dpi_multiplier()); gtk_widget_show(scrolledwin); gtk_box_pack_start(GTK_BOX(clist_hbox), scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); title[0] = _("Available items"); stock_clist = gtk_clist_new_with_titles(1, title); gtk_widget_show(stock_clist); gtk_container_add(GTK_CONTAINER(scrolledwin), stock_clist); gtk_clist_set_selection_mode(GTK_CLIST(stock_clist), GTK_SELECTION_BROWSE); GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(stock_clist)->column[0].button, GTK_CAN_FOCUS); gtkut_clist_set_redraw(GTK_CLIST(stock_clist)); /* add/remove button */ btn_vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(btn_vbox); gtk_box_pack_start(GTK_BOX(hbox1), btn_vbox, FALSE, FALSE, 0); btn_vbox1 = gtk_vbox_new(FALSE, 8); gtk_widget_show(btn_vbox1); gtk_box_pack_start(GTK_BOX(btn_vbox), btn_vbox1, TRUE, FALSE, 0); add_btn = gtk_button_new_with_label(_(" -> ")); gtk_widget_show(add_btn); gtk_box_pack_start(GTK_BOX(btn_vbox1), add_btn, FALSE, FALSE, 0); remove_btn = gtk_button_new_with_label(_(" <- ")); gtk_widget_show(remove_btn); gtk_box_pack_start(GTK_BOX(btn_vbox1), remove_btn, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(add_btn), "clicked", G_CALLBACK(prefs_display_items_add), dialog); g_signal_connect(G_OBJECT(remove_btn), "clicked", G_CALLBACK(prefs_display_items_remove), dialog); clist_hbox = gtk_hbox_new(FALSE, 8); gtk_widget_show(clist_hbox); gtk_box_pack_start(GTK_BOX(hbox1), clist_hbox, TRUE, TRUE, 0); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_widget_set_size_request (scrolledwin, SCROLLED_WINDOW_WIDTH * gtkut_get_dpi_multiplier(), SCROLLED_WINDOW_HEIGHT * gtkut_get_dpi_multiplier()); gtk_widget_show(scrolledwin); gtk_box_pack_start(GTK_BOX(clist_hbox), scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); title[0] = _("Displayed items"); shown_clist = gtk_clist_new_with_titles(1, title); gtk_widget_show(shown_clist); gtk_container_add(GTK_CONTAINER(scrolledwin), shown_clist); gtk_clist_set_selection_mode(GTK_CLIST(shown_clist), GTK_SELECTION_BROWSE); #if 0 gtk_clist_set_reorderable(GTK_CLIST(shown_clist), TRUE); gtk_clist_set_use_drag_icons(GTK_CLIST(shown_clist), FALSE); #endif GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(shown_clist)->column[0].button, GTK_CAN_FOCUS); gtkut_clist_set_redraw(GTK_CLIST(shown_clist)); g_signal_connect(G_OBJECT(shown_clist), "select-row", G_CALLBACK(prefs_display_items_shown_select_row), dialog); g_signal_connect_after(G_OBJECT(shown_clist), "row-move", G_CALLBACK(prefs_display_items_shown_row_move), dialog); /* up/down button */ btn_vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(btn_vbox); gtk_box_pack_start(GTK_BOX(hbox1), btn_vbox, FALSE, FALSE, 0); btn_vbox1 = gtk_vbox_new(FALSE, 8); gtk_widget_show(btn_vbox1); gtk_box_pack_start(GTK_BOX(btn_vbox), btn_vbox1, TRUE, FALSE, 0); up_btn = gtk_button_new_with_label(_("Up")); gtk_widget_show(up_btn); gtk_box_pack_start(GTK_BOX(btn_vbox1), up_btn, FALSE, FALSE, 0); down_btn = gtk_button_new_with_label(_("Down")); gtk_widget_show(down_btn); gtk_box_pack_start(GTK_BOX(btn_vbox1), down_btn, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(up_btn), "clicked", G_CALLBACK(prefs_display_items_up), dialog); g_signal_connect(G_OBJECT(down_btn), "clicked", G_CALLBACK(prefs_display_items_down), dialog); btn_hbox = gtk_hbox_new(FALSE, 8); gtk_widget_show(btn_hbox); gtk_box_pack_end(GTK_BOX(vbox), btn_hbox, FALSE, FALSE, 0); btn_vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(btn_vbox); gtk_box_pack_start(GTK_BOX(btn_hbox), btn_vbox, FALSE, FALSE, 0); default_btn = gtk_button_new_with_label(_(" Revert to default ")); gtk_widget_show(default_btn); gtk_box_pack_start(GTK_BOX(btn_vbox), default_btn, TRUE, FALSE, 0); g_signal_connect(G_OBJECT(default_btn), "clicked", G_CALLBACK(prefs_display_items_default), dialog); gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK, &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL); gtk_widget_show(confirm_area); gtk_box_pack_end(GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default(ok_btn); g_signal_connect(G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_display_items_ok), dialog); g_signal_connect(G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_display_items_cancel), dialog); dialog->window = window; dialog->label = label; dialog->stock_clist = stock_clist; dialog->shown_clist = shown_clist; dialog->add_btn = add_btn; dialog->remove_btn = remove_btn; dialog->up_btn = up_btn; dialog->down_btn = down_btn; dialog->confirm_area = confirm_area; dialog->ok_btn = ok_btn; dialog->cancel_btn = cancel_btn; gtkut_box_set_reverse_order(GTK_BOX(dialog->confirm_area), !prefs_common.comply_gnome_hig); manage_window_set_transient(GTK_WINDOW(dialog->window)); gtk_widget_grab_focus(dialog->ok_btn); dialog->finished = FALSE; dialog->cancelled = FALSE; return dialog; }