186 lines
7.6 KiB
Diff
186 lines
7.6 KiB
Diff
From: Adrien Plazas <kekun.plazas@laposte.net>
|
|
Date: Mon, 28 Jan 2019 18:52:40 +0100
|
|
Subject: aboutdialog: Port to phones
|
|
|
|
---
|
|
gtk/gtkaboutdialog.c | 22 ++++++++++++++++------
|
|
gtk/ui/gtkaboutdialog.ui | 30 +++++++++++++++++++++++++-----
|
|
2 files changed, 41 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
|
|
index adb0515..a1967b0 100644
|
|
--- a/gtk/gtkaboutdialog.c
|
|
+++ b/gtk/gtkaboutdialog.c
|
|
@@ -51,12 +51,13 @@
|
|
#include "gtktogglebutton.h"
|
|
#include "gtktypebuiltins.h"
|
|
#include "gtkstack.h"
|
|
-#include "gtkstackswitcher.h"
|
|
#include "gtksettings.h"
|
|
#include "gtkheaderbar.h"
|
|
#include "gtkprivate.h"
|
|
#include "gtkintl.h"
|
|
#include "gtkdialogprivate.h"
|
|
+#include "hdy-view-switcher-bar-private.h"
|
|
+#include "hdy-view-switcher-title-private.h"
|
|
|
|
|
|
/**
|
|
@@ -162,6 +163,7 @@ struct _GtkAboutDialogPrivate
|
|
|
|
GtkWidget *stack;
|
|
GtkWidget *stack_switcher;
|
|
+ GtkWidget *stack_switcher_mobile;
|
|
GtkWidget *credits_button;
|
|
GtkWidget *license_button;
|
|
|
|
@@ -591,6 +593,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
|
|
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, stack);
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, stack_switcher);
|
|
+ gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, stack_switcher_mobile);
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, logo_image);
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, name_label);
|
|
gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, version_label);
|
|
@@ -625,12 +628,13 @@ static void
|
|
update_stack_switcher_visibility (GtkAboutDialog *about)
|
|
{
|
|
GtkAboutDialogPrivate *priv = about->priv;
|
|
+ gboolean show;
|
|
|
|
- if (gtk_widget_get_visible (priv->credits_page) ||
|
|
- gtk_widget_get_visible (priv->license_page))
|
|
- gtk_widget_show (priv->stack_switcher);
|
|
- else
|
|
- gtk_widget_hide (priv->stack_switcher);
|
|
+ show = gtk_widget_get_visible (priv->credits_page) ||
|
|
+ gtk_widget_get_visible (priv->license_page);
|
|
+
|
|
+ gtk_widget_set_visible (priv->stack_switcher, show);
|
|
+ gtk_widget_set_visible (priv->stack_switcher_mobile, show);
|
|
}
|
|
|
|
static void
|
|
@@ -749,6 +753,9 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CANCEL);
|
|
|
|
+ g_type_ensure (GTK_TYPE_HDY_VIEW_SWITCHER_BAR);
|
|
+ g_type_ensure (GTK_TYPE_HDY_VIEW_SWITCHER_TITLE);
|
|
+
|
|
gtk_widget_init_template (GTK_WIDGET (about));
|
|
gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (about));
|
|
|
|
@@ -2197,6 +2204,9 @@ add_credits_section (GtkAboutDialog *about,
|
|
markup = g_strdup_printf ("<span size=\"small\">%s</span>", title);
|
|
label = gtk_label_new (markup);
|
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
|
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
+ gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR);
|
|
+
|
|
g_free (markup);
|
|
gtk_widget_set_halign (label, GTK_ALIGN_END);
|
|
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
|
diff --git a/gtk/ui/gtkaboutdialog.ui b/gtk/ui/gtkaboutdialog.ui
|
|
index 31bb628..7d3d2a5 100644
|
|
--- a/gtk/ui/gtkaboutdialog.ui
|
|
+++ b/gtk/ui/gtkaboutdialog.ui
|
|
@@ -6,29 +6,32 @@
|
|
<property name="icon-name">help-about</property>
|
|
</object>
|
|
<template class="GtkAboutDialog" parent="GtkDialog">
|
|
- <property name="border-width">5</property>
|
|
- <property name="resizable">0</property>
|
|
<property name="type-hint">dialog</property>
|
|
+ <property name="default-width">420</property>
|
|
<child internal-child="headerbar">
|
|
<object class="GtkHeaderBar" id="headerbar1">
|
|
<property name="visible">1</property>
|
|
<property name="show-close-button">1</property>
|
|
<child type="title">
|
|
- <object class="GtkStackSwitcher" id="stack_switcher">
|
|
+ <object class="GtkHdyViewSwitcherTitle" id="stack_switcher">
|
|
+ <property name="visible">1</property>
|
|
<property name="stack">stack</property>
|
|
<property name="no-show-all">1</property>
|
|
+ <property name="policy">wide</property>
|
|
+ <property name="title" bind-source="GtkAboutDialog" bind-property="title" bind-flags="sync-create"/>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
<child internal-child="vbox">
|
|
<object class="GtkBox" id="dialog-vbox1">
|
|
+ <property name="border-width">0</property>
|
|
<property name="orientation">vertical</property>
|
|
<property name="spacing">2</property>
|
|
<child>
|
|
<object class="GtkBox" id="box">
|
|
<property name="visible">1</property>
|
|
- <property name="border-width">5</property>
|
|
+ <property name="border-width">12</property>
|
|
<property name="orientation">vertical</property>
|
|
<property name="spacing">12</property>
|
|
<child>
|
|
@@ -57,12 +60,16 @@
|
|
</child>
|
|
<child>
|
|
<object class="GtkStack" id="stack">
|
|
- <property name="width-request">400</property>
|
|
+ <property name="width-request">300</property>
|
|
<property name="height-request">100</property>
|
|
<property name="visible">1</property>
|
|
<property name="transition-type">over-up-down</property>
|
|
<property name="transition-duration">600</property>
|
|
<signal name="notify::visible-child" handler="stack_visible_child_notify" swapped="no"/>
|
|
+ <child>
|
|
+ <object class="GtkScrolledWindow" id="scrolledwindow3">
|
|
+ <property name="visible">1</property>
|
|
+ <property name="propagate-natural-height">1</property>
|
|
<child>
|
|
<object class="GtkBox" id="page_vbox">
|
|
<property name="visible">1</property>
|
|
@@ -131,9 +138,12 @@
|
|
<property name="fill">0</property>
|
|
</packing>
|
|
</child>
|
|
+ </object>
|
|
+ </child>
|
|
</object>
|
|
<packing>
|
|
<property name="name">main</property>
|
|
+ <property name="icon-name">help-about-symbolic</property>
|
|
<property name="title" translatable="yes">About</property>
|
|
</packing>
|
|
</child>
|
|
@@ -174,6 +184,7 @@
|
|
</object>
|
|
<packing>
|
|
<property name="name">credits</property>
|
|
+ <property name="icon-name">system-users-symbolic</property>
|
|
<property name="title" translatable="yes">Credits</property>
|
|
</packing>
|
|
</child>
|
|
@@ -207,6 +218,7 @@
|
|
</object>
|
|
<packing>
|
|
<property name="name">license</property>
|
|
+ <property name="icon-name">accessories-dictionary-symbolic</property>
|
|
<property name="title" translatable="yes">License</property>
|
|
</packing>
|
|
</child>
|
|
@@ -222,6 +234,14 @@
|
|
<property name="position">1</property>
|
|
</packing>
|
|
</child>
|
|
+ <child>
|
|
+ <object class="GtkHdyViewSwitcherBar" id="stack_switcher_mobile">
|
|
+ <property name="stack">stack</property>
|
|
+ <property name="no-show-all">1</property>
|
|
+ <property name="visible">1</property>
|
|
+ <property name="reveal" bind-source="stack_switcher" bind-property="title-visible" bind-flags="sync-create"/>
|
|
+ </object>
|
|
+ </child>
|
|
</object>
|
|
</child>
|
|
</template>
|