summaryrefslogtreecommitdiff
path: root/mate-panel/libmate-panel-applet-private/panel-applet-container.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2018-01-04 19:20:07 +0300
committermonsta <[email protected]>2018-01-04 20:42:59 +0300
commit180ba4ae21e8f5bc7d67f4902d0cda6ff053f4b2 (patch)
treea779805dce868ef2a7a1bc5fe9e3f5f7e65e056e /mate-panel/libmate-panel-applet-private/panel-applet-container.c
parent45a11a76d63de53a556c1f112e7db90e2d8bbf39 (diff)
downloadmate-panel-180ba4ae21e8f5bc7d67f4902d0cda6ff053f4b2.tar.bz2
mate-panel-180ba4ae21e8f5bc7d67f4902d0cda6ff053f4b2.tar.xz
rework the process of cancelling the background change operation
don't mess with additional references to a GCancellable, instead keep just a const pointer to the internal operation data and use it as a key when it's needed to cancel the operation. fixes https://github.com/mate-desktop/mate-panel/issues/214 fixes https://github.com/mate-desktop/mate-panel/issues/431
Diffstat (limited to 'mate-panel/libmate-panel-applet-private/panel-applet-container.c')
-rw-r--r--mate-panel/libmate-panel-applet-private/panel-applet-container.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-container.c b/mate-panel/libmate-panel-applet-private/panel-applet-container.c
index f1ed62f2..5d1923aa 100644
--- a/mate-panel/libmate-panel-applet-private/panel-applet-container.c
+++ b/mate-panel/libmate-panel-applet-private/panel-applet-container.c
@@ -594,7 +594,7 @@ set_applet_property_cb (GObject *source_object,
g_object_unref (container);
}
-void
+gconstpointer
mate_panel_applet_container_child_set (MatePanelAppletContainer *container,
const gchar *property_name,
const GVariant *value,
@@ -607,7 +607,7 @@ mate_panel_applet_container_child_set (MatePanelAppletContainer *container,
GSimpleAsyncResult *result;
if (!proxy)
- return;
+ return NULL;
info = mate_panel_applet_container_child_property_get_info (property_name);
if (!info) {
@@ -617,7 +617,7 @@ mate_panel_applet_container_child_set (MatePanelAppletContainer *container,
MATE_PANEL_APPLET_CONTAINER_INVALID_CHILD_PROPERTY,
"%s: Applet has no child property named `%s'",
G_STRLOC, property_name);
- return;
+ return NULL;
}
result = g_simple_async_result_new (G_OBJECT (container),
@@ -645,6 +645,8 @@ mate_panel_applet_container_child_set (MatePanelAppletContainer *container,
-1, cancellable,
set_applet_property_cb,
result);
+
+ return result;
}
gboolean
@@ -696,7 +698,7 @@ get_applet_property_cb (GObject *source_object,
g_object_unref (container);
}
-void
+gconstpointer
mate_panel_applet_container_child_get (MatePanelAppletContainer *container,
const gchar *property_name,
GCancellable *cancellable,
@@ -708,7 +710,7 @@ mate_panel_applet_container_child_get (MatePanelAppletContainer *container,
GSimpleAsyncResult *result;
if (!proxy)
- return;
+ return NULL;
info = mate_panel_applet_container_child_property_get_info (property_name);
if (!info) {
@@ -718,7 +720,7 @@ mate_panel_applet_container_child_get (MatePanelAppletContainer *container,
MATE_PANEL_APPLET_CONTAINER_INVALID_CHILD_PROPERTY,
"%s: Applet has no child property named `%s'",
G_STRLOC, property_name);
- return;
+ return NULL;
}
result = g_simple_async_result_new (G_OBJECT (container),
@@ -744,6 +746,8 @@ mate_panel_applet_container_child_get (MatePanelAppletContainer *container,
-1, cancellable,
get_applet_property_cb,
result);
+
+ return result;
}
GVariant *
@@ -826,3 +830,14 @@ mate_panel_applet_container_child_popup_menu_finish (MatePanelAppletContainer *c
return !g_simple_async_result_propagate_error (simple, error);
}
+
+void
+mate_panel_applet_container_cancel_operation (MatePanelAppletContainer *container,
+ gconstpointer operation)
+{
+ gpointer value = g_hash_table_lookup (container->priv->pending_ops, operation);
+ if (value == NULL)
+ return;
+
+ g_cancellable_cancel (G_CANCELLABLE (value));
+}