On Sun, 04 Dec 2011 00:48:40 +0100 Colomban Wendling <lists....@herbesfolles.org> wrote:
> Le 03/12/2011 20:56, Dimitar Zhekov a écrit : > > > There is one, and only one thing, that is unquestionably better IMHO: > > separate [ ] "Always wrap search and hide the Find dialog" into [...] > > Yep, this sounds sensible to me. It'd be better flexible and I can > understand somebody was one and not the other. So yeah, go ahead :) > It turned out to be quite easy, because the two meanings are actualy used separately... -- E-gards: Jimmy
>From 85f038b6978e508c81947535a6ac099790a40d58 Mon Sep 17 00:00:00 2001 From: Dimitar Zhekov <dimitar.zhe...@gmail.com> Date: Sun, 4 Dec 2011 15:15:59 +0200 Subject: [PATCH] split "always wrap search and hide find dialog" pref into "always wrap search" and "hide find dialog" --- geany.glade | 26 +++++++++++++++++++++++--- src/document.c | 2 +- src/interface.c | 19 +++++++++++++------ src/keyfile.c | 19 +++++++++++++++++-- src/search.c | 4 +--- src/search.h | 3 ++- 6 files changed, 57 insertions(+), 16 deletions(-) diff --git a/geany.glade b/geany.glade index ba18b6f..4037970 100644 --- a/geany.glade +++ b/geany.glade @@ -3841,11 +3841,31 @@ <property name="spacing">0</property> <child> - <widget class="GtkCheckButton" id="check_ask_suppress_search_dialogs"> + <widget class="GtkCheckButton" id="check_always_wrap_search"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Always wrap search around the document and hide the Find dialog after clicking Find Next/Previous</property> + <property name="tooltip" translatable="yes">Always wrap search around the document</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Always wrap search and hide the Find dialog</property> + <property name="label" translatable="yes">Always wrap search</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="check_hide_find_dialog"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Hide the Find dialog after clicking Find Next/Previous</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Hide the Find dialog</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> diff --git a/src/document.c b/src/document.c index dbc1e39..ad437da 100644 --- a/src/document.c +++ b/src/document.c @@ -1939,7 +1939,7 @@ gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *orig } /* we searched only part of the document, so ask whether to wraparound. */ - if (search_prefs.suppress_dialogs || + if (search_prefs.always_wrap || dialogs_show_question_full(parent, GTK_STOCK_FIND, GTK_STOCK_CANCEL, _("Wrap search and find again?"), _("\"%s\" was not found."), original_text)) { diff --git a/src/interface.c b/src/interface.c index ce9fbff..126e794 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2574,7 +2574,8 @@ create_prefs_dialog (void) GtkWidget *frame36; GtkWidget *alignment39; GtkWidget *vbox36; - GtkWidget *check_ask_suppress_search_dialogs; + GtkWidget *check_always_wrap_search; + GtkWidget *check_hide_find_dialog; GtkWidget *check_search_use_current_word; GtkWidget *check_fif_current_dir; GtkWidget *label215; @@ -3195,10 +3196,15 @@ create_prefs_dialog (void) gtk_widget_show (vbox36); gtk_container_add (GTK_CONTAINER (alignment39), vbox36); - check_ask_suppress_search_dialogs = gtk_check_button_new_with_mnemonic (_("Always wrap search and hide the Find dialog")); - gtk_widget_show (check_ask_suppress_search_dialogs); - gtk_box_pack_start (GTK_BOX (vbox36), check_ask_suppress_search_dialogs, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, check_ask_suppress_search_dialogs, _("Always wrap search around the document and hide the Find dialog after clicking Find Next/Previous"), NULL); + check_always_wrap_search = gtk_check_button_new_with_mnemonic (_("Always wrap search")); + gtk_widget_show (check_always_wrap_search); + gtk_box_pack_start (GTK_BOX (vbox36), check_always_wrap_search, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_always_wrap_search, _("Always wrap search around the document"), NULL); + + check_hide_find_dialog = gtk_check_button_new_with_mnemonic (_("Hide the Find dialog")); + gtk_widget_show (check_hide_find_dialog); + gtk_box_pack_start (GTK_BOX (vbox36), check_hide_find_dialog, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_hide_find_dialog, _("Hide the Find dialog after clicking Find Next/Previous"), NULL); check_search_use_current_word = gtk_check_button_new_with_mnemonic (_("Use the current word under the cursor for Find dialogs")); gtk_widget_show (check_search_use_current_word); @@ -5185,7 +5191,8 @@ create_prefs_dialog (void) GLADE_HOOKUP_OBJECT (prefs_dialog, frame36, "frame36"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment39, "alignment39"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox36, "vbox36"); - GLADE_HOOKUP_OBJECT (prefs_dialog, check_ask_suppress_search_dialogs, "check_ask_suppress_search_dialogs"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_always_wrap_search, "check_always_wrap_search"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_hide_find_dialog, "check_hide_find_dialog"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_search_use_current_word, "check_search_use_current_word"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_fif_current_dir, "check_fif_current_dir"); GLADE_HOOKUP_OBJECT (prefs_dialog, label215, "label215"); diff --git a/src/keyfile.c b/src/keyfile.c index 356de05..17fbb4d 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -92,6 +92,8 @@ static gint session_notebook_page; static gint hpan_position; static gint vpan_position; static const gchar atomic_file_saving_key[] = "use_atomic_file_saving"; +static const gchar search_always_wrap_key[] = "pref_main_search_always_wrap"; +static const gchar search_hide_find_dialog_key[] = "pref_main_search_hide_find_dialog"; static GPtrArray *keyfile_groups = NULL; @@ -150,8 +152,10 @@ static void init_pref_groups(void) stash_group_add_toggle_button(group, &interface_prefs.highlighting_invert_all, "highlighting_invert_all", FALSE, "check_highlighting_invert"); - stash_group_add_toggle_button(group, &search_prefs.suppress_dialogs, - "pref_main_suppress_search_dialogs", FALSE, "check_ask_suppress_search_dialogs"); + stash_group_add_toggle_button(group, &search_prefs.always_wrap, + search_always_wrap_key, FALSE, "check_always_wrap_search"); + stash_group_add_toggle_button(group, &search_prefs.hide_find_dialog, + search_hide_find_dialog_key, FALSE, "check_hide_find_dialog"); stash_group_add_toggle_button(group, &search_prefs.use_current_word, "pref_main_search_use_current_word", TRUE, "check_search_use_current_word"); @@ -693,6 +697,17 @@ static void load_dialog_prefs(GKeyFile *config) utils_get_setting_boolean(config, PACKAGE, "use_safe_file_saving", FALSE)); } + /* compatibility with Geany 0.21 */ + { + gboolean suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE); + + if (!g_key_file_has_key(config, PACKAGE, search_always_wrap_key, NULL)) + g_key_file_set_boolean(config, PACKAGE, search_always_wrap_key, suppress_search_dialogs); + + if (!g_key_file_has_key(config, PACKAGE, search_hide_find_dialog_key, NULL)) + g_key_file_set_boolean(config, PACKAGE, search_hide_find_dialog_key, suppress_search_dialogs); + } + /* read stash prefs */ settings_action(config, SETTING_READ); diff --git a/src/search.c b/src/search.c index cd95a45..d5ca4f1 100644 --- a/src/search.c +++ b/src/search.c @@ -1253,9 +1253,7 @@ on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) gint result = document_find_text(doc, search_data.text, search_data.original_text, search_data.flags, (response == GEANY_RESPONSE_FIND_PREVIOUS), TRUE, GTK_WIDGET(find_dlg.dialog)); ui_set_search_entry_background(find_dlg.entry, (result > -1)); - check_close = FALSE; - if (search_prefs.suppress_dialogs) - check_close = TRUE; + check_close = search_prefs.hide_find_dialog; break; } case GEANY_RESPONSE_FIND_IN_FILE: diff --git a/src/search.h b/src/search.h index b074bf4..58d276c 100644 --- a/src/search.h +++ b/src/search.h @@ -55,7 +55,8 @@ enum GeanyFindSelOptions /** Search preferences */ typedef struct GeanySearchPrefs { - gboolean suppress_dialogs; + gboolean always_wrap; /* don't ask whether to wrap search */ + gboolean hide_find_dialog; /* hide the find dialog on next or previous */ gboolean use_current_word; /**< Use current word for default search text */ gboolean use_current_file_dir; /* find in files directory to use on showing dialog */ enum GeanyFindSelOptions find_selection_type; -- 1.7.7.3
_______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel