[gnome-software] Use GtkRevealer instead of GdNotification
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Use GtkRevealer instead of GdNotification
- Date: Tue, 29 Nov 2016 15:14:00 +0000 (UTC)
commit d5f84f14c954faf6323d643ef7d404e184d3a6a9
Author: Richard Hughes <richard hughsie com>
Date: Tue Nov 29 15:10:49 2016 +0000
Use GtkRevealer instead of GdNotification
Inspired by a patch from Felipe Borges, many thanks.
src/Makefile.am | 2 -
src/gd-notification.c | 875 -------------------------------------------------
src/gd-notification.h | 67 ----
src/gnome-software.ui | 31 ++-
src/gs-application.c | 5 -
src/gs-shell.c | 12 +-
6 files changed, 31 insertions(+), 961 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 4d82076..978b2d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -147,8 +147,6 @@ bin_PROGRAMS = \
gnome_software_SOURCES = \
gnome-software.h \
- gd-notification.c \
- gd-notification.h \
gs-utils.c \
gs-utils.h \
gs-app.c \
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 5333412..16d0a57 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -307,15 +307,18 @@
<property name="halign">fill</property>
<property name="valign">fill</property>
<child type="overlay">
- <object class="GdNotification" id="notification_event">
- <property name="app_paintable">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">True</property>
+ <object class="GtkRevealer" id="notification_event">
+ <property name="visible">True</property>
+ <property name="halign">GTK_ALIGN_CENTER</property>
+ <property name="valign">GTK_ALIGN_START</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
- <property name="spacing">24</property>
+ <property name="spacing">6</property>
<property name="visible">True</property>
+ <style>
+ <class name="app-notification"/>
+ </style>
<child>
<object class="GtkLabel" id="label_events">
<property name="visible">True</property>
@@ -324,6 +327,9 @@
<property name="label">Some Title</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
+ <property name="max_width_chars">60</property>
+ <property name="margin_start">9</property>
+ <property name="margin_end">9</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -388,6 +394,21 @@
<property name="fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="button_events_dismiss">
+ <property name="visible">True</property>
+ <property name="valign">GTK_ALIGN_CENTER</property>
+ <style>
+ <class name="flat"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">window-close-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/gs-application.c b/src/gs-application.c
index 22b262d..7d267d5 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -40,8 +40,6 @@
#endif
#endif
-#include "gd-notification.h"
-
#ifdef HAVE_PACKAGEKIT
#include "gs-dbus-helper.h"
#endif
@@ -232,9 +230,6 @@ gs_application_initialize_ui (GsApplication *app)
initialized = TRUE;
- /* register ahead of loading the .ui file */
- gd_notification_get_type ();
-
/* get CSS */
app->provider = gtk_css_provider_new ();
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
diff --git a/src/gs-shell.c b/src/gs-shell.c
index a05e585..35f5322 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -25,8 +25,6 @@
#include <string.h>
#include <glib/gi18n.h>
-#include "gd-notification.h"
-
#include "gs-common.h"
#include "gs-shell.h"
#include "gs-shell-details.h"
@@ -731,7 +729,7 @@ gs_shell_show_event_app_notify (GsShell *shell,
/* set visible */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "notification_event"));
- gtk_widget_set_visible (widget, TRUE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (widget), TRUE);
/* sources button */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_events_sources"));
@@ -1472,7 +1470,7 @@ gs_shell_rescan_events (GsShell *shell)
/* nothing to show */
g_debug ("no events to show");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "notification_event"));
- gtk_widget_set_visible (widget, FALSE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (widget), FALSE);
}
static void
@@ -1484,7 +1482,7 @@ gs_shell_events_notify_cb (GsPluginLoader *plugin_loader,
}
static void
-gs_shell_plugin_event_dismissed_cb (GdNotification *notification, GsShell *shell)
+gs_shell_plugin_event_dismissed_cb (GtkButton *button, GsShell *shell)
{
GPtrArray *events;
GsShellPrivate *priv = gs_shell_get_instance_private (shell);
@@ -1589,8 +1587,8 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
G_CALLBACK (gs_shell_overview_button_cb), shell);
/* set up in-app notification controls */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "notification_event"));
- g_signal_connect (widget, "dismissed",
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_events_dismiss"));
+ g_signal_connect (widget, "clicked",
G_CALLBACK (gs_shell_plugin_event_dismissed_cb), shell);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_events_sources"));
g_signal_connect (widget, "clicked",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]