FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Implement windows 8.1+ notifications · programcoder/hexchat@f4f27e4 · GitHub

Repository navigation

Commit f4f27e4

Browse files
committed
Implement windows 8.1+ notifications
This splits notifications up into multiple backends currently only libnotify on unix and win8 toasts. The win8 backend was originally written by @leeter though heavily modified.
1 parent a216ed1 commit f4f27e4

25 files changed

Lines changed: 871 additions & 147 deletions

‎po/POTFILES.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ src/fe-gtk/joind.c
3232
src/fe-gtk/maingui.c
3333
src/fe-gtk/menu.c
3434
src/fe-gtk/notifygui.c
35+
src/fe-gtk/plugin-notifications.c
3536
src/fe-gtk/plugin-tray.c
3637
src/fe-gtk/plugingui.c
3738
src/fe-gtk/rawlog.c

‎src/common/fe.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ typedef enum
178178
} feicon;
179179
void fe_tray_set_icon (feicon icon);
180180
void fe_tray_set_tooltip (const char *text);
181-
void fe_tray_set_balloon (const char *title, const char *text);
182181
void fe_open_chan_list (server *serv, char *filter, int do_refresh);
183182
const char *fe_get_default_font ();
184183

‎src/common/outbound.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,12 +3470,6 @@ cmd_topic (struct session *sess, char *tbuf, char *word[], char *word_eol[])
34703470
static int
34713471
cmd_tray (struct session *sess, char *tbuf, char *word[], char *word_eol[])
34723472
{
3473-
if (strcmp (word[2], "-b") == 0)
3474-
{
3475-
fe_tray_set_balloon (word[3], word[4][0] ? word[4] : NULL);
3476-
return TRUE;
3477-
}
3478-
34793473
if (strcmp (word[2], "-t") == 0)
34803474
{
34813475
fe_tray_set_tooltip (word[3][0] ? word[3] : NULL);

‎src/common/plugin.c‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,11 @@ plugin_kill_all (void)
355355

356356
#ifdef USE_PLUGIN
357357

358-
/* load a plugin from a filename. Returns: NULL-success or an error string */
359-
360-
char *
361-
plugin_load (session *sess, char *filename, char *arg)
358+
GModule *
359+
module_load (char *filename)
362360
{
363361
void *handle;
364362
char *filepart;
365-
hexchat_init_func *init_func;
366-
hexchat_deinit_func *deinit_func;
367363
char *pluginpath;
368364

369365
/* get the filename without path */
@@ -383,6 +379,18 @@ plugin_load (session *sess, char *filename, char *arg)
383379
handle = g_module_open (filename, 0);
384380
}
385381

382+
return handle;
383+
}
384+
385+
/* load a plugin from a filename. Returns: NULL-success or an error string */
386+
387+
char *
388+
plugin_load (session *sess, char *filename, char *arg)
389+
{
390+
GModule *handle = module_load (filename);
391+
hexchat_init_func *init_func;
392+
hexchat_deinit_func *deinit_func;
393+
386394
if (handle == NULL)
387395
return (char *)g_module_error ();
388396

‎src/common/plugin.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct _hexchat_plugin
163163
};
164164
#endif
165165

166+
GModule *module_load (char *filename);
166167
char *plugin_load (session *sess, char *filename, char *arg);
167168
int plugin_reload (session *sess, char *name, int by_filename);
168169
void plugin_add (session *sess, char *filename, void *handle, void *init_func, void *deinit_func, char *arg, int fake);

‎src/fe-gtk/Makefile.am‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ hexchat_LDADD = ../common/libhexchatcommon.a $(GUI_LIBS)
1212
EXTRA_DIST = \
1313
ascii.h banlist.h chanlist.h chanview.h chanview-tabs.c \
1414
chanview-tree.c custom-list.h editlist.h fe-gtk.h fkeys.h gtkutil.h joind.h \
15-
maingui.h menu.h notifygui.h palette.h pixmaps.h \
15+
maingui.h menu.h notifygui.h notifications palette.h pixmaps.h plugin-notification.h \
1616
plugin-tray.h plugingui.c plugingui.h rawlog.h sexy-iso-codes.h \
1717
sexy-spell-entry.h textgui.h urlgrab.h userlistgui.h xtext.h \
1818
../../data/hexchat.gresource.xml
@@ -29,10 +29,16 @@ if HAVE_ISO_CODES
2929
iso_codes_c = sexy-iso-codes.c
3030
endif
3131

32+
if USE_LIBNOTIFY
33+
notify_c = notifications/notification-libnotify.c
34+
else
35+
notify_c = notifications/notification-dummy.c
36+
endif
37+
3238
hexchat_SOURCES = ascii.c banlist.c chanlist.c chanview.c custom-list.c \
3339
dccgui.c editlist.c fe-gtk.c fkeys.c gtkutil.c ignoregui.c joind.c menu.c \
34-
maingui.c notifygui.c palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
35-
rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) \
40+
maingui.c notifygui.c $(notify_c) palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
41+
plugin-notification.c rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) \
3642
sexy-spell-entry.c textgui.c urlgrab.c userlistgui.c xtext.c
3743
hexchat_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/common
3844

