[gnome-todo] notification-widget: Make it a GtkBin
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] notification-widget: Make it a GtkBin
- Date: Wed, 5 Jun 2019 23:23:05 +0000 (UTC)
commit 9a185b549e50445c654555e3191df62a1dd97339
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jun 5 20:22:45 2019 -0300
notification-widget: Make it a GtkBin
src/notification/gtd-notification-widget.c | 9 +--
src/notification/gtd-notification-widget.h | 2 +-
src/notification/gtd-notification-widget.ui | 92 +++++++++++++++--------------
3 files changed, 54 insertions(+), 49 deletions(-)
---
diff --git a/src/notification/gtd-notification-widget.c b/src/notification/gtd-notification-widget.c
index de898f4..a9e39a1 100644
--- a/src/notification/gtd-notification-widget.c
+++ b/src/notification/gtd-notification-widget.c
@@ -29,12 +29,13 @@ typedef enum
struct _GtdNotificationWidget
{
- GtkRevealer parent;
+ GtkBin parent;
/* widgets */
GtkButton *secondary_button;
GtkSpinner *spinner;
GtkLabel *text_label;
+ GtkRevealer *revealer;
/* internal data */
GQueue *queue;
@@ -55,7 +56,7 @@ static void execute_notification (GtdNotificatio
static void on_notification_executed_cb (GtdNotification *notification,
GtdNotificationWidget *self);
-G_DEFINE_TYPE (GtdNotificationWidget, gtd_notification_widget, GTK_TYPE_REVEALER)
+G_DEFINE_TYPE (GtdNotificationWidget, gtd_notification_widget, GTK_TYPE_BIN)
static void
clear_bindings (GtdNotificationWidget *self)
@@ -79,13 +80,13 @@ stop_or_run_notifications (GtdNotificationWidget *self)
if (self->current_notification)
{
- gtk_revealer_set_reveal_child (GTK_REVEALER (self), TRUE);
+ gtk_revealer_set_reveal_child (self->revealer, TRUE);
execute_notification (self, self->current_notification);
self->state = STATE_EXECUTING;
}
else
{
- gtk_revealer_set_reveal_child (GTK_REVEALER (self), FALSE);
+ gtk_revealer_set_reveal_child (self->revealer, FALSE);
self->state = STATE_IDLE;
}
}
diff --git a/src/notification/gtd-notification-widget.h b/src/notification/gtd-notification-widget.h
index d80abb2..a4e7510 100644
--- a/src/notification/gtd-notification-widget.h
+++ b/src/notification/gtd-notification-widget.h
@@ -27,7 +27,7 @@ G_BEGIN_DECLS
#define GTD_TYPE_NOTIFICATION_WIDGET (gtd_notification_widget_get_type())
-G_DECLARE_FINAL_TYPE (GtdNotificationWidget, gtd_notification_widget, GTD, NOTIFICATION_WIDGET, GtkRevealer)
+G_DECLARE_FINAL_TYPE (GtdNotificationWidget, gtd_notification_widget, GTD, NOTIFICATION_WIDGET, GtkBin)
GtkWidget* gtd_notification_widget_new (void);
diff --git a/src/notification/gtd-notification-widget.ui b/src/notification/gtd-notification-widget.ui
index dbbdf08..f72bc95 100644
--- a/src/notification/gtd-notification-widget.ui
+++ b/src/notification/gtd-notification-widget.ui
@@ -1,58 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.16"/>
- <template class="GtdNotificationWidget" parent="GtkRevealer">
+ <template class="GtdNotificationWidget" parent="GtkBin">
<child>
- <object class="GtkEventControllerMotion">
- <signal name="enter" handler="on_motion_controller_enter_cb" object="GtdNotificationWidget"
swapped="no"/>
- <signal name="leave" handler="on_motion_controller_leave_cb" object="GtdNotificationWidget"
swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkFrame" id="frame">
- <property name="shadow_type">none</property>
+ <object class="GtkRevealer" id="revealer">
<child>
- <object class="GtkBox" id="box">
- <property name="spacing">12</property>
- <child>
- <object class="GtkSpinner" id="spinner">
- <property name="visible">0</property>
- <property name="active">1</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="text_label">
- <property name="hexpand">1</property>
- <property name="use_markup">1</property>
- <property name="xalign">0</property>
- <property name="max-width-chars">30</property>
- <property name="ellipsize">middle</property>
- </object>
- </child>
+ <object class="GtkEventControllerMotion">
+ <signal name="enter" handler="on_motion_controller_enter_cb" object="GtdNotificationWidget"
swapped="no"/>
+ <signal name="leave" handler="on_motion_controller_leave_cb" object="GtdNotificationWidget"
swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame">
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkButton" id="secondary_button">
- <property name="can_focus">1</property>
- <property name="receives_default">1</property>
- <signal name="clicked" handler="on_secondary_button_clicked_cb"
object="GtdNotificationWidget" swapped="yes"/>
+ <object class="GtkBox" id="box">
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkSpinner" id="spinner">
+ <property name="visible">0</property>
+ <property name="active">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="text_label">
+ <property name="hexpand">1</property>
+ <property name="use_markup">1</property>
+ <property name="xalign">0</property>
+ <property name="max-width-chars">30</property>
+ <property name="ellipsize">middle</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="secondary_button">
+ <property name="can_focus">1</property>
+ <property name="receives_default">1</property>
+ <signal name="clicked" handler="on_secondary_button_clicked_cb"
object="GtdNotificationWidget" swapped="yes"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="can_focus">1</property>
+ <property name="receives_default">1</property>
+ <property name="relief">none</property>
+ <property name="icon-name">window-close-symbolic</property>
+ <signal name="clicked" handler="on_close_button_clicked_cb"
object="GtdNotificationWidget" swapped="yes"/>
+ </object>
+ </child>
</object>
</child>
- <child>
- <object class="GtkButton" id="close_button">
- <property name="can_focus">1</property>
- <property name="receives_default">1</property>
- <property name="relief">none</property>
- <property name="icon-name">window-close-symbolic</property>
- <signal name="clicked" handler="on_close_button_clicked_cb" object="GtdNotificationWidget"
swapped="yes"/>
- </object>
+ <child type="label_item">
+ <placeholder/>
</child>
+ <style>
+ <class name="app-notification"/>
+ </style>
</object>
</child>
- <child type="label_item">
- <placeholder/>
- </child>
- <style>
- <class name="app-notification"/>
- </style>
</object>
</child>
</template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]