Merge lp:~midori/midori/win32-tray-balloons into lp:midori

Proposed by Paweł Forysiuk
Status: Work in progress
Proposed branch: lp:~midori/midori/win32-tray-balloons
Merge into: lp:midori
Diff against target: 63 lines (+39/-0)
1 file modified
midori/midori-app.c (+39/-0)
To merge this branch: bzr merge lp:~midori/midori/win32-tray-balloons
Reviewer Review Type Date Requested Status
Midori Devs Pending
Review via email: mp+255744@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

6912. By Paweł Forysiuk <email address hidden>

Add simple notification support using NotifyIcon

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-app.c'
2--- midori/midori-app.c 2015-03-23 22:07:04 +0000
3+++ midori/midori-app.c 2015-04-09 18:55:09 +0000
4@@ -1121,6 +1121,15 @@
5 *
6 * Since 0.1.7
7 **/
8+
9+#ifdef G_OS_WIN32
10+guint notify_icon_delete (NOTIFYICONDATA* nid)
11+{
12+ Shell_NotifyIcon (NIM_DELETE, nid);
13+ return FALSE;
14+}
15+#endif
16+
17 void
18 midori_app_send_notification (MidoriApp* app,
19 const gchar* title,
20@@ -1129,6 +1138,35 @@
21 g_return_if_fail (MIDORI_IS_APP (app));
22 g_return_if_fail (title);
23
24+ #ifdef G_OS_WIN32
25+ gchar* exec_dir = g_win32_get_package_installation_directory_of_module (NULL);
26+ gchar* exec_path = g_build_filename (exec_dir, "bin", "midori.exe", NULL);
27+
28+ NOTIFYICONDATA* nid = NULL;
29+ nid = g_malloc0 (sizeof (NOTIFYICONDATA));
30+ nid->cbSize = sizeof (NOTIFYICONDATA);
31+
32+ nid->uFlags = NIF_INFO | NIF_ICON;
33+ nid->dwInfoFlags = NIIF_USER;
34+
35+ guint title_len = 64;
36+ guint message_len = 256;
37+
38+ g_strlcpy(nid->szInfoTitle, title, title_len-1);
39+ g_strlcpy(nid->szInfo, message, message_len-1);
40+
41+ HICON hIcon = NULL;
42+ hIcon = ExtractIcon (NULL, exec_path, 0);
43+ nid->hIcon = hIcon;
44+
45+ Shell_NotifyIcon (NIM_ADD, nid);
46+
47+ g_free (exec_dir);
48+ g_free (exec_path);
49+
50+ g_timeout_add (8000, notify_icon_delete, nid);
51+ #else
52+
53 #ifdef HAVE_LIBNOTIFY
54 if (notify_is_initted ())
55 {
56@@ -1149,6 +1187,7 @@
57 g_application_send_notification (G_APPLICATION (app), NULL, notification);
58 g_object_unref (notification);
59 #endif
60+ #endif
61 }
62
63 /**

Subscribers

People subscribed via source and target branches

to all changes: