From e6ad71bbb343aedec6175b2487e495a515545b5d Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 16 Dec 2019 10:37:56 -0300 Subject: [PATCH] Adjustments in the header bar actions. --- schemas/linux/application.gschema.xml.in | 12 +++--------- schemas/windows/application.gschema.xml.in | 12 +++--------- src/objects/window/window.c | 43 +++++++++++++++++++++++++++++-------------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/schemas/linux/application.gschema.xml.in b/schemas/linux/application.gschema.xml.in index 9675f05..3d431b2 100644 --- a/schemas/linux/application.gschema.xml.in +++ b/schemas/linux/application.gschema.xml.in @@ -74,15 +74,9 @@ - - 'win.disconnect,win.reconnect,win.file.transfer,win.print' - The actions in the first block of the header bar - - - - - 'menu.open-menu' - The actions in the last block of the header bar + + 'win.disconnect,win.reconnect,win.file.transfer,win.print:menu.open-menu' + The actions in the header bar diff --git a/schemas/windows/application.gschema.xml.in b/schemas/windows/application.gschema.xml.in index 9675f05..3d431b2 100644 --- a/schemas/windows/application.gschema.xml.in +++ b/schemas/windows/application.gschema.xml.in @@ -74,15 +74,9 @@ - - 'win.disconnect,win.reconnect,win.file.transfer,win.print' - The actions in the first block of the header bar - - - - - 'menu.open-menu' - The actions in the last block of the header bar + + 'win.disconnect,win.reconnect,win.file.transfer,win.print:menu.open-menu' + The actions in the header bar diff --git a/src/objects/window/window.c b/src/objects/window/window.c index c044730..ca2d5c2 100644 --- a/src/objects/window/window.c +++ b/src/objects/window/window.c @@ -221,28 +221,43 @@ // Create header's action buttons // https://wiki.gnome.org/Initiatives/GnomeGoals/GearIcons { - g_autofree gchar * left = g_settings_get_string(settings, "header-start-action-names"); - g_autofree gchar * right = g_settings_get_string(settings, "header-end-action-names"); + g_autofree gchar * header_actions = g_settings_get_string(settings, "header-action-names"); + gchar ** header_blocks = g_strsplit(header_actions,":",-1); - gchar ** elements; + if(g_strv_length(header_blocks) >= 2) { - // First the left side actions. - elements = g_strsplit(left,",",-1); - for(ix=0;elements[ix];ix++) { - gtk_header_bar_pack_start(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix])); - } - g_strfreev(elements); + gchar ** elements; + + // First the left side actions. + elements = g_strsplit(header_blocks[0],",",-1); + for(ix=0;elements[ix];ix++) { + gtk_header_bar_pack_start(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix])); + } + g_strfreev(elements); + + // And then, the right side actions; + elements = g_strsplit(header_blocks[1],",",-1); + for(ix=0;elements[ix];ix++) { + gtk_header_bar_pack_end(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix])); + } + g_strfreev(elements); - // And then, the right side actions; - elements = g_strsplit(right,",",-1); - for(ix=0;elements[ix];ix++) { - gtk_header_bar_pack_end(header, pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix])); } - g_strfreev(elements); + + g_strfreev(header_blocks); } /* + { + g_autofree gchar * left = g_settings_get_string(settings, "header-start-action-names"); + g_autofree gchar * right = g_settings_get_string(settings, "header-end-action-names"); + + + } + */ + + /* static const gchar * end_actions[] = { "menu.open-menu", }; -- libgit2 0.21.2