[gtranslator/gtk4: 49/52] Remove GtkPaned widgets from tab
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator/gtk4: 49/52] Remove GtkPaned widgets from tab
- Date: Mon, 5 Sep 2022 15:17:52 +0000 (UTC)
commit 02c30f7a8e87abf71c5665ddb25174991135bf0b
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Mon Aug 29 18:03:53 2022 +0200
Remove GtkPaned widgets from tab
data/org.gnome.Gtranslator.gschema.xml.in | 9 +++------
src/gtr-settings.h | 3 +--
src/gtr-tab.c | 33 +++++++++----------------------
src/gtr-tab.ui | 12 ++---------
4 files changed, 15 insertions(+), 42 deletions(-)
---
diff --git a/data/org.gnome.Gtranslator.gschema.xml.in b/data/org.gnome.Gtranslator.gschema.xml.in
index 38e76ce5..06052355 100644
--- a/data/org.gnome.Gtranslator.gschema.xml.in
+++ b/data/org.gnome.Gtranslator.gschema.xml.in
@@ -23,7 +23,7 @@
<default>true</default>
<summary>Warn if file contains fuzzy translations</summary>
<description>
- If true, warn the user when saving a PO translation file containing
+ If true, warn the user when saving a PO translation file containing
fuzzy strings.
</description>
</key>
@@ -132,11 +132,8 @@
<key name="size" type="(ii)">
<default>(775, 500)</default>
</key>
- <key name="content-panel-size" type="i">
- <default>325</default>
- </key>
- <key name="context-panel-size" type="i">
- <default>525</default>
+ <key name="flap-state" type="b">
+ <default>true</default>
</key>
</schema>
<schema id="org.gnome.gtranslator.state.history-entry" path="/org/gnome/gtranslator/state/history-entry/">
diff --git a/src/gtr-settings.h b/src/gtr-settings.h
index fb9405be..9f0afa92 100644
--- a/src/gtr-settings.h
+++ b/src/gtr-settings.h
@@ -75,8 +75,7 @@ GSettings *gtr_settings_new (void);
/* window state keys */
#define GTR_SETTINGS_WINDOW_STATE "state"
#define GTR_SETTINGS_WINDOW_SIZE "size"
-#define GTR_SETTINGS_CONTENT_PANEL_SIZE "content-panel-size"
-#define GTR_SETTINGS_CONTEXT_PANEL_SIZE "context-panel-size"
+#define GTR_SETTINGS_FLAP_STATE "flap-state"
G_END_DECLS
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 99ba6bb9..56f150fc 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -83,11 +83,9 @@ typedef struct
GtkWidget *dock;
- /*Vertical and Horizontal Panes */
- GtkPaned *hbox;
- GtkPaned *vertical_box;
- gint context_position;
- gint content_position;
+ /* Flap state */
+ AdwFlap *hbox;
+ gboolean flap_state;
GtkWidget *message_table;
GtkWidget *context;
@@ -875,16 +873,9 @@ gtr_tab_init (GtrTab * tab)
g_signal_connect (tab, "message-changed", G_CALLBACK (update_status), NULL);
- /*Load gsettings for panes */
- priv->context_position = g_settings_get_int (priv->state_settings,
- GTR_SETTINGS_CONTEXT_PANEL_SIZE);
-
- priv->content_position = g_settings_get_int (priv->state_settings,
- GTR_SETTINGS_CONTENT_PANEL_SIZE);
-
- //CLEANUP: As priv->hbox is no more GtkPaned widget
- //gtk_paned_set_position (priv->hbox, priv->context_position);
- gtk_paned_set_position (priv->vertical_box, priv->content_position);
+ /*Load gsettings for flap */
+ priv->flap_state = g_settings_get_boolean (priv->state_settings,
+ GTR_SETTINGS_FLAP_STATE);
/* Manage auto save data */
priv->autosave = g_settings_get_boolean (priv->files_settings,
@@ -945,14 +936,10 @@ save_pane_state(GtrTab *tab)
priv = gtr_tab_get_instance_private (tab);
- priv->context_position = gtk_paned_get_position (priv->hbox);
- priv->content_position = gtk_paned_get_position (priv->vertical_box);
-
- g_settings_set_int (priv->state_settings, GTR_SETTINGS_CONTEXT_PANEL_SIZE,
- priv->context_position);
+ priv->flap_state = adw_flap_get_folded (priv->hbox);
- g_settings_set_int (priv->state_settings, GTR_SETTINGS_CONTENT_PANEL_SIZE,
- priv->content_position);
+ g_settings_set_boolean (priv->state_settings, GTR_SETTINGS_FLAP_STATE,
+ priv->flap_state);
}
static void
@@ -1127,9 +1114,7 @@ gtr_tab_class_init (GtrTabClass * klass)
gtk_widget_class_bind_template_child_private (widget_class, GtrTab, trans_notebook);
gtk_widget_class_bind_template_child_private (widget_class, GtrTab, context);
gtk_widget_class_bind_template_child_private (widget_class, GtrTab, hbox);
- gtk_widget_class_bind_template_child_private (widget_class, GtrTab, vertical_box);
- //gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_eventbox);
gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_box);
gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_revealer);
gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_trans);
diff --git a/src/gtr-tab.ui b/src/gtr-tab.ui
index 8c74bb63..b7b523a4 100644
--- a/src/gtr-tab.ui
+++ b/src/gtr-tab.ui
@@ -26,29 +26,21 @@
</child>
<property name="child">
<object class="AdwFlap" id="hbox">
- <!--<property name="shrink-end-child">0</property>
- <property name="resize-end-child">0</property>
- <property name="shrink-start-child">0</property>
- <property name="wide_handle">1</property>-->
<property name="flap_position">end</property>
<property name="fold_policy">ADW_FLAP_FOLD_POLICY_NEVER</property>
<property name="locked">1</property>
<property name="reveal_flap">1</property>
<property name="separator">sep</property>
<child>
- <object class="GtkPaned" id="vertical_box">
- <property name="shrink-end-child">0</property>
- <property name="resize-end-child">0</property>
- <property name="shrink-start-child">0</property>
+ <object class="GtkBox" id="vertical_box">
<property name="orientation">vertical</property>
- <property name="width_request">450</property>
- <property name="wide_handle">1</property>
<child>
<object class="GtrMessageTable" id="message_table">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tab">GtrTab</property>
<property name="height_request">350</property>
+ <property name="width_request">450</property>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]