|
|
4b6aa8 |
From 6cf4c34ea589698c3c4b9a2a6b708ca66f446844 Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
Date: Tue, 24 Jun 2014 16:25:30 +0200
|
|
|
4b6aa8 |
Subject: [LIBREPORT PATCH 45/93] wizard: use a tab for Advanced opts instead
|
|
|
4b6aa8 |
of an expander
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
GtkExpander containing wrapped labels breaks GTK3's algorithm computing
|
|
|
4b6aa8 |
the window size when expanding/folding.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
A tab page seems to be more modern approach which does not causes any
|
|
|
4b6aa8 |
problems.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
The tab pages are filled with GtkScrolledWindow in order to prevent
|
|
|
4b6aa8 |
enlarging the configuration window behind screen limits.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
The worfklow window also uses tab pages but on the left side because
|
|
|
4b6aa8 |
two vertical tab page lines are strange.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Resolves rhbz#965963
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/gtk-helpers/event_config_dialog.c | 59 ++++++++++++++++++++------------
|
|
|
4b6aa8 |
src/gtk-helpers/workflow_config_dialog.c | 25 +++++++++-----
|
|
|
4b6aa8 |
2 files changed, 55 insertions(+), 29 deletions(-)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
|
|
|
4b6aa8 |
index 1ed5196..9d442d6 100644
|
|
|
4b6aa8 |
--- a/src/gtk-helpers/event_config_dialog.c
|
|
|
4b6aa8 |
+++ b/src/gtk-helpers/event_config_dialog.c
|
|
|
4b6aa8 |
@@ -189,19 +189,18 @@ static void add_option_to_table(gpointer data, gpointer user_data)
|
|
|
4b6aa8 |
free(option_label);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
-config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWidget *content)
|
|
|
4b6aa8 |
+static GtkWidget *create_event_config_grid()
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- INITIALIZE_LIBREPORT();
|
|
|
4b6aa8 |
-
|
|
|
4b6aa8 |
- if (content == NULL)
|
|
|
4b6aa8 |
- content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
|
|
4b6aa8 |
+ GtkWidget *option_table = gtk_grid_new();
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- //event_config_t *event = get_event_config(event_name);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_left(option_table, 5);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_top(option_table, 5);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_right(option_table, 5);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_bottom(option_table, 5);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- GtkWidget *option_table = gtk_grid_new();
|
|
|
4b6aa8 |
gtk_grid_set_row_homogeneous(GTK_GRID(option_table), FALSE);
|
|
|
4b6aa8 |
gtk_grid_set_column_homogeneous(GTK_GRID(option_table), FALSE);
|
|
|
4b6aa8 |
- gtk_grid_set_row_spacing(GTK_GRID(option_table), 2);
|
|
|
4b6aa8 |
+ gtk_grid_set_row_spacing(GTK_GRID(option_table), 10);
|
|
|
4b6aa8 |
g_object_set_data(G_OBJECT(option_table), "n-rows", (gpointer)-1);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
gtk_widget_set_hexpand(option_table, TRUE);
|
|
|
4b6aa8 |
@@ -209,21 +208,28 @@ config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWi
|
|
|
4b6aa8 |
gtk_widget_set_halign(option_table, GTK_ALIGN_FILL);
|
|
|
4b6aa8 |
gtk_widget_set_valign(option_table, GTK_ALIGN_FILL);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
+ return option_table;
|
|
|
4b6aa8 |
+}
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWidget *content)
|
|
|
4b6aa8 |
+{
|
|
|
4b6aa8 |
+ INITIALIZE_LIBREPORT();
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ if (content == NULL)
|
|
|
4b6aa8 |
+ content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ //event_config_t *event = get_event_config(event_name);
|
|
|
4b6aa8 |
+ GtkWidget *notebook_layout = gtk_notebook_new();
|
|
|
4b6aa8 |
+ gtk_box_pack_start(GTK_BOX(content), notebook_layout, TRUE, TRUE, 0);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ GtkWidget *option_table = create_event_config_grid();
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
/* table to hold advanced options
|
|
|
4b6aa8 |
* hidden in expander which is visible only if there's at least
|
|
|
4b6aa8 |
* one advanced option
|
|
|
4b6aa8 |
*/
|
|
|
4b6aa8 |
+ GtkWidget *adv_option_table = create_event_config_grid();
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- GtkWidget *adv_option_table = gtk_grid_new();
|
|
|
4b6aa8 |
- gtk_grid_set_row_homogeneous(GTK_GRID(adv_option_table), FALSE);
|
|
|
4b6aa8 |
- gtk_grid_set_column_homogeneous(GTK_GRID(adv_option_table), FALSE);
|
|
|
4b6aa8 |
- gtk_grid_set_row_spacing(GTK_GRID(adv_option_table), 2);
|
|
|
4b6aa8 |
- g_object_set_data(G_OBJECT(adv_option_table), "n-rows", (gpointer)-1);
|
|
|
4b6aa8 |
-
|
|
|
4b6aa8 |
- GtkWidget *adv_expander = gtk_expander_new(_("Advanced"));
|
|
|
4b6aa8 |
- /* resize the toplevel widget containing the expander upon resizing and collapsing. */
|
|
|
4b6aa8 |
- gtk_expander_set_resize_toplevel(GTK_EXPANDER(adv_expander), TRUE);
|
|
|
4b6aa8 |
- gtk_container_add(GTK_CONTAINER(adv_expander), adv_option_table);
|
|
|
4b6aa8 |
g_object_set_data(G_OBJECT(option_table), "advanced-options", adv_option_table);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
has_password_option = false;
|
|
|
4b6aa8 |
@@ -250,11 +256,22 @@ config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWi
|
|
|
4b6aa8 |
g_signal_connect(pass_store_cb, "toggled", G_CALLBACK(on_show_pass_store_cb), NULL);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- gtk_box_pack_start(GTK_BOX(content), option_table, false, false, 20);
|
|
|
4b6aa8 |
+ GtkWidget *option_table_lbl = gtk_label_new_with_mnemonic(_("Basic"));
|
|
|
4b6aa8 |
+ GtkWidget *option_table_scrl = gtk_scrolled_window_new(NULL, NULL);
|
|
|
4b6aa8 |
+ gtk_container_add(GTK_CONTAINER(option_table_scrl), option_table);
|
|
|
4b6aa8 |
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook_layout), option_table_scrl, option_table_lbl);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
/* add the adv_option_table to the dialog only if there is some adv option */
|
|
|
4b6aa8 |
if (g_list_length(gtk_container_get_children(GTK_CONTAINER(adv_option_table))) > 0)
|
|
|
4b6aa8 |
- gtk_box_pack_start(GTK_BOX(content), adv_expander, false, false, 0);
|
|
|
4b6aa8 |
+ {
|
|
|
4b6aa8 |
+ GtkWidget *adv_option_table_lbl = gtk_label_new_with_mnemonic(_("Advanced"));
|
|
|
4b6aa8 |
+ GtkWidget *adv_option_table_scrl = gtk_scrolled_window_new(NULL, NULL);
|
|
|
4b6aa8 |
+ gtk_container_add(GTK_CONTAINER(adv_option_table_scrl), adv_option_table);
|
|
|
4b6aa8 |
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook_layout), adv_option_table_scrl, adv_option_table_lbl);
|
|
|
4b6aa8 |
+ }
|
|
|
4b6aa8 |
+ else
|
|
|
4b6aa8 |
+ /* Do not show single tab 'Basic' */
|
|
|
4b6aa8 |
+ gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook_layout), FALSE);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
/* add warning if secrets service is not available showing the nagging dialog
|
|
|
4b6aa8 |
* is considered "too heavy UI" be designers
|
|
|
4b6aa8 |
@@ -311,7 +328,7 @@ config_dialog_t *create_event_config_dialog(const char *event_name, GtkWindow *p
|
|
|
4b6aa8 |
* line wrapped.
|
|
|
4b6aa8 |
*/
|
|
|
4b6aa8 |
gtk_window_set_resizable(GTK_WINDOW(dialog), true);
|
|
|
4b6aa8 |
- gtk_window_set_default_size(GTK_WINDOW(dialog), 450, -1);
|
|
|
4b6aa8 |
+ gtk_window_set_default_size(GTK_WINDOW(dialog), 450, 310);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
if (parent_window != NULL)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
diff --git a/src/gtk-helpers/workflow_config_dialog.c b/src/gtk-helpers/workflow_config_dialog.c
|
|
|
4b6aa8 |
index 7c399e4..45d7fb6 100644
|
|
|
4b6aa8 |
--- a/src/gtk-helpers/workflow_config_dialog.c
|
|
|
4b6aa8 |
+++ b/src/gtk-helpers/workflow_config_dialog.c
|
|
|
4b6aa8 |
@@ -29,15 +29,23 @@ enum
|
|
|
4b6aa8 |
static GtkWindow *g_parent_window;
|
|
|
4b6aa8 |
static GHashTable *g_events_options = NULL;
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
-static void create_event_config_dialog_content_cb(event_config_t *ec, gpointer content)
|
|
|
4b6aa8 |
+static void create_event_config_dialog_content_cb(event_config_t *ec, gpointer notebook)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- if (ec->options)
|
|
|
4b6aa8 |
- {
|
|
|
4b6aa8 |
- GtkWidget *ev_lbl = gtk_label_new(ec_get_screen_name(ec));
|
|
|
4b6aa8 |
- gtk_box_pack_start(GTK_BOX(content), ev_lbl, false, false, 0);
|
|
|
4b6aa8 |
- }
|
|
|
4b6aa8 |
+ if (!ec->options)
|
|
|
4b6aa8 |
+ return;
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ GtkWidget *ev_lbl = gtk_label_new(ec_get_screen_name(ec));
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ GtkWidget *content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_left(content, 10);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_top(content, 5);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_right(content, 10);
|
|
|
4b6aa8 |
+ gtk_widget_set_margin_bottom(content, 10);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
config_dialog_t *cdialog = create_event_config_dialog_content(ec, (GtkWidget *)content);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), content, ev_lbl);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
if (g_events_options == NULL)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
g_events_options = g_hash_table_new_full(
|
|
|
4b6aa8 |
@@ -46,8 +54,8 @@ static void create_event_config_dialog_content_cb(event_config_t *ec, gpointer c
|
|
|
4b6aa8 |
/*key_destroy_func:*/ g_free,
|
|
|
4b6aa8 |
/*value_destroy_func:*/ NULL);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
- g_hash_table_insert(g_events_options, ec, cdialog);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
+ g_hash_table_insert(g_events_options, ec, cdialog);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static void save_event_config_data_foreach(event_config_t *ec,
|
|
|
4b6aa8 |
@@ -91,7 +99,8 @@ config_dialog_t *create_workflow_config_dialog(const char *workflow_name, GtkWin
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
GtkWidget *scrolled = gtk_scrolled_window_new(NULL, NULL);
|
|
|
4b6aa8 |
- GtkWidget *content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
|
|
4b6aa8 |
+ GtkWidget *content = gtk_notebook_new();
|
|
|
4b6aa8 |
+ gtk_notebook_set_tab_pos(GTK_NOTEBOOK(content), GTK_POS_LEFT);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 7) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 7 && GTK_MICRO_VERSION < 8))
|
|
|
4b6aa8 |
/* http://developer.gnome.org/gtk3/unstable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport */
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|