aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-04-03 10:37:33 -0500
committerTed Gould <ted@gould.cx>2012-04-03 10:37:33 -0500
commit4d3316b95941944d066d5ba50a05dbcc8140b216 (patch)
tree65a645f761cbab6e229ca96c3ed369f769be5f41
parent0afc1bc524816f08bcd459c96654ffc1dc6ddbb4 (diff)
downloadlibdbusmenu-4d3316b95941944d066d5ba50a05dbcc8140b216.tar.gz
libdbusmenu-4d3316b95941944d066d5ba50a05dbcc8140b216.tar.bz2
libdbusmenu-4d3316b95941944d066d5ba50a05dbcc8140b216.zip
Pulling out parts of about to show so that we have a core function there
-rw-r--r--libdbusmenu-glib/client.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 6162c14..2657ada 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1805,6 +1805,26 @@ struct _about_to_show_t {
gpointer cb_data;
};
+/* Takes an about_to_show_t structure and calls the callback correctly
+ and updates the layout if needed. */
+static void
+about_to_show_finish (about_to_show_t * data, gboolean need_update)
+{
+ /* If we need to update, do that first. */
+ if (need_update) {
+ update_layout(data->client);
+ }
+
+ if (data->cb != NULL) {
+ data->cb(data->cb_data);
+ }
+
+ g_object_unref(data->client);
+ g_free(data);
+
+ return;
+}
+
/* Reports errors and responds to update request that were a result
of sending the about to show signal. */
static void
@@ -1828,18 +1848,7 @@ about_to_show_cb (GObject * proxy, GAsyncResult * res, gpointer userdata)
g_variant_unref(params);
}
- /* If we need to update, do that first. */
- if (need_update) {
- update_layout(data->client);
- }
-
- if (data->cb != NULL) {
- data->cb(data->cb_data);
- }
-
- g_object_unref(data->client);
- g_free(data);
-
+ about_to_show_finish(data, need_update);
return;
}