Commit 1e9c2b48 authored by Sean Davis's avatar Sean Davis 🕶

Add systray items list view

parent 8201ea0b
Pipeline #1111 passed with stages
in 4 minutes and 42 seconds
......@@ -116,6 +116,7 @@ enum
CONFIGURATION_CHANGED,
ITEM_LIST_CHANGED,
COLLECT_KNOWN_ITEMS,
KNOWN_ITEM_LIST_CHANGED,
LAST_SIGNAL
};
......@@ -256,6 +257,14 @@ sn_config_class_init (SnConfigClass *klass)
0, NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE, 1, G_TYPE_POINTER);
sn_config_signals[KNOWN_ITEM_LIST_CHANGED] =
g_signal_new (g_intern_static_string ("known-items-list-changed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
......@@ -476,6 +485,7 @@ sn_config_set_property (GObject *object,
{
config->mode_whitelist = val;
g_signal_emit (G_OBJECT (config), sn_config_signals[ITEM_LIST_CHANGED], 0);
g_signal_emit (G_OBJECT (config), sn_config_signals[KNOWN_ITEM_LIST_CHANGED], 0);
}
break;
......@@ -526,7 +536,7 @@ sn_config_set_property (GObject *object,
config->known_legacy_items = g_list_append (config->known_legacy_items, name);
}
}
g_signal_emit (G_OBJECT (config), sn_config_signals[ITEM_LIST_CHANGED], 0);
g_signal_emit (G_OBJECT (config), sn_config_signals[KNOWN_ITEM_LIST_CHANGED], 0);
break;
case PROP_HIDDEN_LEGACY_ITEMS:
......@@ -542,7 +552,7 @@ sn_config_set_property (GObject *object,
g_hash_table_replace (config->hidden_legacy_items, name, name);
}
}
g_signal_emit (G_OBJECT (config), sn_config_signals[ITEM_LIST_CHANGED], 0);
g_signal_emit (G_OBJECT (config), sn_config_signals[KNOWN_ITEM_LIST_CHANGED], 0);
break;
default:
......@@ -762,7 +772,7 @@ sn_config_set_legacy_hidden (SnConfig *config,
g_hash_table_remove (config->hidden_legacy_items, name);
}
g_object_notify (G_OBJECT (config), "hidden-legacy-items");
g_signal_emit (G_OBJECT (config), sn_config_signals[ITEM_LIST_CHANGED], 0);
g_signal_emit (G_OBJECT (config), sn_config_signals[KNOWN_ITEM_LIST_CHANGED], 0);
}
......@@ -869,7 +879,7 @@ sn_config_add_known_legacy_item (SnConfig *config,
}
g_object_notify (G_OBJECT (config), "known-legacy-items");
g_signal_emit (G_OBJECT (config), sn_config_signals[ITEM_LIST_CHANGED], 0);
g_signal_emit (G_OBJECT (config), sn_config_signals[KNOWN_ITEM_LIST_CHANGED], 0);
}
......@@ -913,6 +923,44 @@ sn_config_swap_known_items (SnConfig *config,
void sn_config_swap_known_legacy_items(SnConfig *config,
const gchar *name1,
const gchar *name2)
{
GList *li, *li_tmp;
g_return_if_fail(XFCE_IS_SN_CONFIG(config));
for (li = config->known_legacy_items; li != NULL; li = li->next)
if (g_strcmp0(li->data, name1) == 0)
break;
/* make sure that the list contains name1 followed by name2 */
if (li == NULL || li->next == NULL || g_strcmp0(li->next->data, name2) != 0)
{
g_debug("Couldn't swap items: %s and %s", name1, name2);
return;
}
/* li_tmp will contain only the removed element (name2) */
li_tmp = li->next;
config->known_legacy_items = g_list_remove_link(config->known_legacy_items, li_tmp);
/* not strictly necessary (in testing the list contents was preserved)
* but searching for the index again should be safer */
for (li = config->known_legacy_items; li != NULL; li = li->next)
if (g_strcmp0(li->data, name1) == 0)
break;
config->known_legacy_items = g_list_insert_before(config->known_legacy_items, li, li_tmp->data);
g_list_free(li_tmp);
g_object_notify(G_OBJECT(config), "known-legacy-items");
g_signal_emit(G_OBJECT(config), sn_config_signals[KNOWN_ITEM_LIST_CHANGED], 0);
}
static gboolean
sn_config_items_clear_callback (gpointer key,
gpointer value,
......
......@@ -92,6 +92,9 @@ void sn_config_add_known_legacy_item (SnConfig
void sn_config_swap_known_items (SnConfig *config,
const gchar *name1,
const gchar *name2);
void sn_config_swap_known_legacy_items (SnConfig *config,
const gchar *name1,
const gchar *name2);
gboolean sn_config_items_clear (SnConfig *config);
......
This diff is collapsed.
This diff is collapsed.
......@@ -283,6 +283,8 @@ sn_plugin_construct (XfcePanelPlugin *panel_plugin)
G_CALLBACK (gtk_widget_queue_resize), plugin->systray_box);
g_signal_connect (plugin->config, "configuration-changed",
G_CALLBACK (systray_plugin_configuration_changed), plugin);
g_signal_connect (plugin->config, "known-items-list-changed",
G_CALLBACK (systray_plugin_configuration_changed), plugin);
plugin->backend = sn_backend_new ();
g_signal_connect_swapped (plugin->backend, "item-added",
......
/*
* Generated by gdbus-codegen 2.62.4 from sn-watcher.xml. DO NOT EDIT.
* This file is generated by gdbus-codegen, do not modify it.
*
* The license of this code is the same as for the D-Bus interface description
* it was derived from.
* it was derived from. Note that it links to GLib, so must comply with the
* LGPL linking clauses.
*/
#ifdef HAVE_CONFIG_H
......@@ -574,7 +575,7 @@ sn_watcher_default_init (SnWatcherIface *iface)
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sn_watcher_dup_registered_status_notifier_items() if on another thread.</warning>
* The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sn_watcher_dup_registered_status_notifier_items() if on another thread.
*
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
*/
......@@ -731,7 +732,7 @@ sn_watcher_emit_status_notifier_host_registered (
* @user_data: User data to pass to @callback.
*
* Asynchronously invokes the <link linkend="gdbus-method-org-kde-StatusNotifierWatcher.RegisterStatusNotifierItem">RegisterStatusNotifierItem()</link> D-Bus method on @proxy.
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
* You can then call sn_watcher_call_register_status_notifier_item_finish() to get the result of the operation.
*
* See sn_watcher_call_register_status_notifier_item_sync() for the synchronous, blocking version of this method.
......@@ -829,7 +830,7 @@ _out:
* @user_data: User data to pass to @callback.
*
* Asynchronously invokes the <link linkend="gdbus-method-org-kde-StatusNotifierWatcher.RegisterStatusNotifierHost">RegisterStatusNotifierHost()</link> D-Bus method on @proxy.
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
* You can then call sn_watcher_call_register_status_notifier_host_finish() to get the result of the operation.
*
* See sn_watcher_call_register_status_notifier_host_sync() for the synchronous, blocking version of this method.
......@@ -1234,7 +1235,7 @@ sn_watcher_proxy_iface_init (SnWatcherIface *iface)
*
* Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-kde-StatusNotifierWatcher.top_of_page">org.kde.StatusNotifierWatcher</link>. See g_dbus_proxy_new() for more details.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
* You can then call sn_watcher_proxy_new_finish() to get the result of the operation.
*
* See sn_watcher_proxy_new_sync() for the synchronous, blocking version of this constructor.
......@@ -1324,7 +1325,7 @@ sn_watcher_proxy_new_sync (
*
* Like sn_watcher_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
* You can then call sn_watcher_proxy_new_for_bus_finish() to get the result of the operation.
*
* See sn_watcher_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
......
/*
* Generated by gdbus-codegen 2.62.4 from sn-watcher.xml. DO NOT EDIT.
* This file is generated by gdbus-codegen, do not modify it.
*
* The license of this code is the same as for the D-Bus interface description
* it was derived from.
* it was derived from. Note that it links to GLib, so must comply with the
* LGPL linking clauses.
*/
#ifndef __SN_WATCHER_H__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment