Prelim: Scaffolding some SNI stuff for tray

This commit is contained in:
Rory Fewell
2025-10-14 19:04:10 +01:00
parent 315ff425a5
commit 7ec8466462
4 changed files with 172 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ set(WINTC_NO_PEDANTIC_COMPILE true) # Necessary due to NetworkManager headers
include(GNUInstallDirs)
include(../../packaging/cmake-inc/common/CMakeLists.txt)
include(../../packaging/cmake-inc/codegen/CMakeLists.txt)
include(../../packaging/cmake-inc/linking/CMakeLists.txt)
include(../../packaging/cmake-inc/locale/CMakeLists.txt)
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
@@ -43,6 +44,14 @@ wintc_resolve_library(wintc-sndapi WINTC_SNDAPI)
wintc_compile_resources()
wintc_create_meta_h()
wintc_gdbus_codegen(
snw-dbus.xml
snw-dbus
org.kde.
ZWinKde
false
)
# FIXME: For now, exclude the network icon stuff from build on FreeBSD
set(
TASKBAND_SOURCES
@@ -52,6 +61,8 @@ set(
src/main.c
src/meta.h
src/resources.c
src/snw-dbus.c
src/snw-dbus.h
src/window.c
src/window.h
src/start/menumod.c

View File

@@ -0,0 +1,38 @@
<interface name="org.kde.StatusNotifierWatcher">
<!-- methods -->
<method name="RegisterStatusNotifierItem">
<arg name="service" type="s" direction="in"/>
</method>
<method name="RegisterStatusNotifierHost">
<arg name="service" type="s" direction="in"/>
</method>
<!-- properties -->
<property name="RegisteredStatusNotifierItems" type="as" access="read">
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QStringList"/>
</property>
<property name="IsStatusNotifierHostRegistered" type="b" access="read"/>
<property name="ProtocolVersion" type="i" access="read"/>
<!-- signals -->
<signal name="StatusNotifierItemRegistered">
<arg type="s"/>
</signal>
<signal name="StatusNotifierItemUnregistered">
<arg type="s"/>
</signal>
<signal name="StatusNotifierHostRegistered">
</signal>
<signal name="StatusNotifierHostUnregistered">
</signal>
</interface>

View File

@@ -0,0 +1,102 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/comgtk.h>
#include <wintc/shellext.h>
#include "../intapi.h"
#include "../snw-dbus.h"
#include "icon.h"
#include "sni.h"
//
// FORWARD DECLARATIONS
//
static void wintc_notification_sni_constructed(
GObject* object
);
static void on_name_acquired(
GDBusConnection* connection,
const gchar* name,
gpointer user_data
);
static void on_name_lost(
GDBusConnection* connection,
const gchar* name,
gpointer user_data
);
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCNotificationSni
{
WinTCShextUIController __parent__;
ZWinKdeStatusNotifierWatcher* dbus_snw;
};
//
// GTK TYPE DEFINITIONS & CTORS
//
G_DEFINE_TYPE(
WinTCNotificationSni,
wintc_notification_sni,
WINTC_TYPE_SHEXT_UI_CONTROLLER
)
static void wintc_notification_sni_class_init(
WinTCNotificationSniClass* klass
)
{
}
static void wintc_notification_sni_init(
WinTCNotificationSni* self
)
{
g_bus_own_name(
G_BUS_TYPE_SESSION,
"org.kde.StatusNotifierWatcher",
G_BUS_NAME_OWNER_FLAGS_NONE,
NULL,
on_name_acquired,
on_name_lost,
self,
NULL
);
}
//
// CLASS VIRTUAL METHODS
//
static void wintc_notification_sni_constructed(
GObject* object
)
{
}
//
// CALLBACKS
//
static void on_name_acquired(
GDBusConnection* connection,
const gchar* name,
gpointer user_data
)
{
WinTCNotificationSni* notif_sni = WINTC_NOTIFICATION_SNI(user_data);
// Create the DBus host
//
ZWinKdeStatusNotifierWatcher* dbus_snw =
zwin_kde_status_notifier_watcher_new();
}
static void on_name_lost(
GDBusConnection* connection,
const gchar* name,
gpointer user_data
)
{
}

View File

@@ -0,0 +1,21 @@
#ifndef __SYSTRAY_SNI_H__
#define __SYSTRAY_SNI_H__
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/shellext.h>
//
// GTK OOP BOILERPLATE
//
#define WINTC_TYPE_NOTIFICATION_SNI (wintc_notification_sni_get_type())
G_DECLARE_FINAL_TYPE(
WinTCNotificationSni,
wintc_notification_sni,
WINTC,
NOTIFICATION_SNI,
WinTCShextUIController
)
#endif