Mercurial > geeqie.yaz
changeset 354:5c82855feba7
Add a button to reset fullscreen info string to default value.
author | zas_ |
---|---|
date | Sun, 13 Apr 2008 12:24:42 +0000 |
parents | 691fcf15aca1 |
children | 0b82646e977f |
files | src/fullscreen.c src/fullscreen.h src/main.c src/preferences.c |
diffstat | 4 files changed, 46 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fullscreen.c Sun Apr 13 12:12:44 2008 +0000 +++ b/src/fullscreen.c Sun Apr 13 12:24:42 2008 +0000 @@ -32,6 +32,15 @@ *---------------------------------------------------------------------------- */ +void set_default_fullscreen_info(ConfOptions *options) +{ + if (options->fullscreen.info) g_free(options->fullscreen.info); + options->fullscreen.info = g_strdup("%collection%(%number%/%total%) <b>%name%</b>\n" + "%res%|%date%|%size%\n" + "%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" + "%fCamera%|%fFlash%"); +} + static void clear_mouse_cursor(GtkWidget *widget, gint state) { if (!widget->window) return;
--- a/src/fullscreen.h Sun Apr 13 12:12:44 2008 +0000 +++ b/src/fullscreen.h Sun Apr 13 12:24:42 2008 +0000 @@ -16,6 +16,8 @@ #define FULL_SCREEN_HIDE_MOUSE_DELAY 3000 #define FULL_SCREEN_BUSY_MOUSE_DELAY 200 +void set_default_fullscreen_info(ConfOptions *options); + FullScreenData *fullscreen_start(GtkWidget *window, ImageWindow *imd, void (*stop_func)(FullScreenData *, gpointer), gpointer stop_data);
--- a/src/main.c Sun Apr 13 12:12:44 2008 +0000 +++ b/src/main.c Sun Apr 13 12:24:42 2008 +0000 @@ -18,6 +18,7 @@ #include "dnd.h" #include "editors.h" #include "filelist.h" +#include "fullscreen.h" #include "image-overlay.h" #include "img-view.h" #include "layout.h" @@ -1178,11 +1179,7 @@ options->color_profile.input_name[i] = NULL; } - options->fullscreen.info = g_strdup("%collection%(%number%/%total%) <b>%name%</b>\n" - "%res%|%date%|%size%\n" - "%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" - "%fCamera%|%fFlash%"); - + set_default_fullscreen_info(options); sidecar_ext_add_defaults(); }
--- a/src/preferences.c Sun Apr 13 12:12:44 2008 +0000 +++ b/src/preferences.c Sun Apr 13 12:24:42 2008 +0000 @@ -780,6 +780,32 @@ c_options->fullscreen.info = gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE); } +static void fullscreen_info_default_ok_cb(GenericDialog *gd, gpointer data) +{ + GtkTextView *text_view = data; + GtkTextBuffer *buffer; + + set_default_fullscreen_info(options); + if (!configwindow) return; + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view)); + gtk_text_buffer_set_text(buffer, options->fullscreen.info, -1); +} + +static void fullscreen_info_default_cb(GtkWidget *widget, gpointer data) +{ + GenericDialog *gd; + + gd = generic_dialog_new(_("Reset fullscreen info string"), + GQ_WMCLASS, "reset_fullscreen_info", widget, TRUE, + dummy_cancel_cb, data); + generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION, _("Reset fullscreen info string"), + _("This will reset the fullscreen info string to the default.\nContinue?")); + generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, fullscreen_info_default_ok_cb, TRUE); + gtk_widget_show(gd->dialog); +} + + /* general options tab */ static void config_tab_general(GtkWidget *notebook) { @@ -1302,6 +1328,13 @@ gtk_container_add(GTK_CONTAINER(scrolled), fullscreen_info_view); gtk_widget_show(fullscreen_info_view); + hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); + + button = pref_button_new(NULL, NULL, _("Defaults"), FALSE, + G_CALLBACK(fullscreen_info_default_cb), fullscreen_info_view); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); + gtk_widget_show(button); + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(fullscreen_info_view)); gtk_text_buffer_set_text(buffer, options->fullscreen.info, -1); g_signal_connect(G_OBJECT(buffer), "changed",