summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2017-09-28 09:10:07 +0200
committerraveit65 <[email protected]>2017-10-10 14:49:45 +0200
commitf0b6b6693720aef9281c840b84deff9a1a6e1aa2 (patch)
tree9ee3b0a38d3cb4bb4564e1cfa514d6be6e637f1d
parent991d07f79ce3c7daacff05a15ae1b91ffeac2f2c (diff)
downloadpluma-f0b6b6693720aef9281c840b84deff9a1a6e1aa2.tar.bz2
pluma-f0b6b6693720aef9281c840b84deff9a1a6e1aa2.tar.xz
[ctrl] + [+] / [ctrl] + [-] to increase/decrease font size
Closes https://github.com/mate-desktop/pluma/issues/224
-rw-r--r--pluma/pluma-window.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index 5e9f8d94..a247d0e5 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -309,6 +309,45 @@ pluma_window_key_press_event (GtkWidget *widget,
GtkWindow *window = GTK_WINDOW (widget);
gboolean handled = FALSE;
+ if (event->state & GDK_CONTROL_MASK)
+ {
+ GSettings *settings;
+ gchar *font;
+ gchar *tempsize;
+ gint nsize;
+
+ settings = g_settings_new ("org.mate.pluma");
+ font = g_settings_get_string (settings, "editor-font");
+ tempsize = g_strdup (font);
+
+ g_strreverse (tempsize);
+ g_strcanon (tempsize, "1234567890", '\0');
+ g_strreverse (tempsize);
+
+ gchar tempfont [strlen (font)];
+ strcpy (tempfont, font);
+ tempfont [strlen (font) - strlen (tempsize)] = 0;
+
+ sscanf (tempsize, "%d", &nsize);
+
+ if (event->keyval == GDK_KEY_plus)
+ {
+ nsize = nsize + 1;
+ sprintf (tempsize, "%d", nsize);
+
+ if (!g_settings_get_boolean (settings, "use-default-font") && (nsize < 73))
+ g_settings_set_string (settings, "editor-font", g_strconcat (tempfont, tempsize, NULL));
+ }
+ else if (event->keyval == GDK_KEY_minus)
+ {
+ nsize = nsize - 1;
+ sprintf (tempsize, "%d", nsize);
+
+ if (!g_settings_get_boolean (settings, "use-default-font") && (nsize > 5))
+ g_settings_set_string (settings, "editor-font", g_strconcat (tempfont, tempsize, NULL));
+ }
+ }
+
if (grand_parent_class == NULL)
grand_parent_class = g_type_class_peek_parent (pluma_window_parent_class);