Commit 5e0618e8 authored by Adrien Plazas's avatar Adrien Plazas

prefs-dialog: Make it a HdyPreferencesWindow

parent 2d850270
Pipeline #83259 passed with stages
in 6 minutes and 14 seconds
......@@ -971,7 +971,6 @@ ephy_shell_get_prefs_dialog (EphyShell *shell)
{
if (shell->prefs_dialog == NULL) {
shell->prefs_dialog = g_object_new (EPHY_TYPE_PREFS_DIALOG,
"use-header-bar", TRUE,
NULL);
g_signal_connect (shell->prefs_dialog,
"destroy",
......
......@@ -54,8 +54,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
#include <JavaScriptCore/JavaScript.h>
#include <json-glib/json-glib.h>
#include <math.h>
......@@ -70,9 +68,9 @@ enum {
};
struct _PrefsDialog {
GtkDialog parent_instance;
HdyPreferencesWindow parent_instance;
GtkWidget *notebook;
GtkWidget *sync_page;
/* general */
GtkWidget *homepage_box;
......@@ -164,7 +162,7 @@ enum {
NUM_COLS
};
G_DEFINE_TYPE (PrefsDialog, prefs_dialog, GTK_TYPE_DIALOG)
G_DEFINE_TYPE (PrefsDialog, prefs_dialog, HDY_TYPE_PREFERENCES_WINDOW)
static const guint sync_frequency_minutes[] = { 5, 15, 30, 60 };
......@@ -293,14 +291,9 @@ sync_secrets_store_finished_cb (EphySyncService *service,
if (!error) {
hdy_action_row_set_title (HDY_ACTION_ROW (dialog->sync_firefox_account_row),
ephy_sync_utils_get_sync_user ());
gtk_container_remove (GTK_CONTAINER (dialog->sync_page_box),
dialog->sync_firefox_iframe_box);
gtk_box_pack_start (GTK_BOX (dialog->sync_page_box),
dialog->sync_firefox_account_box,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (dialog->sync_page_box),
dialog->sync_options_box,
FALSE, FALSE, 0);
gtk_widget_hide (dialog->sync_firefox_iframe_box);
gtk_widget_show (dialog->sync_firefox_account_box);
gtk_widget_show (dialog->sync_options_box);
} else {
/* Display the error message and reload the iframe. */
sync_sign_in_details_show (dialog, error->message);
......@@ -643,13 +636,9 @@ on_sync_sign_out_button_clicked (GtkWidget *button,
/* Show Firefox Accounts iframe. */
sync_setup_firefox_iframe (dialog);
gtk_container_remove (GTK_CONTAINER (dialog->sync_page_box),
dialog->sync_firefox_account_box);
gtk_container_remove (GTK_CONTAINER (dialog->sync_page_box),
dialog->sync_options_box);
gtk_box_pack_start (GTK_BOX (dialog->sync_page_box),
dialog->sync_firefox_iframe_box,
FALSE, FALSE, 0);
gtk_widget_show (dialog->sync_firefox_iframe_box);
gtk_widget_hide (dialog->sync_firefox_account_box);
gtk_widget_hide (dialog->sync_options_box);
hdy_action_row_set_subtitle (HDY_ACTION_ROW (dialog->sync_firefox_account_row), NULL);
}
......@@ -966,7 +955,7 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/epiphany/gtk/prefs-dialog.ui");
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, notebook);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_page);
/* general */
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, homepage_box);
......@@ -2318,15 +2307,12 @@ setup_sync_page (PrefsDialog *dialog)
if (!user) {
sync_setup_firefox_iframe (dialog);
gtk_container_remove (GTK_CONTAINER (dialog->sync_page_box),
dialog->sync_firefox_account_box);
gtk_container_remove (GTK_CONTAINER (dialog->sync_page_box),
dialog->sync_options_box);
gtk_widget_hide (dialog->sync_firefox_account_box);
gtk_widget_hide (dialog->sync_options_box);
} else {
sync_set_last_sync_time (dialog);
hdy_action_row_set_title (HDY_ACTION_ROW (dialog->sync_firefox_account_row), user);
gtk_container_remove (GTK_CONTAINER (dialog->sync_page_box),
dialog->sync_firefox_iframe_box);
gtk_widget_hide (dialog->sync_firefox_iframe_box);
}
g_settings_bind (sync_settings,
......@@ -2429,7 +2415,7 @@ prefs_dialog_init (PrefsDialog *dialog)
if (mode == EPHY_EMBED_SHELL_MODE_BROWSER)
setup_sync_page (dialog);
else
gtk_notebook_remove_page (GTK_NOTEBOOK (dialog->notebook), -1);
gtk_container_remove (GTK_CONTAINER (dialog), dialog->sync_page);
ephy_gui_ensure_window_group (GTK_WINDOW (dialog));
g_signal_connect (dialog, "response",
......
......@@ -23,11 +23,13 @@
#include <glib-object.h>
#include <gtk/gtk.h>
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
G_BEGIN_DECLS
#define EPHY_TYPE_PREFS_DIALOG (prefs_dialog_get_type ())
G_DECLARE_FINAL_TYPE (PrefsDialog, prefs_dialog, EPHY, PREFS_DIALOG, GtkDialog)
G_DECLARE_FINAL_TYPE (PrefsDialog, prefs_dialog, EPHY, PREFS_DIALOG, HdyPreferencesWindow)
G_END_DECLS
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.0"/>
<template class="PrefsDialog" parent="GtkDialog">
<template class="PrefsDialog" parent="HdyPreferencesWindow">
<property name="role">epiphany-preferences</property>
<property name="modal">True</property>
<property name="window-position">center</property>
<property name="destroy-with-parent">True</property>
<property name="icon-name">gtk-preferences</property>
<property name="type-hint">dialog</property>
<child internal-child="headerbar">
<object class="GtkHeaderBar">
<property name="title" translatable="yes">Preferences</property>
<property name="show-close-button">True</property>
</object>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<property name="border_width">0</property>
<child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="show_border">False</property>
<property name="default-height">800</property>
<child>
<object class="HdyPreferencesPage">
<property name="icon_name">applications-system-symbolic</property>
......@@ -374,15 +358,6 @@
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">General</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="HdyPreferencesPage">
<property name="icon_name">document-edit-symbolic</property>
......@@ -548,16 +523,6 @@
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Fonts &amp; Style</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="HdyPreferencesPage">
<property name="icon_name">drive-harddisk-symbolic</property>
......@@ -714,16 +679,6 @@
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Stored Data</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="HdyPreferencesPage">
<property name="icon_name">emoji-flags-symbolic</property>
......@@ -907,16 +862,6 @@
<property name="position">3</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Language</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="HdyPreferencesPage" id="sync_page">
<property name="icon_name">emblem-synchronizing-symbolic</property>
......@@ -1108,22 +1053,6 @@
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Sync</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment