Commit fdf0273da6327f7ad97a6397f90773a69f412bb9

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

Adding more convenience method for dialog.

src/dialogs/dialog.c
... ... @@ -76,6 +76,8 @@
76 76  
77 77 #ifdef G_OS_UNIX
78 78 gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),18);
  79 +#else
  80 + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),3);
79 81 #endif // UNIX
80 82  
81 83 // Setup window
... ... @@ -84,6 +86,7 @@
84 86 gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
85 87 gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
86 88  
  89 +
87 90 g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
88 91  
89 92 // Add buttons
... ... @@ -97,15 +100,7 @@
97 100 response_id = va_arg (args, gint);
98 101 while(text != NULL) {
99 102  
100   -#ifdef G_OS_UNIX
101   -
102 103 gtk_dialog_add_button(GTK_DIALOG(dialog), text, response_id);
103   -#else
104   -
105   - GtkWidget * button = gtk_dialog_add_button(GTK_DIALOG(dialog), text, response_id);
106   - gtk_widget_set_margin_top(button,3);
107   -
108   -#endif // G_OS_UNIX
109 104  
110 105 text = va_arg (args, gchar*);
111 106 if (text == NULL)
... ... @@ -119,5 +114,9 @@
119 114  
120 115 }
121 116  
  117 + GtkWidget * v3270_dialog_set_content_area(GtkWidget *dialog, GtkWidget *content_area) {
  118 + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),content_area,TRUE,TRUE,0);
  119 + return content_area;
  120 + }
122 121  
123 122  
... ...
src/include/v3270/dialogs.h
... ... @@ -36,6 +36,7 @@
36 36 G_BEGIN_DECLS
37 37  
38 38 LIB3270_EXPORT GtkWidget * v3270_dialog_new_with_buttons(const gchar *title, GtkWidget *widget, const gchar *first_button_text, ...) G_GNUC_NULL_TERMINATED;
  39 + LIB3270_EXPORT GtkWidget * v3270_dialog_set_content_area(GtkWidget *dialog, GtkWidget *content_area);
39 40  
40 41 LIB3270_EXPORT void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body);
41 42  
... ...