[libgda] Misc. corrections and improvements



commit fe46924a1e12b1f003570c4d1a4a569d9c72fd12
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Nov 29 14:23:38 2015 +0100

    Misc. corrections and improvements

 control-center/gdaui-bar.c                 |   35 +--------------------------
 libgda-ui/data-entries/gdaui-entry-shell.c |    1 +
 libgda-ui/gdaui-data-proxy-info.c          |   13 +++++----
 libgda-ui/gdaui-form.c                     |   13 +++++++++-
 libgda-ui/gdaui-grid.c                     |    3 ++
 libgda-ui/gdaui-raw-grid.c                 |    8 +----
 libgda-ui/gdaui.css                        |    4 +++
 libgda/gda-enums.h                         |    1 -
 testing/gdaui-test-data-entries.c          |    2 +-
 9 files changed, 32 insertions(+), 48 deletions(-)
---
diff --git a/control-center/gdaui-bar.c b/control-center/gdaui-bar.c
index d734c21..71238fd 100644
--- a/control-center/gdaui-bar.c
+++ b/control-center/gdaui-bar.c
@@ -125,6 +125,7 @@ gdaui_bar_init (GdauiBar *bar)
        content_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
        gtk_widget_show (content_area);
        gtk_box_pack_start (GTK_BOX (bar), content_area, TRUE, TRUE, 0);
+       gtk_container_set_border_width (GTK_CONTAINER (content_area), 6);
 
        GtkWidget *tmp;
        tmp = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -163,39 +164,7 @@ gdaui_bar_init (GdauiBar *bar)
        gtk_label_set_line_wrap (GTK_LABEL (bar->priv->label), TRUE);
         gtk_widget_show (bar->priv->label);
 
-       /* CSS theming */
-       GtkStyleContext *context;
-       if (!css_provider) {
-#define CSS ".gdauibar {\n"                            \
-                       "border-radius: 3px;\n"         \
-                       "padding: 5px;\n"               \
-                       "}"                             \
-                       ".gdauibar_button {\n"                  \
-                       "-GtkButton-default-border : 0px;\n"    \
-                       "-GtkButton-default-outside-border : 0px;\n"    \
-                       "-GtkWidget-focus-line-width : 0px;\n"          \
-                       "-GtkWidget-focus-padding : 0px;\n"             \
-                       "padding: 0px;\n"                               \
-                       "-GtkButtonBox-child-internal-pad-x : 1px;\n"   \
-                       "-GtkButtonBox-child-min-width : 0px;\n"        \
-                       "border-style: none;\n"                         \
-                       "}"                                             \
-                       ".gdauibar_entry {\n"                           \
-                       "-GtkWidget-focus-line-width : 0px;\n"          \
-                       "-GtkWidget-focus-padding : 0px;\n"             \
-                       "padding: 1px;\n"                               \
-                       "-GtkButtonBox-child-internal-pad-x : 1px;\n"   \
-                       "-GtkButtonBox-child-min-width : 0px;\n"        \
-                       "border-style: solid;\n"                        \
-                       "border-radius: 3px;\n"                         \
-                       "}"
-               css_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
-               gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (css_provider), CSS, -1, NULL);
-       }
-       context = gtk_widget_get_style_context (GTK_WIDGET (bar));
-       gtk_style_context_add_provider (context, css_provider, G_MAXUINT);
-       gtk_style_context_add_class (context, "gdauibar");
-       gtk_style_context_add_class (context, "inline-toolbar");
+       gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (bar)), "inline-toolbar");
 }
 
 static void
diff --git a/libgda-ui/data-entries/gdaui-entry-shell.c b/libgda-ui/data-entries/gdaui-entry-shell.c
index e3110f4..ccee60b 100644
--- a/libgda-ui/data-entries/gdaui-entry-shell.c
+++ b/libgda-ui/data-entries/gdaui-entry-shell.c
@@ -174,6 +174,7 @@ gdaui_entry_shell_init (GdauiEntryShell *shell)
        /* button to change the entry's state and to display that state */
        arrow = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
        button = gtk_button_new ();
+       gtk_style_context_add_class (gtk_widget_get_style_context (button), "action-entry");
        gtk_container_add (GTK_CONTAINER (button), arrow);
        gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
        shell->priv->button = button;
diff --git a/libgda-ui/gdaui-data-proxy-info.c b/libgda-ui/gdaui-data-proxy-info.c
index 11fb90c..f60267f 100644
--- a/libgda-ui/gdaui-data-proxy-info.c
+++ b/libgda-ui/gdaui-data-proxy-info.c
@@ -632,6 +632,7 @@ modif_buttons_make (GdauiDataProxyInfo *info)
                else {
                        GtkToolItem *ti;
                        ti = gtk_tool_item_new  ();
+                       gtk_container_set_border_width (GTK_CONTAINER (ti), 4);
                        gtk_toolbar_insert (GTK_TOOLBAR (info), ti, -1);
                        action_items[ACTION_CURRENT_ROW] = GTK_WIDGET (g_object_ref (G_OBJECT (ti)));
                }
