Commit 3bfbcbee4014c60dded6e996721b5eca88d22bdb

Authored by Perry Werneck
1 parent 9c7305f5
Exists in master and in 1 other branch develop

Styling dialog section.

src/dialogs/popups.c
... ... @@ -38,8 +38,7 @@
38 38  
39 39 static void v3270_dialog_add_class_for_response(GtkWidget *dialog, gint response_id, const char *className) {
40 40 GtkWidget * widget = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),response_id);
41   - GtkStyleContext *context = gtk_widget_get_style_context(widget);
42   - gtk_style_context_add_class(context,className);
  41 + gtk_widget_add_class(widget,className);
43 42 }
44 43  
45 44 GtkResponseType v3270_popup_dialog_show(GtkWidget *widget, const LIB3270_POPUP *popup, gboolean wait) {
... ...
src/dialogs/tools.c
... ... @@ -29,6 +29,7 @@
29 29  
30 30 #include <internals.h>
31 31 #include <v3270/dialogs.h>
  32 + #include <v3270/tools.h>
32 33  
33 34 /*--[ Implement ]------------------------------------------------------------------------------------*/
34 35  
... ... @@ -50,7 +51,7 @@
50 51 // https://developer.gnome.org/hig/stable/visual-layout.html.en
51 52  
52 53 GtkFrame * frame = GTK_FRAME(gtk_frame_new(""));
53   - GtkWidget * label = gtk_label_new(NULL);
  54 + GtkWidget * label = gtk_label_new(title);
54 55  
55 56 #ifdef G_OS_UNIX
56 57 {
... ... @@ -58,16 +59,12 @@
58 59 g_autofree gchar * markup = g_strdup_printf("<b>%s</b>",title);
59 60 gtk_label_set_markup(GTK_LABEL(label),markup);
60 61  
  62 + gtk_widget_add_class(label,"separator");
61 63 g_object_set(G_OBJECT(frame),"margin-top",6,NULL);
62 64  
63 65 gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE);
64 66  
65 67 }
66   -#else
67   - {
68   - // Non Unix/Linux, use the windows style.
69   - gtk_label_set_text(GTK_LABEL(label),title);
70   - }
71 68 #endif // G_OS_UNIX
72 69  
73 70 gtk_frame_set_label_widget(GTK_FRAME(frame),label);
... ...
src/include/v3270/tools.h
... ... @@ -37,6 +37,9 @@
37 37 /// @brief Bind pointer to widget; release it when widget is destroyed.
38 38 LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr);
39 39  
  40 + /// @brief Add style to widget.
  41 + LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className);
  42 +
40 43 /// @brief Bind file chooser with entry field.
41 44 LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name);
42 45  
... ...
src/tools/entry.c
... ... @@ -139,14 +139,6 @@
139 139  
140 140 }
141 141  
142   - static void release_ptr(GtkWidget G_GNUC_UNUSED(*object), gpointer ptr) {
143   - g_free(ptr);
144   - }
145   -
146   - LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr) {
147   - g_signal_connect(widget,"destroy",G_CALLBACK(release_ptr),ptr);
148   - }
149   -
150 142 LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name) {
151 143  
152 144 gtk_entry_set_icon_from_icon_name(
... ...
src/tools/widget.c 0 → 100644
... ... @@ -0,0 +1,49 @@
  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 + /**
  31 + * @brief Useful extensions for GtkWidget.
  32 + *
  33 + */
  34 +
  35 + #include <v3270/tools.h>
  36 +
  37 + LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className) {
  38 + GtkStyleContext *context = gtk_widget_get_style_context(widget);
  39 + gtk_style_context_add_class(context,className);
  40 + }
  41 +
  42 + static void release_ptr(GtkWidget G_GNUC_UNUSED(*object), gpointer ptr) {
  43 + g_free(ptr);
  44 + }
  45 +
  46 + LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr) {
  47 + g_signal_connect(widget,"destroy",G_CALLBACK(release_ptr),ptr);
  48 + }
  49 +
... ...
v3270.cbp
... ... @@ -408,6 +408,9 @@
408 408 <Unit filename="src/tools/entry.c">
409 409 <Option compilerVar="CC" />
410 410 </Unit>
  411 + <Unit filename="src/tools/widget.c">
  412 + <Option compilerVar="CC" />
  413 + </Unit>
411 414 <Unit filename="src/trace/exec.c">
412 415 <Option compilerVar="CC" />
413 416 </Unit>
... ...