diff options
author | monsta <[email protected]> | 2018-01-04 19:20:07 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2018-01-04 20:42:59 +0300 |
commit | 180ba4ae21e8f5bc7d67f4902d0cda6ff053f4b2 (patch) | |
tree | a779805dce868ef2a7a1bc5fe9e3f5f7e65e056e /mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c | |
parent | 45a11a76d63de53a556c1f112e7db90e2d8bbf39 (diff) | |
download | mate-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-frame-dbus.c')
-rw-r--r-- | mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c b/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c index 920519f9..449f4db3 100644 --- a/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c +++ b/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c @@ -42,7 +42,7 @@ G_DEFINE_TYPE (MatePanelAppletFrameDBus, struct _MatePanelAppletFrameDBusPrivate { MatePanelAppletContainer *container; - GCancellable *bg_cancellable; + gconstpointer bg_operation; }; /* Keep in sync with mate-panel-applet.h. Uggh. */ @@ -235,10 +235,8 @@ container_child_background_set (GObject *source_object, mate_panel_applet_container_child_set_finish (container, res, NULL); - if (frame->priv->bg_cancellable) - g_object_unref (frame->priv->bg_cancellable); - - frame->priv->bg_cancellable = NULL; + if (frame->priv->bg_operation) + frame->priv->bg_operation = NULL; } static void @@ -246,22 +244,23 @@ mate_panel_applet_frame_dbus_change_background (MatePanelAppletFrame *frame, PanelBackgroundType type) { MatePanelAppletFrameDBus *dbus_frame = MATE_PANEL_APPLET_FRAME_DBUS (frame); + MatePanelAppletFrameDBusPrivate *priv = dbus_frame->priv; char *bg_str; bg_str = _mate_panel_applet_frame_get_background_string ( frame, PANEL_WIDGET (gtk_widget_get_parent (GTK_WIDGET (frame))), type); if (bg_str != NULL) { - if (dbus_frame->priv->bg_cancellable) - g_cancellable_cancel (dbus_frame->priv->bg_cancellable); - dbus_frame->priv->bg_cancellable = g_cancellable_new (); + if (priv->bg_operation) + mate_panel_applet_container_cancel_operation (priv->container, priv->bg_operation); - mate_panel_applet_container_child_set (dbus_frame->priv->container, + priv->bg_operation = mate_panel_applet_container_child_set (priv->container, "background", g_variant_new_string (bg_str), - dbus_frame->priv->bg_cancellable, + NULL, container_child_background_set, dbus_frame); + g_free (bg_str); } } @@ -328,9 +327,8 @@ mate_panel_applet_frame_dbus_finalize (GObject *object) { MatePanelAppletFrameDBus *frame = MATE_PANEL_APPLET_FRAME_DBUS (object); - if (frame->priv->bg_cancellable) - g_object_unref (frame->priv->bg_cancellable); - frame->priv->bg_cancellable = NULL; + if (frame->priv->bg_operation) + frame->priv->bg_operation = NULL; G_OBJECT_CLASS (mate_panel_applet_frame_dbus_parent_class)->finalize (object); } @@ -348,7 +346,7 @@ mate_panel_applet_frame_dbus_init (MatePanelAppletFrameDBus *frame) gtk_widget_show (container); gtk_container_add (GTK_CONTAINER (frame), container); frame->priv->container = MATE_PANEL_APPLET_CONTAINER (container); - frame->priv->bg_cancellable = NULL; + frame->priv->bg_operation = NULL; g_signal_connect (container, "child-property-changed::flags", G_CALLBACK (mate_panel_applet_frame_dbus_flags_changed), |