@@ -668,7 +669,7 @@ modif_buttons_make (GdauiDataProxyInfo *info)
                }
                else {
                        /* read-only counter (mainly for grids) */
-                       wid = gtk_label_new ("? - ? /?");
+                       wid = gtk_label_new (" ? - ? /?");
                        gtk_widget_override_font (wid, fdc);
                        info->priv->current_sample = wid;
                        toolwid = wid;
@@ -763,7 +764,7 @@ idle_modif_buttons_update (GdauiDataProxyInfo *info)
                                gtk_label_set_text (GTK_LABEL (info->priv->current_sample), " /?");
                        }
                        else
-                               gtk_label_set_text (GTK_LABEL (info->priv->current_sample), "? - ? /?");
+                               gtk_label_set_text (GTK_LABEL (info->priv->current_sample), " ? - ? /?");
                }
                else {
                        gchar *str;
@@ -790,16 +791,16 @@ idle_modif_buttons_update (GdauiDataProxyInfo *info)
                        }
                        else {
                                if (total <= 0)
-                                       str = g_strdup_printf ("0 - 0 / 0");
+                                       str = g_strdup_printf (" 0 - 0 / 0");
                                else {
                                        if (all_rows < 0)
-                                               str = g_strdup_printf ("%d - %d /?", sample_first_row + 1, 
total);
+                                               str = g_strdup_printf (" %d - %d /?", sample_first_row + 1, 
total);
                                        else {
                                                if (filtered_proxy)
-                                                       str = g_strdup_printf ("%d - %d / (%d)",
+                                                       str = g_strdup_printf (" %d - %d / (%d)",
                                                                               sample_first_row + 1, total, 
all_rows);
                                                else
-                                                       str = g_strdup_printf ("%d - %d / %d",
+                                                       str = g_strdup_printf (" %d - %d / %d",
                                                                               sample_first_row + 1, total, 
all_rows);
                                        }
                                }
diff --git a/libgda-ui/gdaui-form.c b/libgda-ui/gdaui-form.c
index 3d7b1f3..5aee348 100644
--- a/libgda-ui/gdaui-form.c
+++ b/libgda-ui/gdaui-form.c
@@ -199,8 +199,16 @@ gdaui_form_init (GdauiForm *form)
 
        gtk_orientable_set_orientation (GTK_ORIENTABLE (form), GTK_ORIENTATION_VERTICAL);
 
+       GtkWidget *frame;
+       frame = gtk_frame_new (NULL);
+       gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+       gtk_box_pack_start (GTK_BOX (form), frame, FALSE, FALSE, 0);
+       gtk_widget_show (frame);
+
        form->priv->raw_form = gdaui_raw_form_new (NULL);
-       gtk_box_pack_start (GTK_BOX (form), form->priv->raw_form, FALSE, FALSE, 0);
+       gtk_container_add (GTK_CONTAINER (frame), form->priv->raw_form);
+       gtk_container_set_border_width (GTK_CONTAINER (form->priv->raw_form), 6);
+
        gtk_widget_show (form->priv->raw_form);
        g_signal_connect (form->priv->raw_form, "layout-changed",
                          G_CALLBACK (form_layout_changed_cb), form);
@@ -210,6 +218,9 @@ gdaui_form_init (GdauiForm *form)
        form->priv->info = gdaui_data_proxy_info_new (GDAUI_DATA_PROXY (form->priv->raw_form),
                                                      GDAUI_DATA_PROXY_INFO_CURRENT_ROW |
                                                      GDAUI_DATA_PROXY_INFO_ROW_MOVE_BUTTONS);
+       gtk_widget_set_halign (form->priv->info, GTK_ALIGN_START);
+       gtk_style_context_add_class (gtk_widget_get_style_context (form->priv->info), "inline-toolbar");
+
        gtk_box_pack_start (GTK_BOX (form), form->priv->info, FALSE, FALSE, 0);
        gtk_widget_show (form->priv->info);
 
diff --git a/libgda-ui/gdaui-grid.c b/libgda-ui/gdaui-grid.c
index a30d429..916d4f2 100644
--- a/libgda-ui/gdaui-grid.c
+++ b/libgda-ui/gdaui-grid.c
@@ -205,6 +205,9 @@ gdaui_grid_init (GdauiGrid *grid)
 
        grid->priv->info = gdaui_data_proxy_info_new (GDAUI_DATA_PROXY (grid->priv->raw_grid),
                                                      GDAUI_DATA_PROXY_INFO_CURRENT_ROW);
+       gtk_widget_set_halign (grid->priv->info, GTK_ALIGN_START);
+       gtk_style_context_add_class (gtk_widget_get_style_context (grid->priv->info), "inline-toolbar");
+
        gtk_box_pack_start (GTK_BOX (grid), grid->priv->info, FALSE, TRUE, 0);
        gtk_widget_show (grid->priv->info);
 }
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index ccf47cc..700a7ab 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -1066,7 +1066,6 @@ cell_value_set_attributes (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
                                                                        grid->priv->iter, iter,
                                                                        TRUE);
                if (values) {
-
                        g_object_set (G_OBJECT (cell),
                                      "values-display", values,
                                      "value-attributes", attributes,
@@ -1078,7 +1077,6 @@ cell_value_set_attributes (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
                                      "cell_background-set",
                                      ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
                                      "to-be-deleted", to_be_deleted,
-                                     "visible", !(attributes & GDA_VALUE_ATTR_UNUSED),
                                      NULL);
                }
                else {
@@ -1095,7 +1093,6 @@ cell_value_set_attributes (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
                                      "cell_background-set",
                                      ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
                                      "to-be-deleted", to_be_deleted,
-                                     "visible", !(attributes & GDA_VALUE_ATTR_UNUSED),
                                      NULL);
                }
 
@@ -1126,7 +1123,6 @@ cell_value_set_attributes (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
                              "cell_background-set",
                              ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
                              "to-be-deleted", to_be_deleted,
-                             "visible", !(attributes & GDA_VALUE_ATTR_UNUSED),
                              NULL);
        }
 
@@ -1179,7 +1175,7 @@ cell_info_set_attributes (GtkTreeViewColumn *tree_column,
                              "cell-background", GDAUI_COLOR_NORMAL_MODIF,
                              "cell_background-set", ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || 
to_be_deleted,
                              "to-be-deleted", to_be_deleted,
-                             "visible", cdata->info_shown && !(attributes & GDA_VALUE_ATTR_UNUSED),
+                             "visible", cdata->info_shown,
                              NULL);
        }
        else {
@@ -1203,7 +1199,7 @@ cell_info_set_attributes (GtkTreeViewColumn *tree_column,
                              "cell-background", GDAUI_COLOR_NORMAL_MODIF,
                              "cell_background-set", ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || 
to_be_deleted,
                              "to-be-deleted", to_be_deleted,
-                             "visible", cdata->info_shown && !(attributes & GDA_VALUE_ATTR_UNUSED),
+                             "visible", cdata->info_shown,
                              NULL);
        }
 }
