[libgda] Misc. UI corrections
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Misc. UI corrections
- Date: Tue, 7 Jul 2015 15:18:51 +0000 (UTC)
commit 0e6cbbd757fd9fb9bbdbae9041d2527210e35f4c
Author: Vivien Malerba <malerba gnome-db org>
Date: Tue Jul 7 17:14:56 2015 +0200
Misc. UI corrections
libgda-ui/data-entries/common-bin.c | 33 ++++++++++++----------
libgda-ui/data-entries/plugins/common-pict.c | 26 +++++++++--------
libgda-ui/gdaui-basic-form.c | 10 +++++-
libgda-ui/gdaui-raw-grid.c | 2 +-
libgda-ui/gdaui-rt-editor.c | 16 ++++++-----
libgda-ui/gdaui.css | 12 --------
libgda-ui/internal/gdaui-provider-spec-editor.c | 2 +-
libgda-ui/internal/utility.c | 23 +++++++++++-----
8 files changed, 67 insertions(+), 57 deletions(-)
---
diff --git a/libgda-ui/data-entries/common-bin.c b/libgda-ui/data-entries/common-bin.c
index 19657b8..25e92d5 100644
--- a/libgda-ui/data-entries/common-bin.c
+++ b/libgda-ui/data-entries/common-bin.c
@@ -72,15 +72,16 @@ file_load_cb (GtkWidget *button, BinMenu *menu)
}
else {
GtkWidget *msg;
-
+ gchar *tmp;
+ tmp = g_strdup_printf (_("Could not load the contents of '%s'"), filename);
msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
(button)),
- GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Could not load the contents of '%s':\n %s"),
- filename,
- error && error->message ? error->message : _("No detail"));
- if (error)
- g_error_free (error);
+ GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "<b>%s:</b>\n%s: %s",
+ _("Error"), tmp,
+ error && error->message ?
error->message : _("No detail"));
+ g_free (tmp);
+ g_clear_error (&error);
gtk_widget_destroy (dlg);
dlg = NULL;
@@ -150,14 +151,16 @@ file_save_cb (GtkWidget *button, BinMenu *menu)
g_assert_not_reached ();
if (!allok) {
GtkWidget *msg;
+ gchar *tmp;
+ tmp = g_strdup_printf (_("Could not save data to '%s'"), filename);
msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
(button)),
- GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Could not save data to '%s':\n %s"),
- filename,
- error && error->message ? error->message :
_("No detail"));
- if (error)
- g_error_free (error);
+ GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "<b>%s:</b>\n%s: %s",
+ _("Error"), tmp,
+ error && error->message ? error->message :
_("No detail"));
+ g_free (tmp);
+ g_clear_error (&error);
gtk_widget_destroy (dlg);
dlg = NULL;
diff --git a/libgda-ui/data-entries/plugins/common-pict.c b/libgda-ui/data-entries/plugins/common-pict.c
index 83a57aa..f7bd50d 100644
--- a/libgda-ui/data-entries/plugins/common-pict.c
+++ b/libgda-ui/data-entries/plugins/common-pict.c
@@ -420,15 +420,16 @@ file_load_cb (GtkWidget *button, PictMenuData *menudata)
}
else {
GtkWidget *msg;
-
- msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
(button)),
+ gchar *tmp;
+ tmp = g_strdup_printf (_("Could not load the contents of '%s'"), filename);
+ msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
(button)),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- _("Could not load the contents of '%s':\n
%s"),
- filename,
+ "<b>%s:</b>\n%s: %s",
+ _("Error"), tmp,
error && error->message ? error->message :
_("No detail"));
- if (error)
- g_error_free (error);
+ g_free (tmp);
+ g_clear_error (&error);
gtk_widget_destroy (dlg);
dlg = NULL;
@@ -532,15 +533,16 @@ file_save_cb (GtkWidget *button, PictMenuData *menudata)
if (!allok) {
GtkWidget *msg;
-
- msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
(button)),
+ gchar *tmp;
+ tmp = g_strdup_printf (_("Could not save the image to '%s'"), filename);
+ msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
(button)),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- _("Could not save the image to '%s':\n
%s"),
- filename,
+ "<b>%s:</b>\n%s: %s",
+ _("Error"), tmp,
error && error->message ? error->message :
_("No detail"));
- if (error)
- g_error_free (error);
+ g_free (tmp);
+ g_clear_error (&error);
gtk_widget_destroy (dlg);
dlg = NULL;
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index 6120355..b1f9221 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -1004,7 +1004,6 @@ create_entry_widget (SingleEntry *sentry)
g_free (str);
g_object_ref_sink (sentry->label);
sentry->label_title = title;
- gtk_widget_set_halign (sentry->label, GTK_ALIGN_START);
gtk_widget_show (sentry->label);
g_object_get (G_OBJECT (param), "description", &title, NULL);
@@ -1050,7 +1049,6 @@ create_entry_widget (SingleEntry *sentry)
g_free (str);
g_object_ref_sink (sentry->label);
sentry->label_title = title;
- gtk_widget_set_halign (sentry->label, GTK_ALIGN_START);
gtk_widget_show (sentry->label);
ss = gda_set_group_get_source (gdaui_set_group_get_group (group));
title = g_object_get_data (G_OBJECT (gda_set_source_get_data_model (ss)), "descr");
@@ -1058,7 +1056,9 @@ create_entry_widget (SingleEntry *sentry)
gtk_widget_set_tooltip_text (sentry->label, title);
}
+ gtk_widget_set_halign (sentry->label, GTK_ALIGN_START);
gtk_widget_set_hexpand (sentry->label, FALSE);
+ g_object_set (G_OBJECT (sentry->label), "xalign", 0., NULL);
sentry->entry = GDAUI_DATA_ENTRY (entry);
g_object_ref_sink (sentry->entry);
gdaui_data_entry_set_editable (sentry->entry, editable);
@@ -1352,6 +1352,8 @@ load_xml_layout_column (GdauiBasicForm *form, xmlNodePtr box_node)
sentry->label = gtk_label_new ((gchar*) label);
g_object_ref_sink (sentry->label);
gtk_widget_set_halign (sentry->label, GTK_ALIGN_START);
+ gtk_widget_set_hexpand (sentry->label, FALSE);
+ g_object_set (G_OBJECT (sentry->label), "xalign", 0., NULL);
xmlFree (label);
}
@@ -1415,6 +1417,8 @@ load_xml_layout_section (GdauiBasicForm *form, xmlNodePtr section_node)
gtk_label_set_markup (GTK_LABEL (label), str);
g_free (str);
gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_hexpand (label, FALSE);
+ g_object_set (G_OBJECT (label), "xalign", 0., NULL);
GtkWidget *vbox;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -2166,6 +2170,8 @@ gdaui_basic_form_new_in_dialog (GdaSet *data_set, GtkWindow *parent,
label = gtk_label_new (NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_hexpand (label, FALSE);
+ g_object_set (G_OBJECT (label), "xalign", 0., NULL);
str = g_markup_printf_escaped ("<b>%s:</b>", header);
gtk_label_set_markup (GTK_LABEL (label), str);
g_free (str);
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index 8e0a3e3..ccf47cc 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -2132,7 +2132,7 @@ confirm_file_overwrite (GtkWindow *parent, const gchar *path)
GTK_DIALOG_DESTROY_WITH_PARENT |
GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
- "<span weight=\"bold\">%s</span>\n%s\n",
+ "<b>%s</b>\n%s",
msg,
_("If you choose yes, the contents will be lost."));
g_free (msg);
diff --git a/libgda-ui/gdaui-rt-editor.c b/libgda-ui/gdaui-rt-editor.c
index d4b63c0..aa1d8e6 100644
--- a/libgda-ui/gdaui-rt-editor.c
+++ b/libgda-ui/gdaui-rt-editor.c
@@ -724,13 +724,15 @@ add_image_cb (G_GNUC_UNUSED GtkAction *action, GdauiRtEditor *rte)
}
else {
GtkWidget *msg;
-
- msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel
((GtkWidget*) rte)),
- GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Could not load the contents of '%s':\n
%s"),
- filename,
- error && error->message ? error->message :
_("No detail"));
+ gchar *tmp;
+ tmp = g_strdup_printf (_("Could not load the contents of '%s'"), filename);
+ msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel (dlg)),
+ GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "<b>%s:</b>\n%s: %s",
+ _("Error"), tmp,
+ error && error->message ? error->message :
_("No detail"));
+ g_free (tmp);
g_clear_error (&error);
gtk_widget_destroy (dlg);
dlg = NULL;
diff --git a/libgda-ui/gdaui.css b/libgda-ui/gdaui.css
index ffbbc22..66ab1f9 100644
--- a/libgda-ui/gdaui.css
+++ b/libgda-ui/gdaui.css
@@ -22,18 +22,6 @@ GdauiCombo.gdaui-combo-normal {
-GtkComboBox-appears-as-list : false;
}
-GdauiCombo, GdauiCombo GtkButton, GdauiCombo GtkArrow, GdauiCombo GtkBox {
- -GtkArrow-arrow-scaling: 0.4;
- -GtkComboBox-arrow-size : 4;
- border-style: none;
- border-width: 0px;
- margin: 0px;
- padding: 0px;
- -GtkButton-default-border: 0px;
- -GtkButton-default-outside-border: 0px;
- -GtkButton-inner-border: 0px;
-}
-
GdauiDataProxyInfo * {
-GtkToolbar-shadow-type : none;
-GtkSpinButton-shadow-type : none;
diff --git a/libgda-ui/internal/gdaui-provider-spec-editor.c b/libgda-ui/internal/gdaui-provider-spec-editor.c
index f072351..0c2f582 100644
--- a/libgda-ui/internal/gdaui-provider-spec-editor.c
+++ b/libgda-ui/internal/gdaui-provider-spec-editor.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2015 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
*
diff --git a/libgda-ui/internal/utility.c b/libgda-ui/internal/utility.c
index adfb06d..aa5173b 100644
--- a/libgda-ui/internal/utility.c
+++ b/libgda-ui/internal/utility.c
@@ -394,7 +394,7 @@ create_data_error_dialog (GdauiDataProxy *form, gboolean with_question, gboolean
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
with_question ? GTK_BUTTONS_NONE : GTK_BUTTONS_CLOSE,
- "<b>%s:</b>\n\n%s", msg1, msg2);
+ "<b>%s:</b>\n%s", msg1, msg2);
if (filled_error && filled_error->message) {
GtkWidget *label;
@@ -478,14 +478,23 @@ _gdaui_utility_show_error (GtkWindow *parent, const gchar *format, ...)
vsnprintf (sz, sizeof sz, format, args);
va_end (args);
+ /* find a parent if none provided */
+ if (parent && !GTK_IS_WINDOW (parent))
+ parent = (GtkWindow*) gtk_widget_get_toplevel ((GtkWidget*) parent);
+
+ if (!parent) {
+ GApplication *app;
+ app = g_application_get_default ();
+ if (app && GTK_IS_APPLICATION (app))
+ parent = gtk_application_get_active_window (GTK_APPLICATION (app));
+ }
/* create the error message dialog */
- gchar *str;
- str = g_strdup_printf ("<span weight=\"bold\">%s</span>%s\n", _("Error:"), sz);
dialog = gtk_message_dialog_new_with_markup (parent,
- GTK_DIALOG_DESTROY_WITH_PARENT |
- GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE, "%s", str);
- g_free (str);
+ GTK_DIALOG_DESTROY_WITH_PARENT |
+ GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "<b>%s:</b>\n%s",
+ _("Error"), sz);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
gtk_button_new_with_label (_("Ok")),
GTK_RESPONSE_OK);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]