Commit 99cb5577c8e05eed2f8124814a331631f4dbae39
1 parent
2702cf34
Exists in
master
and in
4 other branches
Cleaning up, working on UI.
Showing
5 changed files
with
5 additions
and
192 deletions
Show diff stats
pw3270.cbp
| ... | ... | @@ -122,9 +122,6 @@ |
| 122 | 122 | <Unit filename="src/objects/toolbar/toolbar.c"> |
| 123 | 123 | <Option compilerVar="CC" /> |
| 124 | 124 | </Unit> |
| 125 | - <Unit filename="src/objects/toolbar/toolbutton.c"> | |
| 126 | - <Option compilerVar="CC" /> | |
| 127 | - </Unit> | |
| 128 | 125 | <Unit filename="src/objects/window/actions/close.c"> |
| 129 | 126 | <Option compilerVar="CC" /> |
| 130 | 127 | </Unit> | ... | ... |
src/objects/actions/button.c
| ... | ... | @@ -69,12 +69,13 @@ |
| 69 | 69 | |
| 70 | 70 | g_autofree gchar * tooltip = g_action_get_tooltip(action); |
| 71 | 71 | g_autofree gchar * label = g_action_get_label(action); |
| 72 | - debug("%s(%s).label=%s",__FUNCTION__,g_action_get_name(action),label); | |
| 72 | +// debug("%s(%s).label=%s",__FUNCTION__,g_action_get_name(action),label); | |
| 73 | 73 | if(!label) |
| 74 | 74 | return NULL; |
| 75 | 75 | |
| 76 | 76 | g_autofree gchar * icon_name = g_action_get_icon_name(action); |
| 77 | - debug("%s(%s).icon_name=%s",__FUNCTION__,g_action_get_name(action),icon_name); | |
| 77 | +// debug("%s(%s).icon_name=%s",__FUNCTION__,g_action_get_name(action),icon_name); | |
| 78 | + | |
| 78 | 79 | if(icon_name) { |
| 79 | 80 | |
| 80 | 81 | // Has icon name |
| ... | ... | @@ -105,6 +106,8 @@ |
| 105 | 106 | return item; |
| 106 | 107 | } |
| 107 | 108 | |
| 109 | + g_warning("Can't create button for action \"%s\"",g_action_get_name(action)); | |
| 110 | + | |
| 108 | 111 | return NULL; |
| 109 | 112 | |
| 110 | 113 | } | ... | ... |
src/objects/toolbar/actions.c
| ... | ... | @@ -76,12 +76,6 @@ |
| 76 | 76 | debug("Creating button \"%s\" from action \"%s\"",name,g_action_get_name(G_ACTION(action))); |
| 77 | 77 | item = gtk_tool_button_new_from_action(action,GTK_ICON_SIZE_LARGE_TOOLBAR); |
| 78 | 78 | } |
| 79 | - /* | |
| 80 | - else { | |
| 81 | - debug("Creating button \"%s\" from action name",name); | |
| 82 | - item = GTK_TOOL_ITEM(pw3270_tool_button_new_from_action_name(name)); | |
| 83 | - } | |
| 84 | - */ | |
| 85 | 79 | |
| 86 | 80 | if(item) { |
| 87 | 81 | ... | ... |
src/objects/toolbar/toolbar.c
| ... | ... | @@ -291,23 +291,10 @@ |
| 291 | 291 | gtk_widget_show_all(widget->popup.menu); |
| 292 | 292 | gtk_menu_attach_to_widget(GTK_MENU(widget->popup.menu),GTK_WIDGET(widget),detacher); |
| 293 | 293 | |
| 294 | - /* | |
| 295 | - // Bind settings | |
| 296 | - GSettings *settings = pw3270_application_get_settings(g_application_get_default()); | |
| 297 | - | |
| 298 | - if(settings) { | |
| 299 | -// pw3270_toolbar_set_style(GTK_TOOLBAR(widget),g_settings_get_int(settings,"toolbar-style")); | |
| 300 | -// pw3270_toolbar_set_icon_size(GTK_TOOLBAR(widget),g_settings_get_int(settings,"toolbar-icon-size")); | |
| 301 | - } | |
| 302 | - */ | |
| 303 | - | |
| 304 | 294 | } |
| 305 | 295 | |
| 306 | 296 | static void finalize(GObject *object) { |
| 307 | 297 | |
| 308 | -// pw3270ToolBar * toolbar = PW3270_TOOLBAR(object); | |
| 309 | - | |
| 310 | - | |
| 311 | 298 | G_OBJECT_CLASS(pw3270ToolBar_parent_class)->finalize(object); |
| 312 | 299 | |
| 313 | 300 | } |
| ... | ... | @@ -388,7 +375,6 @@ |
| 388 | 375 | } |
| 389 | 376 | |
| 390 | 377 | // Store value |
| 391 | -// pw3270_settings_set_int("toolbar-icon-size", (gint) icon_size); | |
| 392 | 378 | g_object_notify(G_OBJECT(toolbar), "icon-size"); |
| 393 | 379 | |
| 394 | 380 | } | ... | ... |
src/objects/toolbar/toolbutton.c
| ... | ... | @@ -1,167 +0,0 @@ |
| 1 | -/* | |
| 2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | - * | |
| 6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | - * | |
| 8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | - * Free Software Foundation. | |
| 11 | - * | |
| 12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | - * obter mais detalhes. | |
| 16 | - * | |
| 17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | - * | |
| 21 | - * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | - * | |
| 23 | - * Contatos: | |
| 24 | - * | |
| 25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | - * | |
| 28 | - */ | |
| 29 | - | |
| 30 | - #include "private.h" | |
| 31 | - #include <pw3270/actions.h> | |
| 32 | - | |
| 33 | - /* | |
| 34 | - static const struct Button { | |
| 35 | - const gchar * name; | |
| 36 | - const gchar * icon_name; | |
| 37 | - const gchar * label; | |
| 38 | - const gchar * tooltip; | |
| 39 | - } buttons[] = { | |
| 40 | - { | |
| 41 | - .name = "connect", | |
| 42 | - .icon_name = "gtk-connect", | |
| 43 | - .label = N_("Connect"), | |
| 44 | - .tooltip = N_("Connect to host") | |
| 45 | - }, | |
| 46 | - | |
| 47 | - { | |
| 48 | - .name = "close", | |
| 49 | - .icon_name = "window-close", | |
| 50 | - .label = N_("Close"), | |
| 51 | - .tooltip = N_("Close window") | |
| 52 | - }, | |
| 53 | - | |
| 54 | - { | |
| 55 | - .name = "preferences", | |
| 56 | - .icon_name = "preferences-other", | |
| 57 | - .label = N_("Preferences"), | |
| 58 | - }, | |
| 59 | - | |
| 60 | - { | |
| 61 | - .name = "quit", | |
| 62 | - .icon_name = "gtk-quit", | |
| 63 | - .label = N_("Quit"), | |
| 64 | - .tooltip = N_("Quit application") | |
| 65 | - }, | |
| 66 | - | |
| 67 | - }; | |
| 68 | - | |
| 69 | - static const struct Button * get_button_info(const gchar *name) { | |
| 70 | - | |
| 71 | - size_t ix; | |
| 72 | - const gchar * ptr = strchr(name,'.'); | |
| 73 | - | |
| 74 | - if(ptr) | |
| 75 | - ptr++; | |
| 76 | - else | |
| 77 | - ptr = name; | |
| 78 | - | |
| 79 | - for(ix = 0; ix < G_N_ELEMENTS(buttons); ix++) { | |
| 80 | - | |
| 81 | - if(!g_ascii_strcasecmp(ptr,buttons[ix].name)) { | |
| 82 | - return &buttons[ix]; | |
| 83 | - } | |
| 84 | - | |
| 85 | - } | |
| 86 | - | |
| 87 | - return NULL; | |
| 88 | - } | |
| 89 | - | |
| 90 | - static GtkWidget * setup_button(GtkWidget *button, const gchar *action_name) { | |
| 91 | - | |
| 92 | - if(button) { | |
| 93 | - gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(button),TRUE); | |
| 94 | - gtk_widget_show_all(GTK_WIDGET(button)); | |
| 95 | - } | |
| 96 | - | |
| 97 | - debug("%s(%s)=%p",__FUNCTION__,action_name,button); | |
| 98 | - | |
| 99 | - return button; | |
| 100 | - | |
| 101 | - } | |
| 102 | - | |
| 103 | - GtkWidget * pw3270_tool_button_new_from_action_name(const gchar * action_name) { | |
| 104 | - | |
| 105 | - // Do I have button info? | |
| 106 | - GtkToolItem * button = NULL; | |
| 107 | - | |
| 108 | - const struct Button * info = get_button_info(action_name); | |
| 109 | - | |
| 110 | - if(info) { | |
| 111 | - | |
| 112 | - button = gtk_tool_button_new( | |
| 113 | - NULL, | |
| 114 | - info->label | |
| 115 | - ); | |
| 116 | - | |
| 117 | - gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(button),info->icon_name); | |
| 118 | - | |
| 119 | - if(info->tooltip) | |
| 120 | - gtk_widget_set_tooltip_markup(GTK_WIDGET(button),info->tooltip); | |
| 121 | - | |
| 122 | - | |
| 123 | - } else { | |
| 124 | - | |
| 125 | - g_warning("No toolbar info for action \"%s\"",action_name); | |
| 126 | - | |
| 127 | - } | |
| 128 | - | |
| 129 | - return setup_button(GTK_WIDGET(button),action_name); | |
| 130 | - | |
| 131 | - } | |
| 132 | - | |
| 133 | - GtkWidget * pw3270_tool_button_new(GAction *action) { | |
| 134 | - | |
| 135 | - const gchar * action_name = g_action_get_name(action); | |
| 136 | - GtkToolItem * button = NULL; | |
| 137 | - | |
| 138 | - if(PW3270_IS_ACTION(action)) { | |
| 139 | - | |
| 140 | - // It's a pw3270 action, get attributes from it. | |
| 141 | - | |
| 142 | - const gchar * icon_name = pw3270_action_get_icon_name(action); | |
| 143 | - if(!icon_name) { | |
| 144 | - g_message("Action \"%s\" doesn't have an icon",g_action_get_name(action)); | |
| 145 | - return NULL; | |
| 146 | - } | |
| 147 | - | |
| 148 | - button = gtk_tool_button_new( | |
| 149 | - NULL, | |
| 150 | - pw3270_action_get_label(action) | |
| 151 | - ); | |
| 152 | - | |
| 153 | - gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(button),icon_name); | |
| 154 | - | |
| 155 | - const gchar * tooltip = pw3270_action_get_tooltip(action); | |
| 156 | - if(tooltip) | |
| 157 | - gtk_widget_set_tooltip_markup(GTK_WIDGET(button),tooltip); | |
| 158 | - | |
| 159 | - return setup_button(GTK_WIDGET(button),action_name); | |
| 160 | - | |
| 161 | - } | |
| 162 | - | |
| 163 | - return pw3270_tool_button_new_from_action_name(action_name); | |
| 164 | - | |
| 165 | - } | |
| 166 | - */ | |
| 167 | - |