Blame SOURCES/0045-wizard-use-a-tab-for-Advanced-opts-instead-of-an-exp.patch

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