Commit 9beb9f66 authored by Christian Hergert's avatar Christian Hergert

view: add source.change-case(s) GAction to GtkSourceView

This allows activating the change-case operation via a GAction which
in turn allows for it to be activated via GMenuModel.
parent 2915c071
......@@ -438,6 +438,27 @@ gtk_source_view_change_case (GtkSourceView *view,
gtk_source_buffer_change_case (buffer, case_type, &start, &end);
}
static void
gtk_source_view_activate_change_case (GtkWidget *widget,
const gchar *action_name,
GVariant *parameter)
{
GEnumClass *klass;
GEnumValue *value;
const gchar *nick;
nick = g_variant_get_string (parameter, NULL);
klass = g_type_class_ref (GTK_SOURCE_TYPE_CHANGE_CASE_TYPE);
value = g_enum_get_value_by_nick (klass, nick);
if (value != NULL)
{
gtk_source_view_change_case (GTK_SOURCE_VIEW (widget), value->value);
}
g_type_class_unref (klass);
}
static void
gtk_source_view_join_lines (GtkSourceView *view)
{
......@@ -918,6 +939,9 @@ gtk_source_view_class_init (GtkSourceViewClass *klass)
G_TYPE_FROM_CLASS (klass),
g_cclosure_marshal_VOID__VOIDv);
gtk_widget_class_install_action (widget_class, "source.change-case", "s",
gtk_source_view_activate_change_case);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment