[gnome-todo] todoist: Make GtdTodoistPreferencesPanel a GtkBin subclass
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] todoist: Make GtdTodoistPreferencesPanel a GtkBin subclass
- Date: Thu, 6 Jun 2019 01:20:31 +0000 (UTC)
commit 1e8e8ffb4e0a25bfadf84120e05f2ed7eba3b94c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jun 5 22:17:10 2019 -0300
todoist: Make GtdTodoistPreferencesPanel a GtkBin subclass
plugins/todoist/gtd-todoist-preferences-panel.c | 12 ++-
plugins/todoist/gtd-todoist-preferences-panel.h | 2 +-
plugins/todoist/ui/preferences.ui | 134 ++++++++++++------------
3 files changed, 77 insertions(+), 71 deletions(-)
---
diff --git a/plugins/todoist/gtd-todoist-preferences-panel.c b/plugins/todoist/gtd-todoist-preferences-panel.c
index 7b31f6a..a65f2aa 100644
--- a/plugins/todoist/gtd-todoist-preferences-panel.c
+++ b/plugins/todoist/gtd-todoist-preferences-panel.c
@@ -25,8 +25,9 @@
struct _GtdTodoistPreferencesPanel
{
- GtkStack parent;
+ GtkBin parent;
+ GtkStack *stack;
GoaClient *client;
GtkWidget *accounts_listbox;
GtkWidget *add_button;
@@ -34,7 +35,7 @@ struct _GtdTodoistPreferencesPanel
GtkWidget *empty_page;
};
-G_DEFINE_TYPE (GtdTodoistPreferencesPanel, gtd_todoist_preferences_panel, GTK_TYPE_STACK)
+G_DEFINE_TYPE (GtdTodoistPreferencesPanel, gtd_todoist_preferences_panel, GTK_TYPE_BIN)
GtdTodoistPreferencesPanel*
gtd_todoist_preferences_panel_new (void)
@@ -155,7 +156,7 @@ on_goa_account_added (GoaClient *client,
gtk_container_add (GTK_CONTAINER (box), desc);
gtk_container_add (GTK_CONTAINER (row), box);
- gtk_stack_set_visible_child (GTK_STACK (self), self->accounts_page);
+ gtk_stack_set_visible_child (self->stack, self->accounts_page);
gtk_list_box_insert (GTK_LIST_BOX (self->accounts_listbox), GTK_WIDGET (row), -1);
}
@@ -198,7 +199,7 @@ on_goa_account_removed (GoaClient *client,
/* Change to empty_page if the listbox becomes empty after this removal */
if (!todoist_accounts)
- gtk_stack_set_visible_child (GTK_STACK (self), self->empty_page);
+ gtk_stack_set_visible_child (self->stack, self->empty_page);
g_list_free (child);
}
@@ -278,6 +279,7 @@ gtd_todoist_preferences_panel_class_init (GtdTodoistPreferencesPanelClass *klass
gtk_widget_class_bind_template_child (widget_class, GtdTodoistPreferencesPanel, add_button);
gtk_widget_class_bind_template_child (widget_class, GtdTodoistPreferencesPanel, accounts_page);
gtk_widget_class_bind_template_child (widget_class, GtdTodoistPreferencesPanel, empty_page);
+ gtk_widget_class_bind_template_child (widget_class, GtdTodoistPreferencesPanel, stack);
gtk_widget_class_bind_template_callback (widget_class, account_row_clicked_cb);
}
@@ -290,7 +292,7 @@ gtd_todoist_preferences_panel_init (GtdTodoistPreferencesPanel *self)
gtk_widget_init_template (GTK_WIDGET (self));
/* Set Empty Page as the default initial preferences page */
- gtk_stack_set_visible_child (GTK_STACK (self), self->empty_page);
+ gtk_stack_set_visible_child (self->stack, self->empty_page);
label = gtk_label_new ("No Todoist account configured");
gtk_widget_show (label);
diff --git a/plugins/todoist/gtd-todoist-preferences-panel.h b/plugins/todoist/gtd-todoist-preferences-panel.h
index 133e40f..bda7057 100644
--- a/plugins/todoist/gtd-todoist-preferences-panel.h
+++ b/plugins/todoist/gtd-todoist-preferences-panel.h
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
#define GTD_TYPE_TODOIST_PREFERENCES_PANEL (gtd_todoist_preferences_panel_get_type())
-G_DECLARE_FINAL_TYPE (GtdTodoistPreferencesPanel, gtd_todoist_preferences_panel, GTD,
TODOIST_PREFERENCES_PANEL, GtkStack)
+G_DECLARE_FINAL_TYPE (GtdTodoistPreferencesPanel, gtd_todoist_preferences_panel, GTD,
TODOIST_PREFERENCES_PANEL, GtkBin)
GtdTodoistPreferencesPanel* gtd_todoist_preferences_panel_new (void);
diff --git a/plugins/todoist/ui/preferences.ui b/plugins/todoist/ui/preferences.ui
index fed9c68..31999ab 100644
--- a/plugins/todoist/ui/preferences.ui
+++ b/plugins/todoist/ui/preferences.ui
@@ -1,85 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.16"/>
- <template class="GtdTodoistPreferencesPanel" parent="GtkStack">
- <property name="transition_type">crossfade</property>
+ <template class="GtdTodoistPreferencesPanel" parent="GtkBin">
<child>
- <object class="GtkBox" id="accounts_page">
- <property name="margin_start">80</property>
- <property name="margin_end">80</property>
- <property name="margin_top">24</property>
- <property name="margin_bottom">24</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <object class="GtkStack" id="stack">
+ <property name="transition_type">crossfade</property>
<child>
- <object class="GtkImage" id="logo">
- <property name="pixel_size">64</property>
- <property name="icon_name">org.gnome.Todo</property>
- </object>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolled_window">
- <property name="can_focus">1</property>
- <property name="shadow_type">in</property>
- <property name="min_content_height">200</property>
- <property name="max_content_height">300</property>
+ <object class="GtkBox" id="accounts_page">
+ <property name="margin_start">80</property>
+ <property name="margin_end">80</property>
+ <property name="margin_top">24</property>
+ <property name="margin_bottom">24</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="logo">
+ <property name="pixel_size">64</property>
+ <property name="icon_name">org.gnome.Todo</property>
+ </object>
+ </child>
<child>
- <object class="GtkViewport" id="viewport">
- <property name="shadow_type">none</property>
+ <object class="GtkScrolledWindow" id="scrolled_window">
+ <property name="can_focus">1</property>
+ <property name="shadow_type">in</property>
+ <property name="min_content_height">200</property>
+ <property name="max_content_height">300</property>
<child>
- <object class="GtkListBox" id="accounts_listbox">
- <property name="selection-mode">none</property>
- <signal name="row-activated" handler="account_row_clicked_cb"/>
+ <object class="GtkViewport" id="viewport">
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkListBox" id="accounts_listbox">
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="account_row_clicked_cb"/>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
- </child>
- </object>
- <packing>
- <property name="name">accounts</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="empty_page">
- <property name="margin_start">24</property>
- <property name="margin_end">24</property>
- <property name="margin_top">80</property>
- <property name="margin_bottom">80</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage">
- <property name="pixel_size">96</property>
- <property name="icon_name">edit-find-symbolic</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
+ <packing>
+ <property name="name">accounts</property>
+ </packing>
</child>
<child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">No Todoist accounts found</property>
- <attributes>
- <attribute name="weight" value="bold"></attribute>
- <attribute name="scale" value="1.44"></attribute>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="add_button">
- <property name="label" translatable="yes">Add a Todoist account</property>
- <property name="can_focus">1</property>
- <property name="receives_default">1</property>
- <property name="halign">center</property>
+ <object class="GtkBox" id="empty_page">
+ <property name="margin_start">24</property>
+ <property name="margin_end">24</property>
+ <property name="margin_top">80</property>
+ <property name="margin_bottom">80</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage">
+ <property name="pixel_size">96</property>
+ <property name="icon_name">edit-find-symbolic</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">No Todoist accounts found</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ <attribute name="scale" value="1.44"></attribute>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="add_button">
+ <property name="label" translatable="yes">Add a Todoist account</property>
+ <property name="can_focus">1</property>
+ <property name="receives_default">1</property>
+ <property name="halign">center</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="name">empty</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="name">empty</property>
- <property name="position">1</property>
- </packing>
</child>
</template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]