GtkWidget *generic_dialog_add_message(GenericDialog *gd, const gchar *icon_stock_id, const gchar *heading, const gchar *text) { GtkWidget *hbox; GtkWidget *vbox; GtkWidget *label; hbox = pref_box_new(gd->vbox, TRUE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); if (icon_stock_id) { GtkWidget *image; image = gtk_image_new_from_stock(icon_stock_id, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); gtk_widget_show(image); } vbox = pref_box_new(hbox, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE); if (heading) { label = pref_label_new(vbox, heading); pref_label_bold(label, TRUE, TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); } if (text) { label = pref_label_new(vbox, text); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); } return vbox; }
static void cache_manager_render_dialog(GtkWidget *widget, const gchar *path) { CleanData *cd; GtkWidget *hbox; GtkWidget *label; GtkWidget *button; cd = g_new0(CleanData, 1); cd->gd = generic_dialog_new(_("Create thumbnails"), "create_thumbnails", widget, FALSE, NULL, cd); gtk_window_set_default_size(GTK_WINDOW(cd->gd->dialog), PURGE_DIALOG_WIDTH, -1); cd->gd->cancel_cb = cache_manager_render_close_cb; cd->button_close = generic_dialog_add_button(cd->gd, GTK_STOCK_CLOSE, NULL, cache_manager_render_close_cb, FALSE); cd->button_start = generic_dialog_add_button(cd->gd, GTK_STOCK_OK, _("S_tart"), cache_manager_render_start_cb, FALSE); cd->button_stop = generic_dialog_add_button(cd->gd, GTK_STOCK_STOP, NULL, cache_manager_render_stop_cb, FALSE); gtk_widget_set_sensitive(cd->button_stop, FALSE); generic_dialog_add_message(cd->gd, NULL, _("Create thumbnails"), NULL); hbox = pref_box_new(cd->gd->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, 0); pref_spacer(hbox, PREF_PAD_INDENT); cd->group = pref_box_new(hbox, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); hbox = pref_box_new(cd->group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_label_new(hbox, _("Folder:")); label = tab_completion_new(&cd->entry, path, NULL, NULL); tab_completion_add_select_button(cd->entry,_("Select folder") , TRUE); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); gtk_widget_show(label); pref_checkbox_new_int(cd->group, _("Include subfolders"), FALSE, &cd->recurse); button = pref_checkbox_new_int(cd->group, _("Store thumbnails local to source images"), FALSE, &cd->local); gtk_widget_set_sensitive(button, options->thumbnails.spec_standard); pref_line(cd->gd->vbox, PREF_PAD_SPACE); hbox = pref_box_new(cd->gd->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); cd->progress = gtk_entry_new(); GTK_WIDGET_UNSET_FLAGS(cd->progress, GTK_CAN_FOCUS); gtk_editable_set_editable(GTK_EDITABLE(cd->progress), FALSE); gtk_entry_set_text(GTK_ENTRY(cd->progress), _("click start to begin")); gtk_box_pack_start(GTK_BOX(hbox), cd->progress, TRUE, TRUE, 0); gtk_widget_show(cd->progress); cd->spinner = spinner_new(NULL, -1); gtk_box_pack_start(GTK_BOX(hbox), cd->spinner, FALSE, FALSE, 0); gtk_widget_show(cd->spinner); cd->list = NULL; gtk_widget_show(cd->gd->dialog); }
static GtkWidget *cache_manager_location_label(GtkWidget *group, const gchar *subdir) { GtkWidget *label; gchar *buf; gchar *path; path = g_build_filename(homedir(), subdir, NULL); buf = g_strdup_printf(_("Location: %s"), path); g_free(path); label = pref_label_new(group, buf); g_free(buf); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); return label; }
static void add_dither_menu(gint option, gint *option_c, gchar *text, GtkWidget *box) { GtkWidget *hbox; GtkWidget *omenu; GtkWidget *menu; *option_c = option; hbox = pref_box_new(box, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_label_new(hbox, text); omenu = gtk_option_menu_new(); menu = gtk_menu_new(); add_menu_item(menu, _("None"), option_c, (gint)GDK_RGB_DITHER_NONE); add_menu_item(menu, _("Normal"), option_c, (gint)GDK_RGB_DITHER_NORMAL); add_menu_item(menu, _("Best"), option_c, (gint)GDK_RGB_DITHER_MAX); gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), *option_c); gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 0); gtk_widget_show(omenu); }
void info_window_new(const gchar *path, GList *list) { InfoData *id; GtkWidget *main_vbox; GtkWidget *paned; GtkWidget *hbox; GtkWidget *button; GtkWidget *label; GdkGeometry geometry; if (!path && !list) return; if (!list) { list = g_list_append(NULL, g_strdup(path)); } id = g_new0(InfoData, 1); id->list = list; id->path = (gchar *)id->list->data; id->updated = FALSE; id->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(id->window), GDK_WINDOW_TYPE_HINT_DIALOG); window_set_icon(id->window, NULL, NULL); gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE); gtk_window_set_title(GTK_WINDOW(id->window), _("Image properties - GQview")); gtk_window_set_wmclass(GTK_WINDOW(id->window), "properties", "GQview"); geometry.min_width = 32; geometry.min_height = 32; geometry.base_width = DEF_PROPERTY_WIDTH; geometry.base_height = DEF_PROPERTY_HEIGHT; gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry, GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); gtk_window_set_default_size(GTK_WINDOW(id->window), info_window_last_width, info_window_last_height); gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER); g_signal_connect(G_OBJECT(id->window), "delete_event", G_CALLBACK(info_window_delete_cb), id); g_signal_connect(G_OBJECT(id->window), "destroy", G_CALLBACK(info_window_destroy_cb), id); paned = gtk_hpaned_new(); gtk_container_add(GTK_CONTAINER(id->window), paned); gtk_widget_show(paned); id->image = image_new(FALSE); image_set_update_func(id->image, info_window_image_update_cb, id); image_set_button_func(id->image, info_window_image_button_cb, id); image_set_scroll_func(id->image, info_window_image_scroll_cb, id); gtk_widget_set_size_request(id->image->widget, IMAGE_SIZE_W, IMAGE_SIZE_H); gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE); gtk_widget_show(id->image->widget); main_vbox = gtk_vbox_new(FALSE, 0); gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE); gtk_widget_show(main_vbox); hbox = pref_box_new(main_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); label = pref_label_new(hbox, _("Filename:")); pref_label_bold(label, TRUE, FALSE); id->name_entry = gtk_entry_new(); gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE); gtk_box_pack_start(GTK_BOX(hbox), id->name_entry, TRUE, TRUE, 0); gtk_widget_show(id->name_entry); id->notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP); gtk_box_pack_start(GTK_BOX(main_vbox), id->notebook, TRUE, TRUE, 5); gtk_widget_show(id->notebook); pref_spacer(main_vbox, PREF_PAD_GAP); hbox = pref_box_new(main_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP); id->button_back = pref_button_new(hbox, GTK_STOCK_GO_BACK, NULL, TRUE, G_CALLBACK(info_window_back_cb), id); gtk_widget_set_sensitive(id->button_back, FALSE); id->button_next = pref_button_new(hbox, GTK_STOCK_GO_FORWARD, NULL, TRUE, G_CALLBACK(info_window_next_cb), id); gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL)); if (id->list->next) { id->label_count = pref_label_new(hbox, ""); } button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE, G_CALLBACK(info_window_close_cb), id); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); /* set up tabs */ info_tabs_init(id); /* fill it */ info_window_sync(id, id->path); /* finish */ info_window_dnd_init(id); gtk_widget_show(id->window); }
static void config_window_create(void) { GtkWidget *win_vbox; GtkWidget *hbox; GtkWidget *notebook; GtkWidget *frame; GtkWidget *label; GtkWidget *vbox; GtkWidget *group; GtkWidget *subgroup; GtkWidget *button; GtkWidget *tabcomp; GtkWidget *ct_button; GtkWidget *table; GtkWidget *spin; GtkWidget *scrolled; GtkWidget *viewport; GtkWidget *filter_view; GtkCellRenderer *renderer; GtkTreeSelection *selection; GtkTreeViewColumn *column; gint i; configwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(configwindow), GDK_WINDOW_TYPE_HINT_DIALOG); g_signal_connect(G_OBJECT (configwindow), "delete_event", G_CALLBACK(config_window_delete), NULL); gtk_window_set_resizable(GTK_WINDOW(configwindow), FALSE); gtk_window_set_title(GTK_WINDOW(configwindow), _("GQview Preferences")); gtk_window_set_wmclass(GTK_WINDOW(configwindow), "config", "GQview"); gtk_container_set_border_width(GTK_CONTAINER(configwindow), PREF_PAD_BORDER); window_set_icon(configwindow, PIXBUF_INLINE_ICON_CONFIG, NULL); win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); gtk_container_add(GTK_CONTAINER(configwindow), win_vbox); gtk_widget_show(win_vbox); hbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP); gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE, G_CALLBACK(config_window_ok_cb), NULL); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_grab_default(button); gtk_widget_show(button); ct_button = button; button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE, G_CALLBACK(config_window_apply_cb), NULL); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE, G_CALLBACK(config_window_close_cb), NULL); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_show(button); if (!generic_dialog_get_alternative_button_order(configwindow)) { gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1); } notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP); gtk_box_pack_start(GTK_BOX(win_vbox), notebook, TRUE, TRUE, 0); /* general options tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("General")); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), vbox, label); group = pref_group_new(vbox, FALSE, _("Startup"), GTK_ORIENTATION_VERTICAL); button = pref_checkbox_new_int(group, _("Change to folder:"), startup_path_enable, &startup_path_enable_c); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_checkbox_link_sensitivity(button, hbox); tabcomp = tab_completion_new(&startup_path_entry, startup_path, NULL, NULL); tab_completion_add_select_button(startup_path_entry, NULL, TRUE); gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); gtk_widget_show(tabcomp); button = pref_button_new(hbox, NULL, _("Use current"), FALSE, G_CALLBACK(startup_path_set_current), NULL); group = pref_group_new(vbox, FALSE, _("Thumbnails"), GTK_ORIENTATION_VERTICAL); table = pref_table_new(group, 2, 2, FALSE, FALSE); add_thumb_size_menu(table, 0, 0, _("Size:")); add_quality_menu(table, 0, 1, _("Quality:"), thumbnail_quality, &thumbnail_quality_c); ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"), enable_thumb_caching, &enable_thumb_caching_c); subgroup = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_link_sensitivity(ct_button, subgroup); button = pref_checkbox_new_int(subgroup, _("Use shared thumbnail cache"), thumbnail_spec_standard, &thumbnail_spec_standard_c); subgroup = pref_box_new(subgroup, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_link_sensitivity_swap(button, subgroup); pref_checkbox_new_int(subgroup, _("Cache thumbnails into .thumbnails"), enable_thumb_dirs, &enable_thumb_dirs_c); #if 0 pref_checkbox_new_int(subgroup, _("Use xvpics thumbnails when found (read only)"), use_xvpics_thumbnails, &use_xvpics_thumbnails_c); #endif pref_checkbox_new_int(group, _("Faster jpeg thumbnailing (may reduce quality)"), thumbnail_fast, &thumbnail_fast_c); group = pref_group_new(vbox, FALSE, _("Slide show"), GTK_ORIENTATION_VERTICAL); slideshow_delay_c = slideshow_delay; spin = pref_spin_new(group, _("Delay between image change:"), _("seconds"), SLIDESHOW_MIN_SECONDS, SLIDESHOW_MAX_SECONDS, 1.0, 1, slideshow_delay ? (double)slideshow_delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0, G_CALLBACK(slideshow_delay_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); pref_checkbox_new_int(group, _("Random"), slideshow_random, &slideshow_random_c); pref_checkbox_new_int(group, _("Repeat"), slideshow_repeat, &slideshow_repeat_c); /* image tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Image")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label); group = pref_group_new(vbox, FALSE, _("Zoom"), GTK_ORIENTATION_VERTICAL); #if 0 add_dither_menu(dither_quality, &dither_quality_c, _("Dithering method:"), group); #endif table = pref_table_new(group, 2, 1, FALSE, FALSE); add_quality_menu(table, 0, 0, _("Quality:"), zoom_quality, &zoom_quality_c); pref_checkbox_new_int(group, _("Two pass zooming"), two_pass_zoom, &two_pass_zoom_c); pref_checkbox_new_int(group, _("Allow enlargement of image for zoom to fit"), zoom_to_fit_expands, &zoom_to_fit_expands_c); zoom_increment_c = zoom_increment; spin = pref_spin_new(group, _("Zoom increment:"), NULL, 0.1, 4.0, 1.0, 1, (double)zoom_increment / 10.0, G_CALLBACK(zoom_increment_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); group = pref_group_new(vbox, FALSE, _("When new image is selected:"), GTK_ORIENTATION_VERTICAL); zoom_mode_c = zoom_mode; button = pref_radiobutton_new(group, NULL, _("Zoom to original size"), (zoom_mode == ZOOM_RESET_ORIGINAL), G_CALLBACK(zoom_mode_original_cb), NULL); button = pref_radiobutton_new(group, button, _("Fit image to window"), (zoom_mode == ZOOM_RESET_FIT_WINDOW), G_CALLBACK(zoom_mode_fit_cb), NULL); button = pref_radiobutton_new(group, button, _("Leave Zoom at previous setting"), (zoom_mode == ZOOM_RESET_NONE), G_CALLBACK(zoom_mode_none_cb), NULL); group = pref_group_new(vbox, FALSE, _("Appearance"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Black background"), black_window_background, &black_window_background_c); group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Refresh on file change"), update_on_time_change, &update_on_time_change_c); pref_checkbox_new_int(group, _("Preload next image"), enable_read_ahead, &enable_read_ahead_c); pref_checkbox_new_int(group, _("Auto rotate image using Exif information"), exif_rotate_enable, &exif_rotate_enable_c); /* window tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Windows")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); group = pref_group_new(vbox, FALSE, _("State"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Remember window positions"), save_window_positions, &save_window_positions_c); pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"), restore_tool, &restore_tool_c); group = pref_group_new(vbox, FALSE, _("Size"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Fit window to image when tools are hidden/floating"), fit_window, &fit_window_c); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); ct_button = pref_checkbox_new_int(hbox, _("Limit size when auto-sizing window (%):"), limit_window_size, &limit_window_size_c); spin = pref_spin_new_int(hbox, NULL, NULL, 10, 150, 1, max_window_size, &max_window_size_c); pref_checkbox_link_sensitivity(ct_button, spin); group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); layout_widget = layout_config_new(); layout_config_set(layout_widget, layout_style, layout_order); gtk_box_pack_start(GTK_BOX(group), layout_widget, FALSE, FALSE, 0); gtk_widget_show(layout_widget); /* filtering tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER (vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Filtering")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); group = pref_box_new(vbox, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_new_int(group, _("Show entries that begin with a dot"), show_dot_files, &show_dot_files_c); pref_checkbox_new_int(group, _("Case sensitive sort"), file_sort_case_sensitive, &file_sort_case_sensitive_c); ct_button = pref_checkbox_new_int(group, _("Disable File Filtering"), file_filter_disable, &file_filter_disable_c); group = pref_group_new(vbox, TRUE, _("File types"), GTK_ORIENTATION_VERTICAL); frame = pref_group_parent(group); g_signal_connect(G_OBJECT(ct_button), "toggled", G_CALLBACK(filter_disable_cb), frame); gtk_widget_set_sensitive(frame, !file_filter_disable); scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_box_pack_start(GTK_BOX(group), scrolled, TRUE, TRUE, 0); gtk_widget_show(scrolled); filter_store = gtk_list_store_new(1, G_TYPE_POINTER); filter_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(filter_store)); g_object_unref(filter_store); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(filter_view)); gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_SINGLE); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(filter_view), FALSE); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, _("Filter")); gtk_tree_view_column_set_resizable(column, TRUE); renderer = gtk_cell_renderer_toggle_new(); g_signal_connect(G_OBJECT(renderer), "toggled", G_CALLBACK(filter_store_enable_cb), filter_store); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_cell_data_func(column, renderer, filter_set_func, GINT_TO_POINTER(FE_ENABLE), NULL); renderer = gtk_cell_renderer_text_new(); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(filter_store_ext_edit_cb), filter_store); gtk_tree_view_column_pack_start(column, renderer, TRUE); g_object_set(G_OBJECT(renderer), "editable", (gboolean)TRUE, NULL); gtk_tree_view_column_set_cell_data_func(column, renderer, filter_set_func, GINT_TO_POINTER(FE_EXTENSION), NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(filter_view), column); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, _("Description")); gtk_tree_view_column_set_resizable(column, TRUE); renderer = gtk_cell_renderer_text_new(); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(filter_store_desc_edit_cb), filter_store); g_object_set(G_OBJECT(renderer), "editable", (gboolean)TRUE, NULL); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_cell_data_func(column, renderer, filter_set_func, GINT_TO_POINTER(FE_DESCRIPTION), NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(filter_view), column); filter_store_populate(); gtk_container_add(GTK_CONTAINER(scrolled), filter_view); gtk_widget_show(filter_view); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); button = pref_button_new(NULL, NULL, _("Defaults"), FALSE, G_CALLBACK(filter_default_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_REMOVE, NULL, FALSE, G_CALLBACK(filter_remove_cb), filter_view); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_ADD, NULL, FALSE, G_CALLBACK(filter_add_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); /* editor entry tab */ vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Editors")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); table = pref_table_new(vbox, 3, 9, FALSE, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP); label = pref_table_label(table, 0, 0, _("#"), 1.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 1, 0, _("Menu name"), 0.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 2, 0, _("Command Line"), 0.0); pref_label_bold(label, TRUE, FALSE); for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++) { gchar *buf; buf = g_strdup_printf("%d", i+1); pref_table_label(table, 0, i+1, buf, 1.0); g_free(buf); editor_name_entry[i] = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(editor_name_entry[i]), EDITOR_NAME_MAX_LENGTH); gtk_widget_set_size_request(editor_name_entry[i],80,-1); if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]); gtk_table_attach(GTK_TABLE (table),editor_name_entry[i],1,2,i+1,i+2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(editor_name_entry[i]); editor_command_entry[i] = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(editor_command_entry[i]), EDITOR_COMMAND_MAX_LENGTH); gtk_widget_set_size_request(editor_command_entry[i],160,-1); tab_completion_add_to_entry(editor_command_entry[i], NULL, NULL); if (editor_command[i]) gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]), editor_command[i]); gtk_table_attach(GTK_TABLE (table),editor_command_entry[i],2,3,i+1,i+2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(editor_command_entry[i]); } hbox = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); button = pref_button_new(NULL, NULL, _("Defaults"), FALSE, G_CALLBACK(editor_default_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE, G_CALLBACK(editor_help_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); /* advanced entry tab */ scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_container_set_border_width(GTK_CONTAINER(scrolled), PREF_PAD_BORDER); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); label = gtk_label_new(_("Advanced")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled, label); gtk_widget_show(scrolled); viewport = gtk_viewport_new(NULL, NULL); gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); gtk_container_add(GTK_CONTAINER(scrolled), viewport); gtk_widget_show(viewport); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(viewport), vbox); gtk_widget_show(vbox); group = pref_group_new(vbox, FALSE, _("Full screen"), GTK_ORIENTATION_VERTICAL); fullscreen_screen_c = fullscreen_screen; fullscreen_above_c = fullscreen_above; hbox = fullscreen_prefs_selection_new(_("Location:"), &fullscreen_screen_c, &fullscreen_above_c); gtk_box_pack_start(GTK_BOX(group), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); pref_checkbox_new_int(group, _("Smooth image flip"), fullscreen_clean_flip, &fullscreen_clean_flip_c); pref_checkbox_new_int(group, _("Disable screen saver"), fullscreen_disable_saver, &fullscreen_disable_saver_c); group = pref_group_new(vbox, FALSE, _("Delete"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Confirm file delete"), confirm_delete, &confirm_delete_c); pref_checkbox_new_int(group, _("Enable Delete key"), enable_delete_key, &enable_delete_key_c); ct_button = pref_checkbox_new_int(group, _("Safe delete"), safe_delete_enable, &safe_delete_enable_c); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_checkbox_link_sensitivity(ct_button, hbox); pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_SPACE); pref_label_new(hbox, _("Folder:")); tabcomp = tab_completion_new(&safe_delete_path_entry, safe_delete_path, NULL, NULL); tab_completion_add_select_button(safe_delete_path_entry, NULL, TRUE); gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); gtk_widget_show(tabcomp); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); pref_checkbox_link_sensitivity(ct_button, hbox); pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_GAP); pref_spin_new_int(hbox, _("Maximum size:"), _("MB"), 1, 500, 1, safe_delete_size, &safe_delete_size_c); button = pref_button_new(NULL, NULL, _("View"), FALSE, G_CALLBACK(safe_delete_view_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_CLEAR, NULL, FALSE, G_CALLBACK(safe_delete_clear_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Rectangular selection in icon view"), collection_rectangular_selection, &collection_rectangular_selection_c); pref_checkbox_new_int(group, _("Descend folders in tree view"), tree_descend_subdirs, &tree_descend_subdirs_c); pref_checkbox_new_int(group, _("In place renaming"), enable_in_place_rename, &enable_in_place_rename_c); group = pref_group_new(vbox, FALSE, _("Navigation"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Progressive keyboard scrolling"), progressive_key_scrolling, &progressive_key_scrolling_c); pref_checkbox_new_int(group, _("Mouse wheel scrolls image"), mousewheel_scrolls, &mousewheel_scrolls_c); group = pref_group_new(vbox, FALSE, _("Miscellaneous"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Store keywords and comments local to source images"), enable_metadata_dirs, &enable_metadata_dirs_c); pref_spin_new_int(group, _("Custom similarity threshold:"), NULL, 0, 100, 1, dupe_custom_threshold, &dupe_custom_threshold_c); pref_spin_new_int(group, _("Offscreen cache size (Mb per image):"), NULL, 0, 128, 1, tile_cache_max, &tile_cache_max_c); group = pref_group_new(vbox, FALSE, _("Color profiles"), GTK_ORIENTATION_VERTICAL); #ifndef HAVE_LCMS gtk_widget_set_sensitive(pref_group_parent(group), FALSE); #endif table = pref_table_new(group, 3, COLOR_PROFILE_INPUTS + 2, FALSE, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP); label = pref_table_label(table, 0, 0, _("Type"), 0.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 1, 0, _("Menu name"), 0.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 2, 0, _("File"), 0.0); pref_label_bold(label, TRUE, FALSE); for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { GtkWidget *entry; gchar *buf; buf = g_strdup_printf("Input %d:", i + 1); pref_table_label(table, 0, i + 1, buf, 1.0); g_free(buf); entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_NAME_MAX_LENGTH); gtk_widget_set_size_request(editor_name_entry[i], 30, -1); if (color_profile_input_name[i]) gtk_entry_set_text(GTK_ENTRY(entry), color_profile_input_name[i]); gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i + 1, i + 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(entry); color_profile_input_name_entry[i] = entry; tabcomp = tab_completion_new(&entry, color_profile_input_file[i], NULL, NULL); tab_completion_add_select_button(entry, _("Select color profile"), FALSE); gtk_widget_set_size_request(entry, 160, -1); gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, i + 1, i + 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(tabcomp); color_profile_input_file_entry[i] = entry; } pref_table_label(table, 0, COLOR_PROFILE_INPUTS + 1, _("Screen:"), 1.0); tabcomp = tab_completion_new(&color_profile_screen_file_entry, color_profile_screen_file, NULL, NULL); tab_completion_add_select_button(color_profile_screen_file_entry, _("Select color profile"), FALSE); gtk_widget_set_size_request(color_profile_screen_file_entry, 160, -1); gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, COLOR_PROFILE_INPUTS + 1, COLOR_PROFILE_INPUTS + 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(tabcomp); gtk_widget_show(notebook); gtk_widget_show(configwindow); }
GtkWidget *layout_config_new(void) { LayoutConfig *lc; GtkWidget *hbox; GtkWidget *group = NULL; GtkWidget *scrolled; GtkListStore *store; GtkTreeViewColumn *column; GtkCellRenderer *renderer; gint i; lc = g_new0(LayoutConfig, 1); lc->box = gtk_vbox_new(FALSE, PREF_PAD_GAP); g_object_set_data(G_OBJECT(lc->box), "layout_config", lc); g_signal_connect(G_OBJECT(lc->box), "destroy", G_CALLBACK(layout_config_destroy), lc); hbox = gtk_hbox_new(TRUE, PREF_PAD_SPACE); gtk_box_pack_start(GTK_BOX(lc->box), hbox, FALSE, FALSE, 0); for (i = 0; i < layout_config_style_count; i++) { group = layout_config_widget(group, hbox, i, lc); lc->style_widgets = g_list_append(lc->style_widgets, group); } gtk_widget_show(hbox); scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_NEVER, GTK_POLICY_NEVER); gtk_box_pack_start(GTK_BOX(lc->box), scrolled, FALSE, FALSE, 0); gtk_widget_show(scrolled); store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); lc->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(lc->listview), FALSE); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(lc->listview), FALSE); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(lc->listview), TRUE); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_cell_data_func(column, renderer, layout_config_number_cb, lc, NULL); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", COLUMN_TEXT); gtk_tree_view_append_column(GTK_TREE_VIEW(lc->listview), column); for (i = 0; i < 3; i++) { GtkTreeIter iter; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COLUMN_TEXT, _(layout_titles[i]), COLUMN_KEY, i, -1); } gtk_container_add(GTK_CONTAINER(scrolled), lc->listview); gtk_widget_show(lc->listview); pref_label_new(lc->box, _("(drag to change order)")); return lc->box; }