1 | /* |
---|---|
2 | * Copyright (C) 2014 Red Hat Inc. |
3 | * |
4 | * Author: |
5 | * Benjamin Otte <otte@gnome.org> |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Library General Public |
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
19 | */ |
20 | |
21 | #include "config.h" |
22 | |
23 | #include <gtk/gtk.h> |
24 | |
25 | |
26 | G_MODULE_EXPORT void |
27 | set_default_direction_ltr (void) |
28 | { |
29 | g_test_message (format: "Attention: globally setting default text direction to LTR"); |
30 | gtk_widget_set_default_direction (dir: GTK_TEXT_DIR_LTR); |
31 | } |
32 | |
33 | G_MODULE_EXPORT void |
34 | set_default_direction_rtl (void) |
35 | { |
36 | g_test_message (format: "Attention: globally setting default text direction to RTL"); |
37 | gtk_widget_set_default_direction (dir: GTK_TEXT_DIR_RTL); |
38 | } |
39 | |
40 | G_MODULE_EXPORT void |
41 | switch_default_direction (void) |
42 | { |
43 | switch (gtk_widget_get_default_direction ()) |
44 | { |
45 | case GTK_TEXT_DIR_LTR: |
46 | g_test_message (format: "Attention: globally switching default text direction from LTR to RTL"); |
47 | gtk_widget_set_default_direction (dir: GTK_TEXT_DIR_RTL); |
48 | break; |
49 | case GTK_TEXT_DIR_RTL: |
50 | g_test_message (format: "Attention: globally switching default text direction from RTL to LTR"); |
51 | gtk_widget_set_default_direction (dir: GTK_TEXT_DIR_LTR); |
52 | break; |
53 | case GTK_TEXT_DIR_NONE: |
54 | default: |
55 | g_assert_not_reached (); |
56 | break; |
57 | } |
58 | } |
59 | |
60 | G_MODULE_EXPORT void |
61 | switch_direction (GtkWidget *widget) |
62 | { |
63 | switch (gtk_widget_get_direction (widget)) |
64 | { |
65 | case GTK_TEXT_DIR_LTR: |
66 | gtk_widget_set_direction (widget, dir: GTK_TEXT_DIR_RTL); |
67 | break; |
68 | case GTK_TEXT_DIR_RTL: |
69 | gtk_widget_set_direction (widget, dir: GTK_TEXT_DIR_LTR); |
70 | break; |
71 | case GTK_TEXT_DIR_NONE: |
72 | default: |
73 | g_assert_not_reached (); |
74 | break; |
75 | } |
76 | } |
77 | |
78 | G_MODULE_EXPORT void |
79 | swap_child (GtkWidget *window) |
80 | { |
81 | GtkWidget *image; |
82 | |
83 | image = gtk_image_new_from_icon_name (icon_name: "go-next"); |
84 | gtk_window_set_child (GTK_WINDOW (window), child: image); |
85 | } |
86 |