[gnome-commander] Store the size of the options dialog in the gsettings options
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Store the size of the options dialog in the gsettings options
- Date: Wed, 11 Oct 2017 15:33:20 +0000 (UTC)
commit aca534516004ec843ea7f9fb908abed30aff5293
Author: Uwe Scholz <uwescholz src gnome org>
Date: Thu Sep 28 07:27:24 2017 +0200
Store the size of the options dialog in the gsettings options
data/org.gnome.gnome-commander.gschema.xml | 14 ++++++++++++++
src/dialogs/gnome-cmd-options-dialog.cc | 5 ++++-
src/gnome-cmd-data.cc | 24 ++++++++++++++++++++++++
src/gnome-cmd-data.h | 4 ++++
4 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index ee9622b..f00f27d 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -219,6 +219,20 @@
This option defines the height of the main window.
</description>
</key>
+ <key name="opts-dialog-width" type="u">
+ <default>560</default>
+ <summary>Options dialog width</summary>
+ <description>
+ This setting defines the width of the options dialog window.
+ </description>
+ </key>
+ <key name="opts-dialog-height" type="u">
+ <default>600</default>
+ <summary>Options dialog height</summary>
+ <description>
+ This setting defines the height of the options dialog window.
+ </description>
+ </key>
<key name="column-width-icon" type="u">
<default>16</default>
<summary>Width of icon column</summary>
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 8a1655a..7eebd14 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -2104,7 +2104,7 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData::Options &cfg
GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- gtk_window_set_default_size(GTK_WINDOW (dialog), 560, 600);
+ gtk_window_set_default_size(GTK_WINDOW (dialog), gnome_cmd_data.opts_dialog_width,
gnome_cmd_data.opts_dialog_height);
// HIG defaults
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
@@ -2148,6 +2148,9 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData::Options &cfg
store_devices_options (dialog, cfg);
}
+ gnome_cmd_data.opts_dialog_width = dialog->allocation.width;
+ gnome_cmd_data.opts_dialog_height = dialog->allocation.height;
+
// store the current active tab
activetab = notebook->get_current_page();
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 82bea50..7831730 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -824,6 +824,16 @@ static void on_mainmenu_visibility_changed()
main_win->update_mainmenu_visibility();
}
+static void on_opts_dialog_width_changed()
+{
+ gnome_cmd_data.opts_dialog_width = g_settings_get_uint (gnome_cmd_data.options.gcmd_settings->general,
GCMD_SETTINGS_OPTS_DIALOG_WIDTH);
+}
+
+static void on_opts_dialog_height_changed()
+{
+ gnome_cmd_data.opts_dialog_height = g_settings_get_uint (gnome_cmd_data.options.gcmd_settings->general,
GCMD_SETTINGS_OPTS_DIALOG_HEIGHT);
+}
+
static void on_viewer_cmd_changed()
{
gchar *viewer_cmd;
@@ -1249,6 +1259,16 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
G_CALLBACK (on_mainmenu_visibility_changed),
NULL);
+ g_signal_connect (gs->general,
+ "changed::opts-dialog-width",
+ G_CALLBACK (on_opts_dialog_width_changed),
+ NULL);
+
+ g_signal_connect (gs->general,
+ "changed::opts-dialog-height",
+ G_CALLBACK (on_opts_dialog_height_changed),
+ NULL);
+
g_signal_connect (gs->programs,
"changed::viewer-cmd",
G_CALLBACK (on_viewer_cmd_changed),
@@ -3545,6 +3565,8 @@ void GnomeCmdData::load()
main_win_width = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_WIDTH);
main_win_height = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_HEIGHT);
+ opts_dialog_width = g_settings_get_uint (options.gcmd_settings->general,
GCMD_SETTINGS_OPTS_DIALOG_WIDTH);
+ opts_dialog_height = g_settings_get_uint (options.gcmd_settings->general,
GCMD_SETTINGS_OPTS_DIALOG_HEIGHT);
fs_col_width[0] = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_COLUMN_WIDTH_ICON);
fs_col_width[1] = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_COLUMN_WIDTH_NAME);
fs_col_width[2] = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_COLUMN_WIDTH_EXT);
@@ -4223,6 +4245,8 @@ void GnomeCmdData::save()
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_WIDTH,
&(main_win_width));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_HEIGHT,
&(main_win_height));
+ set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_OPTS_DIALOG_WIDTH,
&(opts_dialog_width));
+ set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_OPTS_DIALOG_HEIGHT,
&(opts_dialog_height));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_COLUMN_WIDTH_ICON,
&(fs_col_width[0]));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_COLUMN_WIDTH_NAME,
&(fs_col_width[1]));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_COLUMN_WIDTH_EXT,
&(fs_col_width[2]));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index d92de33..ff30692 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -102,6 +102,8 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT "quick-search"
#define GCMD_SETTINGS_MAIN_WIN_WIDTH "main-win-width"
#define GCMD_SETTINGS_MAIN_WIN_HEIGHT "main-win-height"
+#define GCMD_SETTINGS_OPTS_DIALOG_WIDTH "opts-dialog-width"
+#define GCMD_SETTINGS_OPTS_DIALOG_HEIGHT "opts-dialog-height"
#define GCMD_SETTINGS_COLUMN_WIDTH_ICON "column-width-icon"
#define GCMD_SETTINGS_COLUMN_WIDTH_NAME "column-width-name"
#define GCMD_SETTINGS_COLUMN_WIDTH_EXT "column-width-ext"
@@ -637,6 +639,8 @@ struct GnomeCmdData
guint main_win_width;
guint main_win_height;
+ guint opts_dialog_width;
+ guint opts_dialog_height;
GdkWindowState main_win_state;
std::map<guint,std::vector<Tab> > tabs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]