[gnome-builder/wip/libide-merge: 16/35] moves, prefs, etc
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide-merge: 16/35] moves, prefs, etc
- Date: Thu, 19 Mar 2015 08:55:54 +0000 (UTC)
commit 0f04f105e9b482aa4134f776a7d62166dd43e36d
Author: Christian Hergert <christian hergert me>
Date: Wed Mar 18 18:54:17 2015 -0700
moves, prefs, etc
data/ui/gb-view-stack.ui | 1 +
src/preferences/gb-preferences-page-vim.c | 3 --
src/views/gb-view-grid.c | 20 ++++++++++++++-
src/views/gb-view-stack-actions.c | 14 ++++++++++
src/views/gb-view-stack.c | 39 ++++++++++++++++++----------
src/views/gb-view-stack.h | 3 ++
6 files changed, 62 insertions(+), 18 deletions(-)
---
diff --git a/data/ui/gb-view-stack.ui b/data/ui/gb-view-stack.ui
index 1aa9f9e..a8a21a0 100644
--- a/data/ui/gb-view-stack.ui
+++ b/data/ui/gb-view-stack.ui
@@ -102,6 +102,7 @@
</child>
<child>
<object class="GtkStack" id="controls_stack">
+ <property name="homogeneous">false</property>
<property name="visible">true</property>
</object>
<packing>
diff --git a/src/preferences/gb-preferences-page-vim.c b/src/preferences/gb-preferences-page-vim.c
index 022bbe8..001185a 100644
--- a/src/preferences/gb-preferences-page-vim.c
+++ b/src/preferences/gb-preferences-page-vim.c
@@ -26,7 +26,6 @@
struct _GbPreferencesPageVimPrivate
{
GSettings *editor_settings;
- GSettings *vim_settings;
/* Widgets owned by Template */
GtkSwitch *vim_mode_switch;
@@ -51,7 +50,6 @@ gb_preferences_page_vim_constructed (GObject *object)
priv = vim->priv;
priv->editor_settings = g_settings_new ("org.gnome.builder.editor");
- priv->vim_settings = g_settings_new ("org.gnome.builder.editor.vim");
group = g_simple_action_group_new ();
@@ -69,7 +67,6 @@ gb_preferences_page_vim_finalize (GObject *object)
GbPreferencesPageVimPrivate *priv = GB_PREFERENCES_PAGE_VIM (object)->priv;
g_clear_object (&priv->editor_settings);
- g_clear_object (&priv->vim_settings);
G_OBJECT_CLASS (gb_preferences_page_vim_parent_class)->finalize (object);
}
diff --git a/src/views/gb-view-grid.c b/src/views/gb-view-grid.c
index 27a5600..698ee7f 100644
--- a/src/views/gb-view-grid.c
+++ b/src/views/gb-view-grid.c
@@ -261,6 +261,17 @@ gb_view_grid_stack_split (GbViewGrid *self,
gb_view_stack_focus_document (GB_VIEW_STACK (target), document);
break;
+ case GB_VIEW_GRID_MOVE_LEFT:
+ target = gb_view_grid_get_stack_before (self, stack);
+ if (target == NULL)
+ target = gb_view_grid_add_stack_before (self, stack);
+ new_view = gb_document_create_view (document);
+ if (new_view == NULL)
+ return;
+ gb_view_stack_remove (stack, view);
+ gb_view_stack_focus_document (GB_VIEW_STACK (target), document);
+ break;
+
case GB_VIEW_GRID_SPLIT_RIGHT:
target = gb_view_grid_get_stack_after (self, stack);
if (target == NULL)
@@ -272,7 +283,14 @@ gb_view_grid_stack_split (GbViewGrid *self,
break;
case GB_VIEW_GRID_MOVE_RIGHT:
- case GB_VIEW_GRID_MOVE_LEFT:
+ target = gb_view_grid_get_stack_after (self, stack);
+ if (target == NULL)
+ target = gb_view_grid_add_stack_after (self, stack);
+ new_view = gb_document_create_view (document);
+ if (new_view == NULL)
+ return;
+ gb_view_stack_remove (stack, view);
+ gb_view_stack_focus_document (GB_VIEW_STACK (target), document);
break;
default:
diff --git a/src/views/gb-view-stack-actions.c b/src/views/gb-view-stack-actions.c
index 2433da1..7a11f0d 100644
--- a/src/views/gb-view-stack-actions.c
+++ b/src/views/gb-view-stack-actions.c
@@ -40,8 +40,15 @@ gb_view_stack_actions_move_left (GSimpleAction *action,
gpointer user_data)
{
GbViewStack *self = user_data;
+ GtkWidget *active_view;
g_assert (GB_IS_VIEW_STACK (self));
+
+ active_view = gb_view_stack_get_active_view (self);
+ if (active_view == NULL || !GB_IS_VIEW (active_view))
+ return;
+
+ g_signal_emit_by_name (self, "split", active_view, GB_VIEW_GRID_MOVE_LEFT);
}
static void
@@ -50,8 +57,15 @@ gb_view_stack_actions_move_right (GSimpleAction *action,
gpointer user_data)
{
GbViewStack *self = user_data;
+ GtkWidget *active_view;
g_assert (GB_IS_VIEW_STACK (self));
+
+ active_view = gb_view_stack_get_active_view (self);
+ if (active_view == NULL || !GB_IS_VIEW (active_view))
+ return;
+
+ g_signal_emit_by_name (self, "split", active_view, GB_VIEW_GRID_MOVE_RIGHT);
}
static void
diff --git a/src/views/gb-view-stack.c b/src/views/gb-view-stack.c
index 8901b3b..ff3e25b 100644
--- a/src/views/gb-view-stack.c
+++ b/src/views/gb-view-stack.c
@@ -68,27 +68,38 @@ gb_view_stack_add (GtkContainer *container,
}
}
+void
+gb_view_stack_remove (GbViewStack *self,
+ GbView *view)
+{
+ GtkWidget *controls;
+
+ g_assert (GB_IS_VIEW_STACK (self));
+ g_assert (GB_IS_VIEW (view));
+
+ self->focus_history = g_list_remove (self->focus_history, view);
+ controls = gb_view_get_controls (view);
+ if (controls)
+ gtk_container_remove (GTK_CONTAINER (self->controls_stack), controls);
+ gtk_container_remove (GTK_CONTAINER (self->stack), GTK_WIDGET (view));
+ if (self->focus_history)
+ gtk_stack_set_visible_child (self->stack, self->focus_history->data);
+ else
+ g_signal_emit (self, gSignals [EMPTY], 0);
+}
+
static void
-gb_view_stack_remove (GtkContainer *container,
- GtkWidget *child)
+gb_view_stack_real_remove (GtkContainer *container,
+ GtkWidget *child)
{
GbViewStack *self = (GbViewStack *)container;
g_assert (GB_IS_VIEW_STACK (self));
if (GB_IS_VIEW (child))
- {
- self->focus_history = g_list_remove (self->focus_history, child);
- gtk_container_remove (GTK_CONTAINER (self->stack), child);
- if (self->focus_history)
- gtk_stack_set_visible_child (self->stack, self->focus_history->data);
- else
- g_signal_emit (self, gSignals [EMPTY], 0);
- }
+ gb_view_stack_remove (self, GB_VIEW (child));
else
- {
- GTK_CONTAINER_CLASS (gb_view_stack_parent_class)->remove (container, child);
- }
+ GTK_CONTAINER_CLASS (gb_view_stack_parent_class)->remove (container, child);
}
static void
@@ -239,7 +250,7 @@ gb_view_stack_class_init (GbViewStackClass *klass)
widget_class->hierarchy_changed = gb_view_stack_hierarchy_changed;
container_class->add = gb_view_stack_add;
- container_class->remove = gb_view_stack_remove;
+ container_class->remove = gb_view_stack_real_remove;
gParamSpecs [PROP_ACTIVE_VIEW] =
g_param_spec_object ("active-view",
diff --git a/src/views/gb-view-stack.h b/src/views/gb-view-stack.h
index 07e0ea9..4113264 100644
--- a/src/views/gb-view-stack.h
+++ b/src/views/gb-view-stack.h
@@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include "gb-document.h"
+#include "gb-view.h"
G_BEGIN_DECLS
@@ -30,6 +31,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GbViewStack, gb_view_stack, GB, VIEW_STACK, GtkBin)
GtkWidget *gb_view_stack_new (void);
+void gb_view_stack_remove (GbViewStack *self,
+ GbView *view);
GtkWidget *gb_view_stack_get_active_view (GbViewStack *self);
void gb_view_stack_set_active_view (GbViewStack *self,
GtkWidget *active_view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]