diff --git a/libgda-ui/gdaui.css b/libgda-ui/gdaui.css
index 4290115..2397273 100644
--- a/libgda-ui/gdaui.css
+++ b/libgda-ui/gdaui.css
@@ -39,4 +39,8 @@ GdauiRtEditor GtkToolbar {
 
 GtkPaned.paned-no-border {
     -GtkPaned-handle-size: 0;
+}
+
+.action-entry {
+    padding : 0;
 }
\ No newline at end of file
diff --git a/libgda/gda-enums.h b/libgda/gda-enums.h
index 9ef02f9..973a551 100644
--- a/libgda/gda-enums.h
+++ b/libgda/gda-enums.h
@@ -53,7 +53,6 @@ typedef enum  {
         GDA_VALUE_ATTR_DATA_NON_VALID = 1 << 6,
         GDA_VALUE_ATTR_HAS_VALUE_ORIG = 1 << 7,
        GDA_VALUE_ATTR_NO_MODIF       = 1 << 8,
-       GDA_VALUE_ATTR_UNUSED         = 1 << 9
 } GdaValueAttribute;
 
 /* how SQL identifiers are represented */
diff --git a/testing/gdaui-test-data-entries.c b/testing/gdaui-test-data-entries.c
index f4210f8..cc4bcb4 100644
--- a/testing/gdaui-test-data-entries.c
+++ b/testing/gdaui-test-data-entries.c
@@ -140,8 +140,8 @@ main (int argc, char **argv)
         g_option_context_free (context);
        
        /* Initialize the widget set */
-       gdaui_init ();
        gtk_init (&argc, &argv);
+       gdaui_init ();
 
        /* init main conf */
        GType tested_gtypes [] = {G_TYPE_INT64, G_TYPE_UINT64, GDA_TYPE_BINARY, G_TYPE_BOOLEAN, GDA_TYPE_BLOB,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]