Commit 540884a59a599ff7b256e44f38b7b299add09794
1 parent
bc786932
Exists in
master
and in
2 other branches
Adding option for symbolic icons in the header bar.
Showing
4 changed files
with
15 additions
and
8 deletions
Show diff stats
pw3270.cbp
... | ... | @@ -130,7 +130,10 @@ |
130 | 130 | <Unit filename="src/objects/keypad/widget.c"> |
131 | 131 | <Option compilerVar="CC" /> |
132 | 132 | </Unit> |
133 | - <Unit filename="src/objects/linux/savedesktopicon.c"> | |
133 | + <Unit filename="src/objects/os/linux/savedesktopicon.c"> | |
134 | + <Option compilerVar="CC" /> | |
135 | + </Unit> | |
136 | + <Unit filename="src/objects/os/windows/savedesktopicon.c"> | |
134 | 137 | <Option compilerVar="CC" /> |
135 | 138 | </Unit> |
136 | 139 | <Unit filename="src/objects/settings/dialog.c"> |
... | ... | @@ -189,9 +192,6 @@ |
189 | 192 | <Unit filename="src/objects/window/window.c"> |
190 | 193 | <Option compilerVar="CC" /> |
191 | 194 | </Unit> |
192 | - <Unit filename="src/objects/windows/savedesktopicon.c"> | |
193 | - <Option compilerVar="CC" /> | |
194 | - </Unit> | |
195 | 195 | <Unit filename="ui/application.xml" /> |
196 | 196 | <Unit filename="ui/window.xml" /> |
197 | 197 | <Extensions> | ... | ... |
src/include/pw3270/actions.h
... | ... | @@ -120,7 +120,7 @@ |
120 | 120 | |
121 | 121 | GdkPixbuf * g_action_get_pixbuf(GAction *action, GtkIconSize icon_size, GtkIconLookupFlags flags); |
122 | 122 | |
123 | - GtkWidget * gtk_button_new_from_action(GAction *action, GtkIconSize icon_size); | |
123 | + GtkWidget * gtk_button_new_from_action(GAction *action, GtkIconSize icon_size, gboolean symbolic); | |
124 | 124 | GtkToolItem * gtk_tool_button_new_from_action(GAction *action, GtkIconSize icon_size, gboolean symbolic); |
125 | 125 | |
126 | 126 | G_END_DECLS | ... | ... |
src/objects/actions/button.c
... | ... | @@ -35,14 +35,19 @@ |
35 | 35 | #include "private.h" |
36 | 36 | #include <pw3270/actions.h> |
37 | 37 | |
38 | - GtkWidget * gtk_button_new_from_action(GAction *action, GtkIconSize icon_size) { | |
38 | + GtkWidget * gtk_button_new_from_action(GAction *action, GtkIconSize icon_size, gboolean symbolic) { | |
39 | 39 | |
40 | 40 | if(!action) |
41 | 41 | return NULL; |
42 | 42 | |
43 | 43 | g_autofree gchar * icon_name = g_action_get_icon_name(action); |
44 | - if(icon_name) | |
44 | + if(icon_name) { | |
45 | + if(symbolic && !strstr(icon_name,"-symbolic")) { | |
46 | + g_autofree gchar * name = g_strconcat(icon_name,"-symbolic",NULL); | |
47 | + return gtk_button_new_from_icon_name(name,icon_size); | |
48 | + } | |
45 | 49 | return gtk_button_new_from_icon_name(icon_name,icon_size); |
50 | + } | |
46 | 51 | |
47 | 52 | GdkPixbuf * pixbuf = g_action_get_pixbuf(action, GTK_ICON_SIZE_BUTTON, GTK_ICON_LOOKUP_GENERIC_FALLBACK); |
48 | 53 | ... | ... |
src/objects/window/header.c
... | ... | @@ -124,6 +124,8 @@ |
124 | 124 | GtkWidget * pw3270_header_button_new_from_builder(GtkWidget *widget, GtkBuilder * builder, const gchar *action_name) { |
125 | 125 | |
126 | 126 | GtkWidget * button = NULL; |
127 | + g_autoptr(GSettings) settings = pw3270_application_window_settings_new(); | |
128 | + gboolean symbolic = g_settings_get_int(settings,"header-icon-type") == 1; | |
127 | 129 | |
128 | 130 | if(g_str_has_prefix(action_name,"menu.")) { |
129 | 131 | |
... | ... | @@ -145,7 +147,7 @@ |
145 | 147 | g_warning("Can't find action %s",action_name); |
146 | 148 | } |
147 | 149 | |
148 | - button = gtk_button_new_from_action(action,GTK_ICON_SIZE_BUTTON); | |
150 | + button = gtk_button_new_from_action(action,GTK_ICON_SIZE_BUTTON,symbolic); | |
149 | 151 | |
150 | 152 | gtk_actionable_set_action_name(GTK_ACTIONABLE(button),action_name); |
151 | 153 | gtk_widget_set_visible(button,g_action_get_enabled(action)); | ... | ... |