‎src/fe-gtk/fe-gtk.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "plugin-tray.h"
5353
#include "urlgrab.h"
5454
#include "setup.h"
55+
#include "plugin-notification.h"
5556

5657
#ifdef USE_LIBCANBERRA
5758
#include <canberra.h>
@@ -381,6 +382,8 @@ fe_idle (gpointer data)
381382
{
382383
session *sess = sess_list->data;
383384

385+
plugin_add (sess, NULL, NULL, notification_plugin_init, notification_plugin_deinit, NULL, FALSE);
386+
384387
plugin_add (sess, NULL, NULL, tray_plugin_init, tray_plugin_deinit, NULL, FALSE);
385388

386389
if (arg_minimize == 1)

‎src/fe-gtk/fe-gtk.vcxproj‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<FunctionLevelLinking>true</FunctionLevelLinking>
6161
<IntrinsicFunctions>true</IntrinsicFunctions>
6262
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
63-
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
63+
<AdditionalIncludeDirectories>$(SolutionDir)..;..\common;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
6464
<MultiProcessorCompilation>true</MultiProcessorCompilation>
6565
<DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
6666
</ClCompile>
@@ -81,7 +81,7 @@
8181
<FunctionLevelLinking>true</FunctionLevelLinking>
8282
<IntrinsicFunctions>true</IntrinsicFunctions>
8383
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
84-
<AdditionalIncludeDirectories>$(SolutionDir)..;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
84+
<AdditionalIncludeDirectories>$(SolutionDir)..;..\common;$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
8585
<MultiProcessorCompilation>true</MultiProcessorCompilation>
8686
<DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
8787
</ClCompile>
@@ -120,6 +120,7 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u
120120
<ClInclude Include="joind.h" />
121121
<ClInclude Include="maingui.h" />
122122
<ClInclude Include="menu.h" />
123+
<ClInclude Include="notifications\notification-backend.h" />
123124
<ClInclude Include="notifygui.h" />
124125
<ClInclude Include="palette.h" />
125126
<ClInclude Include="pixmaps.h" />
@@ -150,9 +151,11 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u
150151
<ClCompile Include="joind.c" />
151152
<ClCompile Include="maingui.c" />
152153
<ClCompile Include="menu.c" />
154+
<ClCompile Include="notifications\notification-windows.c" />
153155
<ClCompile Include="notifygui.c" />
154156
<ClCompile Include="palette.c" />
155157
<ClCompile Include="pixmaps.c" />
158+
<ClCompile Include="plugin-notification.c" />
156159
<ClCompile Include="plugin-tray.c" />
157160
<ClCompile Include="plugingui.c" />
158161
<ClCompile Include="rawlog.c" />
@@ -167,7 +170,7 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u
167170
<ClCompile Include="xtext.c" />
168171
</ItemGroup>
169172
<ItemGroup>
170-
<Manifest Include="hexchat.exe.manifest" />
173+
<Manifest Include="..\..\win32\hexchat.exe.manifest" />
171174
</ItemGroup>
172175
<ItemGroup>
173176
<None Include="hexchat.rc.tt" />

‎src/fe-gtk/fe-gtk.vcxproj.filters‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
<ClInclude Include="setup.h">
9494
<Filter>Header Files</Filter>
9595
</ClInclude>
96+
<ClInclude Include="notifications\notification-backend.h">
97+
<Filter>Header Files</Filter>
98+
</ClInclude>
9699
</ItemGroup>
97100
<ItemGroup>
98101
<ClCompile Include="ascii.c">
@@ -182,9 +185,15 @@
182185
<ClCompile Include="resources.c">
183186
<Filter>Source Files</Filter>
184187
</ClCompile>
188+
<ClCompile Include="plugin-notification.c">
189+
<Filter>Source Files</Filter>
190+
</ClCompile>
191+
<ClCompile Include="notifications\notification-windows.c">
192+
<Filter>Source Files</Filter>
193+
</ClCompile>
185194
</ItemGroup>
186195
<ItemGroup>
187-
<Manifest Include="hexchat.exe.manifest">
196+
<Manifest Include="..\..\win32\hexchat.exe.manifest">
188197
<Filter>Resource Files</Filter>
189198
</Manifest>
190199
</ItemGroup>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* HexChat
2+
* Copyright (C) 2015 Patrick Griffis.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17+
*/
18+
19+
#ifndef HEXCHAT_PLUGIN_NOTIFICATION_BACKEND_H
20+
#define HEXCHAT_PLUGIN_NOTIFICATION_BACKEND_H
21+
22+
int notification_backend_supported (void);
23+
void notification_backend_show (const char *title, const char *text, int timeout);
24+
int notification_backend_init (void);
25+
void notification_backend_deinit (void);
26+
27+
#endif

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL