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,7 +130,10 @@ | ||
| 130 | <Unit filename="src/objects/keypad/widget.c"> | 130 | <Unit filename="src/objects/keypad/widget.c"> |
| 131 | <Option compilerVar="CC" /> | 131 | <Option compilerVar="CC" /> |
| 132 | </Unit> | 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 | <Option compilerVar="CC" /> | 137 | <Option compilerVar="CC" /> |
| 135 | </Unit> | 138 | </Unit> |
| 136 | <Unit filename="src/objects/settings/dialog.c"> | 139 | <Unit filename="src/objects/settings/dialog.c"> |
| @@ -189,9 +192,6 @@ | @@ -189,9 +192,6 @@ | ||
| 189 | <Unit filename="src/objects/window/window.c"> | 192 | <Unit filename="src/objects/window/window.c"> |
| 190 | <Option compilerVar="CC" /> | 193 | <Option compilerVar="CC" /> |
| 191 | </Unit> | 194 | </Unit> |
| 192 | - <Unit filename="src/objects/windows/savedesktopicon.c"> | ||
| 193 | - <Option compilerVar="CC" /> | ||
| 194 | - </Unit> | ||
| 195 | <Unit filename="ui/application.xml" /> | 195 | <Unit filename="ui/application.xml" /> |
| 196 | <Unit filename="ui/window.xml" /> | 196 | <Unit filename="ui/window.xml" /> |
| 197 | <Extensions> | 197 | <Extensions> |
src/include/pw3270/actions.h
| @@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
| 120 | 120 | ||
| 121 | GdkPixbuf * g_action_get_pixbuf(GAction *action, GtkIconSize icon_size, GtkIconLookupFlags flags); | 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 | GtkToolItem * gtk_tool_button_new_from_action(GAction *action, GtkIconSize icon_size, gboolean symbolic); | 124 | GtkToolItem * gtk_tool_button_new_from_action(GAction *action, GtkIconSize icon_size, gboolean symbolic); |
| 125 | 125 | ||
| 126 | G_END_DECLS | 126 | G_END_DECLS |
src/objects/actions/button.c
| @@ -35,14 +35,19 @@ | @@ -35,14 +35,19 @@ | ||
| 35 | #include "private.h" | 35 | #include "private.h" |
| 36 | #include <pw3270/actions.h> | 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 | if(!action) | 40 | if(!action) |
| 41 | return NULL; | 41 | return NULL; |
| 42 | 42 | ||
| 43 | g_autofree gchar * icon_name = g_action_get_icon_name(action); | 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 | return gtk_button_new_from_icon_name(icon_name,icon_size); | 49 | return gtk_button_new_from_icon_name(icon_name,icon_size); |
| 50 | + } | ||
| 46 | 51 | ||
| 47 | GdkPixbuf * pixbuf = g_action_get_pixbuf(action, GTK_ICON_SIZE_BUTTON, GTK_ICON_LOOKUP_GENERIC_FALLBACK); | 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,6 +124,8 @@ | ||
| 124 | GtkWidget * pw3270_header_button_new_from_builder(GtkWidget *widget, GtkBuilder * builder, const gchar *action_name) { | 124 | GtkWidget * pw3270_header_button_new_from_builder(GtkWidget *widget, GtkBuilder * builder, const gchar *action_name) { |
| 125 | 125 | ||
| 126 | GtkWidget * button = NULL; | 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 | if(g_str_has_prefix(action_name,"menu.")) { | 130 | if(g_str_has_prefix(action_name,"menu.")) { |
| 129 | 131 | ||
| @@ -145,7 +147,7 @@ | @@ -145,7 +147,7 @@ | ||
| 145 | g_warning("Can't find action %s",action_name); | 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 | gtk_actionable_set_action_name(GTK_ACTIONABLE(button),action_name); | 152 | gtk_actionable_set_action_name(GTK_ACTIONABLE(button),action_name); |
| 151 | gtk_widget_set_visible(button,g_action_get_enabled(action)); | 153 | gtk_widget_set_visible(button,g_action_get_enabled(action)); |