83 | 83 |
gchar *label;
|
84 | 84 |
gboolean visible;
|
85 | 85 |
gint icon_size;
|
|
86 |
gchar *metadata;
|
86 | 87 |
|
87 | 88 |
guint owner_id;
|
88 | 89 |
guint listener_id;
|
|
254 | 255 |
}
|
255 | 256 |
|
256 | 257 |
static void
|
|
258 |
primary_menu_unmapped (GtkWidget *widget,
|
|
259 |
gpointer user_data)
|
|
260 |
{
|
|
261 |
g_return_if_fail (XAPP_IS_STATUS_ICON (user_data));
|
|
262 |
XAppStatusIcon *icon = XAPP_STATUS_ICON (user_data);
|
|
263 |
|
|
264 |
g_debug ("XAppStatusIcon: Primary menu unmapped");
|
|
265 |
|
|
266 |
if (icon->priv->state == XAPP_STATUS_ICON_STATE_NATIVE)
|
|
267 |
{
|
|
268 |
xapp_status_icon_interface_set_primary_menu_is_open (icon->priv->skeleton, FALSE);
|
|
269 |
}
|
|
270 |
|
|
271 |
g_signal_handlers_disconnect_by_func (widget, primary_menu_unmapped, icon);
|
|
272 |
}
|
|
273 |
|
|
274 |
static void
|
|
275 |
secondary_menu_unmapped (GtkWidget *widget,
|
|
276 |
gpointer user_data)
|
|
277 |
{
|
|
278 |
g_return_if_fail (XAPP_IS_STATUS_ICON (user_data));
|
|
279 |
XAppStatusIcon *icon = XAPP_STATUS_ICON (user_data);
|
|
280 |
|
|
281 |
g_debug ("XAppStatusIcon: Secondary menu unmapped");
|
|
282 |
|
|
283 |
if (icon->priv->state == XAPP_STATUS_ICON_STATE_NATIVE)
|
|
284 |
{
|
|
285 |
xapp_status_icon_interface_set_secondary_menu_is_open (icon->priv->skeleton, FALSE);
|
|
286 |
}
|
|
287 |
|
|
288 |
g_signal_handlers_disconnect_by_func (widget, secondary_menu_unmapped, icon);
|
|
289 |
}
|
|
290 |
|
|
291 |
static void
|
257 | 292 |
popup_menu (XAppStatusIcon *self,
|
258 | 293 |
GtkMenu *menu,
|
259 | 294 |
gint x,
|
|
286 | 321 |
* can use for themes to restore things bit if we want. Just avoid shadows. */
|
287 | 322 |
gtk_style_context_remove_class (context, "csd");
|
288 | 323 |
gtk_style_context_add_class (context, "xapp-status-icon-menu-window");
|
|
324 |
}
|
|
325 |
|
|
326 |
if (button == GDK_BUTTON_PRIMARY)
|
|
327 |
{
|
|
328 |
if (self->priv->state == XAPP_STATUS_ICON_STATE_NATIVE)
|
|
329 |
{
|
|
330 |
xapp_status_icon_interface_set_primary_menu_is_open (self->priv->skeleton, TRUE);
|
|
331 |
}
|
|
332 |
|
|
333 |
g_signal_connect (gtk_widget_get_toplevel (GTK_WIDGET (menu)),
|
|
334 |
"unmap",
|
|
335 |
G_CALLBACK (primary_menu_unmapped),
|
|
336 |
self);
|
|
337 |
}
|
|
338 |
else
|
|
339 |
if (button == GDK_BUTTON_SECONDARY)
|
|
340 |
{
|
|
341 |
if (self->priv->state == XAPP_STATUS_ICON_STATE_NATIVE)
|
|
342 |
{
|
|
343 |
xapp_status_icon_interface_set_secondary_menu_is_open (self->priv->skeleton, TRUE);
|
|
344 |
}
|
|
345 |
|
|
346 |
g_signal_connect (gtk_widget_get_toplevel (GTK_WIDGET (menu)),
|
|
347 |
"unmap",
|
|
348 |
G_CALLBACK (secondary_menu_unmapped),
|
|
349 |
self);
|
289 | 350 |
}
|
290 | 351 |
|
291 | 352 |
event = synthesize_event (self,
|
|
673 | 734 |
"icon-name", priv->icon_name,
|
674 | 735 |
"tooltip-text", priv->tooltip_text,
|
675 | 736 |
"visible", priv->visible,
|
|
737 |
"metadata", priv->metadata,
|
676 | 738 |
NULL);
|
677 | 739 |
|
678 | 740 |
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (priv->skeleton));
|
|
1742 | 1804 |
}
|
1743 | 1805 |
|
1744 | 1806 |
/**
|
|
1807 |
* xapp_status_icon_set_metadata:
|
|
1808 |
* @icon: an #XAppStatusIcon
|
|
1809 |
* @metadata: (nullable): A json-formatted string of key:values.
|
|
1810 |
*
|
|
1811 |
* Sets metadata to pass to the icon proxy for an applet's use. Right now this is only so
|
|
1812 |
* xapp-sn-watcher can tell the applets when the icon is originating from appindicator so panel
|
|
1813 |
* button 'highlighting' can behave correctly.
|
|
1814 |
*
|
|
1815 |
* Since: 1.8.7
|
|
1816 |
*/
|
|
1817 |
void
|
|
1818 |
xapp_status_icon_set_metadata (XAppStatusIcon *icon,
|
|
1819 |
const gchar *metadata)
|
|
1820 |
{
|
|
1821 |
g_return_if_fail (XAPP_IS_STATUS_ICON (icon));
|
|
1822 |
gchar *old_meta;
|
|
1823 |
|
|
1824 |
g_debug ("XAppStatusIcon set_metadata: '%s'", metadata);
|
|
1825 |
|
|
1826 |
if (g_strcmp0 (metadata, icon->priv->metadata) == 0)
|
|
1827 |
{
|
|
1828 |
return;
|
|
1829 |
}
|
|
1830 |
|
|
1831 |
old_meta = icon->priv->metadata;
|
|
1832 |
icon->priv->metadata = g_strdup (metadata);
|
|
1833 |
g_free (old_meta);
|
|
1834 |
|
|
1835 |
if (icon->priv->skeleton)
|
|
1836 |
{
|
|
1837 |
xapp_status_icon_interface_set_metadata (icon->priv->skeleton, metadata);
|
|
1838 |
}
|
|
1839 |
}
|
|
1840 |
|
|
1841 |
/**
|
1745 | 1842 |
* xapp_status_icon_any_monitors:
|
1746 | 1843 |
*
|
1747 | 1844 |
* Looks for the existence of any active #XAppStatusIconMonitors on the bus.
|