[gnome-builder] libide: add IdeSourceView::append-to-count gsignalaction
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: add IdeSourceView::append-to-count gsignalaction
- Date: Tue, 24 Mar 2015 00:02:29 +0000 (UTC)
commit c48348b044dd26442d90d084ddedb0df26678385
Author: Christian Hergert <christian hergert me>
Date: Fri Mar 6 02:01:46 2015 -0800
libide: add IdeSourceView::append-to-count gsignalaction
This will let us pass numbers from keybindings to do multiple replay
operations. 10dw for example. This will be 1 pushed followed by 0
pushed. Then the `dw` operation will use a movement of w (inclusive)
and repeated 10 times before the `d` is applied.
libide/ide-source-view.c | 27 +++++++++++++++++++++++++++
libide/ide-source-view.h | 2 ++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index d74748b..0dbbb53 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -111,6 +111,7 @@ enum {
enum {
ACTION,
+ APPEND_TO_COUNT,
CHANGE_CASE,
CLEAR_SELECTION,
CYCLE_COMPLETION,
@@ -1534,6 +1535,20 @@ ide_source_view_real_action (IdeSourceView *self,
}
static void
+ide_source_view_real_append_to_count (IdeSourceView *self,
+ gint digit)
+{
+ IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
+
+ g_assert (IDE_IS_SOURCE_VIEW (self));
+
+ g_return_if_fail (digit >= 0);
+ g_return_if_fail (digit <= 9);
+
+ priv->count = (priv->count * 10) + digit;
+}
+
+static void
ide_source_view_real_change_case (IdeSourceView *self,
GtkSourceChangeCaseType type)
{
@@ -2318,6 +2333,7 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
widget_class->query_tooltip = ide_source_view_query_tooltip;
klass->action = ide_source_view_real_action;
+ klass->append_to_count = ide_source_view_real_append_to_count;
klass->change_case = ide_source_view_real_change_case;
klass->clear_selection = ide_source_view_real_clear_selection;
klass->cycle_completion = ide_source_view_real_cycle_completion;
@@ -2425,6 +2441,17 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
G_TYPE_STRING,
G_TYPE_STRING);
+ gSignals [APPEND_TO_COUNT] =
+ g_signal_new ("append-to-count",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (IdeSourceViewClass, append_to_count),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_INT);
+
gSignals [CHANGE_CASE] =
g_signal_new ("change-case",
G_TYPE_FROM_CLASS (klass),
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index f999d0e..2ea874b 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -190,6 +190,8 @@ struct _IdeSourceViewClass
const gchar *prefix,
const gchar *action_name,
const gchar *param);
+ void (*append_to_count) (IdeSourceView *self,
+ gint digit);
void (*change_case) (IdeSourceView *self,
GtkSourceChangeCaseType type);
void (*clear_selection) (IdeSourceView *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]