[gnome-commander/gcmd-1-10] Search window can be optionally transient



commit 3759a094ca18868fc1afaa262b68d994f1a761ad
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Wed Apr 24 22:24:26 2019 +0200

    Search window can be optionally transient

 data/org.gnome.gnome-commander.gschema.xml |  7 +++++++
 src/dialogs/gnome-cmd-options-dialog.cc    | 10 ++++++++++
 src/dialogs/gnome-cmd-search-dialog.cc     | 11 +++++++++--
 src/gnome-cmd-data.cc                      |  2 ++
 src/gnome-cmd-data.h                       |  2 ++
 5 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 22b60001..92cb79ab 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -528,6 +528,13 @@
           This option defines the height of the search window.
       </description>
     </key>
+    <key name="search-win-is-transient" type="b">
+      <default>true</default>
+      <summary>Search window is transient</summary>
+      <description>
+          Defines if the search window is transient or if it can be minimized and moved behind the main 
window.
+      </description>
+    </key>
     <key name="search-text-history" type="as">
       <default>[]</default>
       <summary>Search text history</summary>
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 7eaeea73..31352a97 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -188,6 +188,14 @@ static GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData::Options &
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.quick_search_exact_match_end);
 
+    // Search window options
+    cat_box = create_vbox (parent, FALSE, 0);
+    cat = create_category (parent, cat_box, _("Search Window"));
+    gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, TRUE, 0);
+
+    check = create_check (parent, _("Search window is minimizable\n(Needs program restart if altered)"), 
"search_window_transient");
+    gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), !cfg.search_window_is_transient);
 
 #ifdef HAVE_UNIQUE
     // Multiple instances
@@ -244,6 +252,7 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData::Options &cfg
     GtkWidget *multiple_instance_check = lookup_widget (dialog, "multiple_instance_check");
     GtkWidget *qsearch_exact_match_begin = lookup_widget (dialog, "qsearch_exact_match_begin");
     GtkWidget *qsearch_exact_match_end = lookup_widget (dialog, "qsearch_exact_match_end");
+    GtkWidget *search_window_transient = lookup_widget (dialog, "search_window_transient");
     GtkWidget *save_dirs = lookup_widget (dialog, "save_dirs");
     GtkWidget *save_tabs = lookup_widget (dialog, "save_tabs");
     GtkWidget *save_dir_history = lookup_widget (dialog, "save_dir_history");
@@ -271,6 +280,7 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData::Options &cfg
     cfg.allow_multiple_instances = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(multiple_instance_check));
     cfg.quick_search_exact_match_begin = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(qsearch_exact_match_begin));
     cfg.quick_search_exact_match_end = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(qsearch_exact_match_end));
+    cfg.search_window_is_transient = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(search_window_transient));
     cfg.save_dirs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dirs));
     cfg.save_tabs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_tabs));
     cfg.save_dir_history_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dir_history));
diff --git a/src/dialogs/gnome-cmd-search-dialog.cc b/src/dialogs/gnome-cmd-search-dialog.cc
index 3b91a68a..1a8fcc1d 100644
--- a/src/dialogs/gnome-cmd-search-dialog.cc
+++ b/src/dialogs/gnome-cmd-search-dialog.cc
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file gnome-cmd-search-dialog.cc
  * @copyright (C) 2001-2006 Marcus Bjurman\n
  * @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -1134,7 +1134,14 @@ void GnomeCmdSearchDialog::show_and_set_focus()
 GnomeCmdSearchDialog::GnomeCmdSearchDialog(GnomeCmdData::SearchConfig &cfg): defaults(cfg)
 {
     gtk_window_set_default_size (*this, defaults.width, defaults.height);
-    gtk_window_set_transient_for (*this, *main_win);
+    if (gnome_cmd_data.options.search_window_is_transient)
+    {
+        gtk_window_set_transient_for (*this, *main_win);
+    }
+    else
+    {
+        gtk_window_set_type_hint (*this, GDK_WINDOW_TYPE_HINT_NORMAL);
+    }
 
     GtkWidget *button = priv->create_button_with_menu(_("Profiles…"), cfg);
 
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 17288e9f..aafd38b9 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -3157,6 +3157,7 @@ void GnomeCmdData::load()
     options.save_dir_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT);
     options.save_cmdline_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_CMDLINE_HISTORY_ON_EXIT);
     options.save_search_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_SEARCH_HISTORY_ON_EXIT);
+    options.search_window_is_transient = g_settings_get_boolean(options.gcmd_settings->general, 
GCMD_SETTINGS_SEARCH_WIN_IS_TRANSIENT);
     search_defaults.height = g_settings_get_uint(options.gcmd_settings->general, 
GCMD_SETTINGS_SEARCH_WIN_HEIGHT);
     search_defaults.width = g_settings_get_uint(options.gcmd_settings->general, 
GCMD_SETTINGS_SEARCH_WIN_WIDTH);
     search_defaults.content_patterns.ents = get_list_from_gsettings_string_array 
(options.gcmd_settings->general, GCMD_SETTINGS_SEARCH_TEXT_HISTORY);
@@ -3556,6 +3557,7 @@ void GnomeCmdData::save()
     set_gsettings_when_changed      (options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_SEARCH_HISTORY_ON_EXIT, &(options.save_search_history_on_exit));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SEARCH_WIN_WIDTH, 
&(search_defaults.width));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SEARCH_WIN_HEIGHT, 
&(search_defaults.height));
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SEARCH_WIN_IS_TRANSIENT , 
&(options.search_window_is_transient));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_BOOKMARKS_WINDOW_WIDTH, 
&(bookmarks_defaults.width));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_BOOKMARKS_WINDOW_HEIGHT, 
&(bookmarks_defaults.height));
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index d3088982..09698cae 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -127,6 +127,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_DIRECTORY_HISTORY               "directory-history"
 #define GCMD_SETTINGS_SEARCH_WIN_WIDTH                "search-win-width"
 #define GCMD_SETTINGS_SEARCH_WIN_HEIGHT               "search-win-height"
+#define GCMD_SETTINGS_SEARCH_WIN_IS_TRANSIENT         "search-win-is-transient"
 #define GCMD_SETTINGS_SEARCH_PATTERN_HISTORY          "search-pattern-history"
 #define GCMD_SETTINGS_SEARCH_TEXT_HISTORY             "search-text-history"
 #define GCMD_SETTINGS_SEARCH_PROFILES                 "search-profiles"
@@ -316,6 +317,7 @@ struct GnomeCmdData
         gboolean                     save_dir_history_on_exit;
         gboolean                     save_cmdline_history_on_exit;
         gboolean                     save_search_history_on_exit;
+        gboolean                     search_window_is_transient {true};
         gchar                       *symlink_prefix;
         gint                         main_win_pos[2];
         // Format


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]