[gnome-builder/wip/libide-merge] do split in idle callback
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide-merge] do split in idle callback
- Date: Thu, 19 Mar 2015 20:56:40 +0000 (UTC)
commit 10bcca0a1e194cf03f9430252ecc339a126e8a92
Author: Christian Hergert <christian hergert me>
Date: Thu Mar 19 13:56:35 2015 -0700
do split in idle callback
helps when we are performing action from a gsignalaction
data/keybindings/vim.css | 2 +-
src/views/gb-view-stack-actions.c | 24 +++++++++++++++++++-----
2 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index 00a12bf..abd6747 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -898,7 +898,7 @@
bind "c" { "action" ("view", "close", "") };
bind "<ctrl>c" { "action" ("view", "close", "") };
- bind "s" { "action" ("view", "toggle-split", "") };
+ bind "s" { "action" ("view-stack", "split-down", "") };
bind "w" { "action" ("view-grid", "focus-neighbor", "0") };
bind "<ctrl>w" { "action" ("view-grid", "focus-neighbor", "0") };
diff --git a/src/views/gb-view-stack-actions.c b/src/views/gb-view-stack-actions.c
index 7f1cafe..57d4d85 100644
--- a/src/views/gb-view-stack-actions.c
+++ b/src/views/gb-view-stack-actions.c
@@ -118,13 +118,28 @@ gb_view_stack_actions_save_as (GSimpleAction *action,
}
static void
+do_split_down_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ g_autoptr(GSimpleAction) action = user_data;
+ GTask *task = (GTask *)result;
+ GbView *view = (GbView *)object;
+ GVariant *param = g_task_get_task_data (task);
+ gboolean split_view = g_variant_get_boolean (param);
+
+ gb_view_set_split_view (view, split_view);
+ g_simple_action_set_state (action, param);
+}
+
+static void
gb_view_stack_actions_split_down (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
GbViewStack *self = user_data;
GtkWidget *active_view;
- gboolean split_view;
+ g_autoptr(GTask) task = NULL;
g_assert (GB_IS_VIEW_STACK (self));
@@ -132,10 +147,9 @@ gb_view_stack_actions_split_down (GSimpleAction *action,
if (!GB_IS_VIEW (active_view))
return;
- split_view = g_variant_get_boolean (param);
- gb_view_set_split_view (GB_VIEW (active_view), split_view);
-
- g_simple_action_set_state (action, param);
+ task = g_task_new (active_view, NULL, do_split_down_cb, g_object_ref (action));
+ g_task_set_task_data (task, g_variant_ref (param), (GDestroyNotify)g_variant_unref);
+ g_task_return_boolean (task, TRUE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]