Merge lp:~philip.scott/granite/notifications-demo into lp:~elementary-pantheon/granite/granite

Proposed by Felipe Escoto
Status: Rejected
Rejected by: Zisu Andrei
Proposed branch: lp:~philip.scott/granite/notifications-demo
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 80 lines (+38/-1)
2 files modified
demo/CMakeLists.txt (+1/-1)
demo/GraniteDemo.vala (+37/-0)
To merge this branch: bzr merge lp:~philip.scott/granite/notifications-demo
Reviewer Review Type Date Requested Status
Adam Bieńkowski (community) code / testing Needs Fixing
Review via email: mp+297848@code.launchpad.net

Commit message

Notification Demo Added

Description of the change

Adds a notifications demo to Granite Demo.

It also updates it's .desktop to use the correct name.

Note: The notifications sent from the Demo have no icon set manually, this is intended as the Gala branch that fixes this will land soon

To post a comment you must log in.
Revision history for this message
Adam Bieńkowski (donadigo) wrote :

It looks & works great, but following recent changes we should have "X-GNOME-UsesNotifications=true" in the .desktop file to fully support the app settings. Also I'm not sure if we want to showcase non-granite feature in a granite-demo app, notice how all widgets & functions there are granite specific.

review: Needs Fixing (code / testing)

Unmerged revisions

951. By Felipe Escoto

Notifications Demo

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'demo/CMakeLists.txt'
2--- demo/CMakeLists.txt 2015-12-04 07:55:06 +0000
3+++ demo/CMakeLists.txt 2016-06-19 22:42:07 +0000
4@@ -22,4 +22,4 @@
5 add_executable (${EXEC_NAME} ${VALA_C})
6 target_link_libraries (${EXEC_NAME} ${PKG_NAME} ${DEPS_LIBRARIES})
7 install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin)
8-install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/granite-demo.desktop DESTINATION share/applications)
9+install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.pantheon.granite.demo.desktop DESTINATION share/applications)
10
11=== modified file 'demo/GraniteDemo.vala'
12--- demo/GraniteDemo.vala 2016-06-12 01:46:50 +0000
13+++ demo/GraniteDemo.vala 2016-06-19 22:42:07 +0000
14@@ -81,6 +81,7 @@
15 create_dynamictab ();
16 create_alert ();
17 create_storage ();
18+ create_notification ();
19
20 window.add (main_stack);
21 window.set_default_size (800, 550);
22@@ -126,6 +127,7 @@
23 welcome.append ("document-open", "DynamicNotebook", "Tab bar widget designed for a variable number of tabs.");
24 welcome.append ("dialog-warning", "AlertView", "A View showing that an action is required to function.");
25 welcome.append ("drive-harddisk", "Storage", "Small bar indicating the remaining amount of space.");
26+ welcome.append ("dialog-information", "Notifications", "A simple test of how notifications work.");
27 welcome.activated.connect ((index) => {
28 switch (index) {
29 case 0:
30@@ -152,6 +154,10 @@
31 home_button.show ();
32 main_stack.set_visible_child_name ("storage");
33 break;
34+ case 6:
35+ home_button.show ();
36+ main_stack.set_visible_child_name ("notifications");
37+ break;
38 }
39 });
40 main_stack.add_named (welcome, "welcome");
41@@ -289,6 +295,37 @@
42 });
43 }
44
45+ private void create_notification () {
46+ var grid = new Gtk.Grid ();
47+ grid.row_spacing = 6;
48+ grid.column_spacing = 12;
49+ grid.valign = Gtk.Align.CENTER;
50+ grid.halign = Gtk.Align.CENTER;
51+ grid.orientation = Gtk.Orientation.VERTICAL;
52+
53+ var show_button = new Gtk.Button.with_label (_("Send Notification"));
54+ var update_button = new Gtk.Button.with_label (("Update Notification"));
55+
56+ show_button.clicked.connect (() => {
57+ var notification = new Notification (_("Testing notifications"));
58+
59+ notification.set_body (_("Hello world!"));
60+ this.send_notification ("notification_key", notification);
61+ });
62+
63+ update_button.clicked.connect (() => {
64+ var notification = new Notification (_("Testing notifications"));
65+
66+ notification.set_body (_("Hello again!"));
67+ this.send_notification ("notification_key", notification);
68+ });
69+
70+ grid.add (show_button);
71+ grid.add (update_button);
72+
73+ main_stack.add_named (grid, "notifications");
74+ }
75+
76 private Granite.Widgets.Avatar create_avatar () {
77 var username = GLib.Environment.get_user_name ();
78 var avatar = new Granite.Widgets.Avatar ();
79
80=== renamed file 'demo/granite-demo.desktop' => 'demo/org.pantheon.granite.demo.desktop'

Subscribers

People subscribed via source and target branches