summaryrefslogtreecommitdiff
path: root/libmate-panel-applet
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2025-09-19 18:21:23 -0400
committerVictor Kareh <[email protected]>2026-01-20 17:20:00 -0500
commitd90d89d53964a2c2bf3d773113a068a30e501a5a (patch)
tree79f084f18b34a4864e30d62ba2a6a10055babf1a /libmate-panel-applet
parent3e62b847f6e957cf8c53bb705f75f753d949dca2 (diff)
downloadmate-panel-d90d89d53964a2c2bf3d773113a068a30e501a5a.tar.bz2
mate-panel-d90d89d53964a2c2bf3d773113a068a30e501a5a.tar.xz
libmate-panel-applet: Register 'Activate' DBus method
This in turn emits an 'activate' signal that any applet can connect to and perform whatever action it means to activate in that applet. This allows users to control certain applet functionalities through DBus, like registering new keybindings, or integrating them with other software.
Diffstat (limited to 'libmate-panel-applet')
-rw-r--r--libmate-panel-applet/mate-panel-applet.c28
-rw-r--r--libmate-panel-applet/mate-panel-applet.h4
2 files changed, 32 insertions, 0 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index 897f1726..a4118165 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -94,6 +94,7 @@ enum {
CHANGE_SIZE,
CHANGE_BACKGROUND,
MOVE_FOCUS_OUT_OF_APPLET,
+ ACTIVATE,
LAST_SIGNAL
};
@@ -2150,6 +2151,19 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass)
1,
GTK_TYPE_DIRECTION_TYPE);
+ mate_panel_applet_signals [ACTIVATE] =
+ g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (MatePanelAppletClass, activate),
+ g_signal_accumulator_true_handled,
+ NULL,
+ NULL,
+ G_TYPE_BOOLEAN,
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_UINT);
+
binding_set = gtk_binding_set_by_class (gobject_class);
add_tab_bindings (binding_set, 0, GTK_DIR_TAB_FORWARD);
add_tab_bindings (binding_set, GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
@@ -2213,6 +2227,15 @@ method_call_cb (GDBusConnection *connection,
gdk_event_free (event);
g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "Activate") == 0) {
+ const gchar *action;
+ guint32 timestamp;
+ gboolean success = FALSE;
+
+ g_variant_get (parameters, "(&su)", &action, &timestamp);
+
+ g_signal_emit_by_name (applet, "activate", action, timestamp, &success);
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", success));
}
}
@@ -2303,6 +2326,11 @@ static const gchar introspection_xml[] =
"<arg name='button' type='u' direction='in'/>"
"<arg name='time' type='u' direction='in'/>"
"</method>"
+ "<method name='Activate'>"
+ "<arg name='action' type='s' direction='in'/>"
+ "<arg name='timestamp' type='u' direction='in'/>"
+ "<arg name='success' type='b' direction='out'/>"
+ "</method>"
"<property name='PrefsPath' type='s' access='readwrite'/>"
"<property name='Orient' type='u' access='readwrite' />"
"<property name='Size' type='u' access='readwrite'/>"
diff --git a/libmate-panel-applet/mate-panel-applet.h b/libmate-panel-applet/mate-panel-applet.h
index 9cc48ae8..5c8550dc 100644
--- a/libmate-panel-applet/mate-panel-applet.h
+++ b/libmate-panel-applet/mate-panel-applet.h
@@ -78,6 +78,10 @@ struct _MatePanelAppletClass {
void (*move_focus_out_of_applet) (MatePanelApplet *frame,
GtkDirectionType direction);
+
+ gboolean (*activate) (MatePanelApplet *applet,
+ const gchar *action,
+ guint32 timestamp);
};
GtkWidget* mate_panel_applet_new (void);