[libgda] Misc UI tweaks
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Misc UI tweaks
- Date: Fri, 25 Nov 2011 20:53:26 +0000 (UTC)
commit efa202e2de937f5a7354478f97f474bab9cef489
Author: Vivien Malerba <malerba gnome-db org>
Date: Fri Nov 25 21:50:34 2011 +0100
Misc UI tweaks
libgda-ui/data-entries/gdaui-numeric-entry.c | 1 +
libgda-ui/gdaui-init.c | 2 +-
libgda-ui/gdaui-rt-editor.c | 4 +--
tools/browser/browser-window.c | 29 +++++++++++++++++++++++-
tools/browser/query-exec/query-console-page.c | 26 +++++++++++++++++-----
5 files changed, 50 insertions(+), 12 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-numeric-entry.c b/libgda-ui/data-entries/gdaui-numeric-entry.c
index ff639c5..082d91b 100644
--- a/libgda-ui/data-entries/gdaui-numeric-entry.c
+++ b/libgda-ui/data-entries/gdaui-numeric-entry.c
@@ -227,6 +227,7 @@ gdaui_numeric_entry_init (GdauiNumericEntry *entry)
entry->priv->decimal_sep = get_default_decimal_sep ();
entry->priv->thousands_sep = 0;
entry->priv->nb_decimals = G_MAXUINT16;
+ gtk_entry_set_width_chars (GTK_ENTRY (entry), 3);
}
static void
diff --git a/libgda-ui/gdaui-init.c b/libgda-ui/gdaui-init.c
index 6ce530e..d20fcc1 100644
--- a/libgda-ui/gdaui-init.c
+++ b/libgda-ui/gdaui-init.c
@@ -715,7 +715,7 @@ get_spec_with_isocodes (const gchar *file)
xmlFreeNode (node);
node = find_child_node_from_name (xmlDocGetRootElement (spec), "parameters", NULL, NULL);
- node = find_child_node_from_name (xmlDocGetRootElement (spec), "parameter", "id", "CURRENCY");
+ node = find_child_node_from_name (node, "parameter", "id", "CURRENCY");
xmlSetProp (node, BAD_CAST "source", NULL);
}
diff --git a/libgda-ui/gdaui-rt-editor.c b/libgda-ui/gdaui-rt-editor.c
index 8806dae..29da9e1 100644
--- a/libgda-ui/gdaui-rt-editor.c
+++ b/libgda-ui/gdaui-rt-editor.c
@@ -394,9 +394,7 @@ gdaui_rt_editor_init (GdauiRtEditor *rte)
css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css_provider,
"* {\n"
- "-GtkToolbar-shadow-type : GTK_SHADOW_NONE;\n"
- "xthickness : 0;\n"
- "ythickness : 0}",
+ "-GtkToolbar-shadow-type : none}",
-1, NULL);
}
gtk_style_context_add_provider (gtk_widget_get_style_context ((GtkWidget*) toolbar),
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index d612657..2d04c0e 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -1562,6 +1562,27 @@ browser_window_show_notice (BrowserWindow *bwin, GtkMessageType type, const gcha
g_free (tmp);
}
else {
+ if (bwin->priv->notif_widgets) {
+ GSList *list;
+ for (list = bwin->priv->notif_widgets; list; list = list->next) {
+ const gchar *c1, *t1;
+ c1 = g_object_get_data (G_OBJECT (list->data), "context");
+ t1 = g_object_get_data (G_OBJECT (list->data), "text");
+ if (((c1 && context && !strcmp (c1, context)) || (!c1 && !context)) &&
+ ((t1 && text && !strcmp (t1, text)) || (!t1 && !text)))
+ break;
+ }
+ if (list) {
+ GtkWidget *wid;
+ wid = GTK_WIDGET (list->data);
+ g_object_ref ((GObject*) wid);
+ gtk_container_remove (GTK_CONTAINER (bwin->priv->notif_box), wid);
+ gtk_box_pack_end (GTK_BOX (bwin->priv->notif_box), wid, TRUE, TRUE, 0);
+ g_object_unref ((GObject*) wid);
+ return;
+ }
+ }
+
GtkWidget *cb = NULL;
if (context && (type == GTK_MESSAGE_INFO)) {
cb = gtk_check_button_new_with_label (_("Don't show this message again"));
@@ -1574,6 +1595,10 @@ browser_window_show_notice (BrowserWindow *bwin, GtkMessageType type, const gcha
GtkWidget *ibar, *content_area, *label;
ibar = gtk_info_bar_new_with_buttons (GTK_STOCK_CLOSE, 1, NULL);
+ if (context)
+ g_object_set_data_full (G_OBJECT (ibar), "context", g_strdup (context), g_free);
+ if (text)
+ g_object_set_data_full (G_OBJECT (ibar), "text", g_strdup (text), g_free);
gtk_info_bar_set_message_type (GTK_INFO_BAR (ibar), type);
label = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL (label), text);
@@ -1582,7 +1607,7 @@ browser_window_show_notice (BrowserWindow *bwin, GtkMessageType type, const gcha
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (ibar));
if (cb) {
GtkWidget *box;
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), cb, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (content_area), box);
@@ -1594,7 +1619,7 @@ browser_window_show_notice (BrowserWindow *bwin, GtkMessageType type, const gcha
}
g_signal_connect (ibar, "response",
G_CALLBACK (info_bar_response_cb), bwin);
- gtk_box_pack_start (GTK_BOX (bwin->priv->notif_box), ibar, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (bwin->priv->notif_box), ibar, TRUE, TRUE, 0);
bwin->priv->notif_widgets = g_slist_append (bwin->priv->notif_widgets, ibar);
if (g_slist_length (bwin->priv->notif_widgets) > 2) {
gtk_widget_destroy (GTK_WIDGET (bwin->priv->notif_widgets->data));
diff --git a/tools/browser/query-exec/query-console-page.c b/tools/browser/query-exec/query-console-page.c
index 7621a8e..660be25 100644
--- a/tools/browser/query-exec/query-console-page.c
+++ b/tools/browser/query-exec/query-console-page.c
@@ -304,13 +304,13 @@ query_console_page_new (BrowserConnection *bcnc)
GtkWidget *wid, *vbox, *hbox, *bbox, *hpaned, *button;
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_paned_add1 (GTK_PANED (vpaned), hbox);
+ gtk_paned_pack1 (GTK_PANED (vpaned), hbox, TRUE, FALSE);
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (hbox), hpaned, TRUE, TRUE, 0);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_paned_pack1 (GTK_PANED (hpaned), vbox, TRUE, TRUE);
+ gtk_paned_pack1 (GTK_PANED (hpaned), vbox, TRUE, FALSE);
wid = gtk_label_new ("");
str = g_strdup_printf ("<b>%s</b>", _("SQL code to execute:"));
@@ -330,7 +330,7 @@ query_console_page_new (BrowserConnection *bcnc)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
tconsole->priv->params_top = vbox;
- gtk_paned_pack2 (GTK_PANED (hpaned), vbox, TRUE, TRUE);
+ gtk_paned_pack2 (GTK_PANED (hpaned), vbox, FALSE, FALSE);
wid = gtk_label_new ("");
str = g_strdup_printf ("<b>%s</b>", _("Variables' values:"));
@@ -396,11 +396,11 @@ query_console_page_new (BrowserConnection *bcnc)
/* bottom paned for the results and history */
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_paned_add2 (GTK_PANED (vpaned), hpaned);
+ gtk_paned_pack2 (GTK_PANED (vpaned), hpaned, TRUE, FALSE);
/* bottom left */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_paned_pack1 (GTK_PANED (hpaned), vbox, FALSE, TRUE);
+ gtk_paned_pack1 (GTK_PANED (hpaned), vbox, FALSE, FALSE);
wid = gtk_label_new ("");
str = g_strdup_printf ("<b>%s</b>", _("Execution history:"));
@@ -769,6 +769,12 @@ sql_favorite_clicked_cb (G_GNUC_UNUSED GtkButton *button, QueryConsolePage *tcon
}
static void
+fav_form_name_activated_cb (G_GNUC_UNUSED GtkWidget *form, GtkWidget *dlg)
+{
+ gtk_dialog_response (dlg, GTK_RESPONSE_ACCEPT);
+}
+
+static void
sql_favorite_new_mitem_cb (G_GNUC_UNUSED GtkMenuItem *mitem, QueryConsolePage *tconsole)
{
BrowserFavorites *bfav;
@@ -776,7 +782,7 @@ sql_favorite_new_mitem_cb (G_GNUC_UNUSED GtkMenuItem *mitem, QueryConsolePage *t
GError *error = NULL;
GdaSet *set;
- GtkWidget *dlg;
+ GtkWidget *dlg, *form;
gint response;
const GValue *cvalue;
set = gda_set_new_inline (1, _("Favorite's name"),
@@ -785,6 +791,9 @@ sql_favorite_new_mitem_cb (G_GNUC_UNUSED GtkMenuItem *mitem, QueryConsolePage *t
(GtkWindow*) gtk_widget_get_toplevel (GTK_WIDGET (tconsole)),
_("Name of the favorite to create"),
_("Enter the name of the favorite to create"));
+ form = g_object_get_data (G_OBJECT (dlg), "form");
+ g_signal_connect (form, "activated",
+ G_CALLBACK (fav_form_name_activated_cb), dlg);
response = gtk_dialog_run (GTK_DIALOG (dlg));
if (response == GTK_RESPONSE_REJECT) {
g_object_unref (set);
@@ -886,6 +895,9 @@ sql_execute_clicked_cb (G_GNUC_UNUSED GtkButton *button, QueryConsolePage *tcons
{
gchar *sql;
+ if (tconsole->priv->params_popup)
+ gtk_widget_hide (tconsole->priv->params_popup);
+
/* compute parameters if necessary */
if (tconsole->priv->params_compute_id > 0) {
g_source_remove (tconsole->priv->params_compute_id);
@@ -947,6 +959,8 @@ sql_execute_clicked_cb (G_GNUC_UNUSED GtkButton *button, QueryConsolePage *tcons
g_object_set ((GObject*) form, "show-actions", TRUE, NULL);
g_signal_connect (form, "holder-changed",
G_CALLBACK (params_form_changed_cb), tconsole);
+ g_signal_connect (form, "activated",
+ G_CALLBACK (sql_execute_clicked_cb), tconsole);
gtk_box_pack_start (GTK_BOX (cont), form, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (tconsole->priv->params_popup), "form", form);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]