Commit 6f18dd3df0f3d5f32b4e6c8a70a0e5ce7eabc92e
1 parent
507fd275
Exists in
master
and in
4 other branches
Buttons on the header bar are now configurable.
Showing
5 changed files
with
47 additions
and
23 deletions
Show diff stats
schemas/linux/application.gschema.xml.in
| ... | ... | @@ -74,6 +74,18 @@ |
| 74 | 74 | <description></description> |
| 75 | 75 | </key> |
| 76 | 76 | |
| 77 | + <key name="header-start-action-names" type="s"> | |
| 78 | + <default>'win.disconnect,win.reconnect,win.file.transfer,win.print'</default> | |
| 79 | + <summary>The actions in the first block of the header bar</summary> | |
| 80 | + <description></description> | |
| 81 | + </key> | |
| 82 | + | |
| 83 | + <key name="header-end-action-names" type="s"> | |
| 84 | + <default>'menu.open-menu'</default> | |
| 85 | + <summary>The actions in the last block of the header bar</summary> | |
| 86 | + <description></description> | |
| 87 | + </key> | |
| 88 | + | |
| 77 | 89 | </schema> |
| 78 | 90 | |
| 79 | 91 | </schemalist> | ... | ... |
schemas/windows/application.gschema.xml.in
| ... | ... | @@ -74,6 +74,18 @@ |
| 74 | 74 | <description></description> |
| 75 | 75 | </key> |
| 76 | 76 | |
| 77 | + <key name="header-start-action-names" type="s"> | |
| 78 | + <default>'win.disconnect,win.reconnect,win.file.transfer,win.print'</default> | |
| 79 | + <summary>The actions in the first block of the header bar</summary> | |
| 80 | + <description></description> | |
| 81 | + </key> | |
| 82 | + | |
| 83 | + <key name="header-end-action-names" type="s"> | |
| 84 | + <default>'menu.open-menu'</default> | |
| 85 | + <summary>The actions in the last block of the header bar</summary> | |
| 86 | + <description></description> | |
| 87 | + </key> | |
| 88 | + | |
| 77 | 89 | </schema> |
| 78 | 90 | |
| 79 | 91 | </schemalist> | ... | ... |
src/objects/actions/button.c
| ... | ... | @@ -50,12 +50,6 @@ |
| 50 | 50 | image = gtk_image_new_from_icon_name(symbolic_name,GTK_ICON_SIZE_BUTTON); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - | |
| 54 | - // If fails, use the regular icon. | |
| 55 | - if(!image) { | |
| 56 | - debug("***************** %s",icon_name); | |
| 57 | - } | |
| 58 | - | |
| 59 | 53 | if(!image) { |
| 60 | 54 | g_warning("Can't create button for icon \"%s\"",icon_name); |
| 61 | 55 | return NULL; | ... | ... |
src/objects/window/header.c
| ... | ... | @@ -41,22 +41,6 @@ |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - /* | |
| 45 | - static gboolean bg_deactivate_button(GtkWidget *button) { | |
| 46 | - debug("******************** %s %p",__FUNCTION__,button) | |
| 47 | - return FALSE; | |
| 48 | - } | |
| 49 | - | |
| 50 | - static void on_state_flags_changed(GtkWidget *button, GtkStateFlags flags, gpointer user_data) { | |
| 51 | - | |
| 52 | - debug("%s(%p,%d)",__FUNCTION__,button,flags & GTK_STATE_FLAG_ACTIVE); | |
| 53 | - | |
| 54 | - if(flags & GTK_STATE_FLAG_ACTIVE) | |
| 55 | - g_idle_add((GSourceFunc) bg_deactivate_button, button); | |
| 56 | - | |
| 57 | - } | |
| 58 | - */ | |
| 59 | - | |
| 60 | 44 | GtkWidget * pw3270_header_button_new_from_builder(GtkWidget *widget, GtkBuilder * builder, const gchar *action_name) { |
| 61 | 45 | |
| 62 | 46 | GtkWidget * button = NULL; |
| ... | ... | @@ -86,7 +70,6 @@ |
| 86 | 70 | if(button) { |
| 87 | 71 | |
| 88 | 72 | g_signal_connect(button, "notify::sensitive", G_CALLBACK(on_sensitive), widget); |
| 89 | - // g_signal_connect(button,"state-flags-changed",G_CALLBACK(on_state_flags_changed), widget); | |
| 90 | 73 | gtk_widget_set_focus_on_click(button,FALSE); |
| 91 | 74 | gtk_widget_set_can_focus(button,FALSE); |
| 92 | 75 | gtk_widget_set_can_default(button,FALSE); | ... | ... |
src/objects/window/window.c
| ... | ... | @@ -220,7 +220,29 @@ |
| 220 | 220 | |
| 221 | 221 | // Create header's action buttons |
| 222 | 222 | // https://wiki.gnome.org/Initiatives/GnomeGoals/GearIcons |
| 223 | + { | |
| 224 | + g_autofree gchar * left = g_settings_get_string(settings, "header-start-action-names"); | |
| 225 | + g_autofree gchar * right = g_settings_get_string(settings, "header-end-action-names"); | |
| 226 | + | |
| 227 | + gchar ** elements; | |
| 228 | + | |
| 229 | + // First the left side actions. | |
| 230 | + elements = g_strsplit(left,",",-1); | |
| 231 | + for(ix=0;elements[ix];ix++) { | |
| 232 | + gtk_header_bar_pack_start(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix])); | |
| 233 | + } | |
| 234 | + g_strfreev(elements); | |
| 235 | + | |
| 236 | + // And then, the right side actions; | |
| 237 | + elements = g_strsplit(right,",",-1); | |
| 238 | + for(ix=0;elements[ix];ix++) { | |
| 239 | + gtk_header_bar_pack_end(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix])); | |
| 240 | + } | |
| 241 | + g_strfreev(elements); | |
| 223 | 242 | |
| 243 | + } | |
| 244 | + | |
| 245 | + /* | |
| 224 | 246 | static const gchar * end_actions[] = { |
| 225 | 247 | "menu.open-menu", |
| 226 | 248 | }; |
| ... | ... | @@ -240,6 +262,7 @@ |
| 240 | 262 | for(ix = 0; ix < G_N_ELEMENTS(start_actions); ix++) { |
| 241 | 263 | gtk_header_bar_pack_start(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,start_actions[ix])); |
| 242 | 264 | } |
| 265 | + */ | |
| 243 | 266 | |
| 244 | 267 | |
| 245 | 268 | /* | ... | ... |