diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-08-07 19:58:52 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-08-07 20:06:22 -0300 |
commit | 3a5d198b9772038b66be0ac7252b27c2e0655254 (patch) | |
tree | ac354557f5a9a7c93fbdd16e939642373217262b | |
parent | e4b1d68311f34502a552fddca2c5ff1839600f16 (diff) | |
download | glade-3a5d198b9772038b66be0ac7252b27c2e0655254.tar.gz |
GladeProjectProperties: various UI improvements.
Port to use headerbar, stack and stach switcher.
Add warnings textview for deprecations warnigns.
-rw-r--r-- | gladeui/glade-private.h | 4 | ||||
-rw-r--r-- | gladeui/glade-project-properties.c | 75 | ||||
-rw-r--r-- | gladeui/glade-project-properties.ui | 310 | ||||
-rw-r--r-- | gladeui/glade-project.c | 84 |
4 files changed, 264 insertions, 209 deletions
diff --git a/gladeui/glade-private.h b/gladeui/glade-private.h index a190be04..016184c0 100644 --- a/gladeui/glade-private.h +++ b/gladeui/glade-private.h @@ -63,6 +63,10 @@ _glade_project_emit_activate_signal_handler (GladeWidget *widget, /* glade-project-properties.c */ void +_glade_project_properties_set_warnings (GladeProjectProperties *props, + const gchar *warnings); + +void _glade_project_properties_set_license_data (GladeProjectProperties *props, const gchar *license, const gchar *name, diff --git a/gladeui/glade-project-properties.c b/gladeui/glade-project-properties.c index 0c4a16e8..0906f5ca 100644 --- a/gladeui/glade-project-properties.c +++ b/gladeui/glade-project-properties.c @@ -77,6 +77,9 @@ static void on_license_comboboxtext_changed (GtkComboBox *widget, static void on_license_data_changed (GladeProjectProperties *properties); /* Project callbacks */ +static void project_path_changed (GladeProject *project, + GParamSpec *pspec, + GladeProjectProperties *properties); static void project_resource_path_changed (GladeProject *project, GParamSpec *pspec, GladeProjectProperties *properties); @@ -136,6 +139,7 @@ typedef struct GtkTextBuffer *authors_textbuffer; GtkTextBuffer *copyright_textbuffer; GtkTextBuffer *license_textbuffer; + GtkTextBuffer *warnings_textbuffer; gboolean ignore_ui_cb; } GladeProjectPropertiesPrivate; @@ -217,6 +221,7 @@ glade_project_properties_class_init (GladeProjectPropertiesClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GladeProjectProperties, authors_textbuffer); gtk_widget_class_bind_template_child_private (widget_class, GladeProjectProperties, copyright_textbuffer); gtk_widget_class_bind_template_child_private (widget_class, GladeProjectProperties, license_textbuffer); + gtk_widget_class_bind_template_child_private (widget_class, GladeProjectProperties, warnings_textbuffer); /* Declare the callback ports that this widget class exposes, to bind with <signal> @@ -486,6 +491,7 @@ glade_project_properties_set_project (GladeProjectProperties *properties, if (priv->project) { + PROJECT_DISCONNECT (project_path_changed); PROJECT_DISCONNECT (project_resource_path_changed); PROJECT_DISCONNECT (project_template_changed); PROJECT_DISCONNECT (project_domain_changed); @@ -503,6 +509,8 @@ glade_project_properties_set_project (GladeProjectProperties *properties, if (!priv->project) return; + g_signal_connect (priv->project, "notify::path", + G_CALLBACK (project_path_changed), properties); g_signal_connect (priv->project, "notify::resource-path", G_CALLBACK (project_resource_path_changed), properties); g_signal_connect (priv->project, "notify::template", @@ -525,6 +533,7 @@ glade_project_properties_set_project (GladeProjectProperties *properties, target_version_box_fill (properties); update_prefs_for_resource_path (properties); + project_path_changed (project, NULL, properties); project_template_changed (project, NULL, properties); project_domain_changed (project, NULL, properties); project_css_provider_path_changed (project, NULL, properties); @@ -726,12 +735,13 @@ verify_clicked (GtkWidget *button, GladeProjectProperties *properties) GLADE_VERIFY_DEPRECATIONS | GLADE_VERIFY_UNRECOGNIZED)) { - gchar *name = glade_project_get_name (priv->project); - glade_util_ui_message (glade_app_get_window (), - GLADE_UI_INFO, NULL, - _("Project %s has no deprecated widgets " + g_autofree gchar *name = NULL, *msg = NULL; + + name = glade_project_get_name (priv->project); + msg = g_strdup_printf (_("Project %s has no deprecated widgets " "or version mismatches."), name); - g_free (name); + + gtk_text_buffer_set_text (priv->warnings_textbuffer, msg, -1); } } @@ -1116,6 +1126,12 @@ project_targets_changed (GladeProject *project, gtk_combo_box_set_active_id(GTK_COMBO_BOX(combobox), id); } } + + glade_project_verify (priv->project, FALSE, + GLADE_VERIFY_VERSIONS | + GLADE_VERIFY_DEPRECATIONS | + GLADE_VERIFY_UNRECOGNIZED); + priv->ignore_ui_cb = FALSE; } @@ -1136,6 +1152,38 @@ project_domain_changed (GladeProject *project, } static void +project_path_changed (GladeProject *project, + GParamSpec *pspec, + GladeProjectProperties *properties) +{ + g_autofree gchar *name = NULL; + GtkHeaderBar *headerbar; + const gchar *path; + + if (!(headerbar = GTK_HEADER_BAR (gtk_dialog_get_header_bar (GTK_DIALOG (properties))))) + return; + + name = glade_project_get_name (project); + + gtk_header_bar_set_title (headerbar, name); + + if ((path = glade_project_get_path (project))) + { + g_autofree gchar *dirname = g_path_get_dirname (path); + const gchar *home = g_get_home_dir (); + + if (g_str_has_prefix (dirname, home)) + { + char *subtitle = &dirname[g_utf8_strlen (home, -1) - 1]; + subtitle[0] = '~'; + gtk_header_bar_set_subtitle (headerbar, subtitle); + } + else + gtk_header_bar_set_subtitle (headerbar, dirname); + } +} + +static void project_resource_path_changed (GladeProject *project, GParamSpec *pspec, GladeProjectProperties *properties) @@ -1216,6 +1264,18 @@ project_css_provider_path_changed (GladeProject *project, } /* Private API */ +void +_glade_project_properties_set_warnings (GladeProjectProperties *props, + const gchar *warnings) +{ + GladeProjectPropertiesPrivate *priv = GLADE_PROJECT_PROPERTIES_PRIVATE(props); + GtkTextIter iter; + + gtk_text_buffer_set_text (priv->warnings_textbuffer, "", -1); + gtk_text_buffer_get_start_iter (priv->warnings_textbuffer, &iter); + gtk_text_buffer_insert_markup (priv->warnings_textbuffer, &iter, + warnings ? warnings : "", -1); +} void _glade_project_properties_set_license_data (GladeProjectProperties *props, @@ -1275,5 +1335,8 @@ _glade_project_properties_get_license_data (GladeProjectProperties *props, GtkWidget * glade_project_properties_new (GladeProject *project) { - return g_object_new (GLADE_TYPE_PROJECT_PROPERTIES, "project", project, NULL); + return g_object_new (GLADE_TYPE_PROJECT_PROPERTIES, + "use-header-bar", TRUE, + "project", project, + NULL); } diff --git a/gladeui/glade-project-properties.ui b/gladeui/glade-project-properties.ui index f27bd925..af3fdae2 100644 --- a/gladeui/glade-project-properties.ui +++ b/gladeui/glade-project-properties.ui @@ -2,8 +2,8 @@ <!-- Generated with glade 3.37.0 libgladeui - Glade UI Designer core library -Copyright (C) 2013 Tristan Van Berkom <tvb@gnome.org> - 2013 Juan Pablo Ugarte <juanpablougarte@gmail.com> +Copyright (C) 2013 Tristan Van Berkom + 2013-2020 Juan Pablo Ugarte This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,17 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Authors: - Tristan Van Berkom <tvb@gnome.org> - Juan Pablo Ugarte <juanpablougarte@gmail.com> + Tristan Van Berkom <tvb@gnome.org> + Juan Pablo Ugarte <juanpablougarte@gmail.com> --> <interface domain="glade"> - <requires lib="gtk+" version="3.20"/> + <requires lib="gtk+" version="3.12"/> <!-- interface-license-type lgplv2 --> <!-- interface-name libgladeui --> <!-- interface-description Glade UI Designer core library --> - <!-- interface-copyright \t2013 Tristan Van Berkom <tvb@gnome.org>\n\t\t2013 Juan Pablo Ugarte <juanpablougarte@gmail.com> --> - <!-- interface-authors \tTristan Van Berkom <tvb@gnome.org>\n\tJuan Pablo Ugarte <juanpablougarte@gmail.com> --> + <!-- interface-copyright 2013 Tristan Van Berkom\n 2013-2020 Juan Pablo Ugarte --> + <!-- interface-authors Tristan Van Berkom <tvb@gnome.org>\n Juan Pablo Ugarte <juanpablougarte@gmail.com> --> <object class="GtkTextBuffer" id="authors_textbuffer"> <signal name="changed" handler="on_license_data_changed" swapped="yes"/> </object> @@ -46,6 +46,11 @@ Authors: </patterns> </object> <object class="GtkEntryBuffer" id="description_entrybuffer"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="icon-name">view-refresh-symbolic</property> + </object> <object class="GtkTextBuffer" id="license_textbuffer"/> <object class="GtkEntryBuffer" id="name_entrybuffer"/> <object class="GtkListStore" id="toplevels"> @@ -60,6 +65,7 @@ Authors: <column type="GObject"/> </columns> </object> + <object class="GtkTextBuffer" id="warnings_textbuffer"/> <template class="GladeProjectProperties" parent="GtkDialog"> <property name="can-focus">False</property> <property name="border-width">5</property> @@ -68,83 +74,67 @@ Authors: <signal name="hide" handler="on_glade_project_properties_hide" swapped="no"/> <signal name="response" handler="gtk_widget_hide" swapped="no"/> <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox1"> + <object class="GtkBox"> <property name="can-focus">False</property> <property name="orientation">vertical</property> - <property name="spacing">4</property> + <property name="spacing">6</property> <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> + <object class="GtkButtonBox"> <property name="can-focus">False</property> <property name="layout-style">end</property> <child> - <object class="GtkButton" id="verify_button"> - <property name="label" translatable="yes">_Verify</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">False</property> - <property name="tooltip-text" translatable="yes">Verify that the project does not use any properties, -signals or widgets which are not available in the target version</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="verify_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - <property name="secondary">True</property> - </packing> - </child> - <child> - <object class="GtkButton" id="close_button"> - <property name="label">_Close</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="use-underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> + <placeholder/> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="pack-type">end</property> - <property name="position">6</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkStackSwitcher" id="switcher"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">center</property> + <property name="stack">stack</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkNotebook" id="notebook"> + <object class="GtkStack" id="stack"> <property name="visible">True</property> - <property name="can-focus">True</property> + <property name="can-focus">False</property> + <property name="transition-type">crossfade</property> <child> - <object class="GtkBox" id="box1"> + <object class="GtkBox"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="border-width">5</property> <property name="orientation">vertical</property> - <property name="spacing">6</property> + <property name="spacing">12</property> <child> - <object class="GtkFrame" id="frame1"> + <object class="GtkFrame"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=3 n-rows=3 --> - <object class="GtkGrid" id="grid2"> + <!-- n-columns=2 n-rows=3 --> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="margin-start">12</property> - <property name="margin-top">6</property> <property name="row-spacing">4</property> <property name="column-spacing">4</property> <property name="row-homogeneous">True</property> <child> - <object class="GtkLabel" id="label1"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="halign">start</property> @@ -179,13 +169,13 @@ signals or widgets which are not available in the target version</property> <property name="id-column">2</property> <signal name="changed" handler="on_template_combo_box_changed" swapped="no"/> <child> - <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/> + <object class="GtkCellRendererPixbuf"/> <attributes> <attribute name="icon-name">0</attribute> </attributes> </child> <child> - <object class="GtkCellRendererText" id="cellrenderertext2"/> + <object class="GtkCellRendererText"/> <attributes> <attribute name="text">1</attribute> </attributes> @@ -239,15 +229,6 @@ signals or widgets which are not available in the target version</property> <property name="top-attach">2</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> </child> <child type="label_item"> @@ -261,14 +242,14 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkFrame" id="frame2"> + <object class="GtkFrame"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=3 n-rows=3 --> - <object class="GtkGrid" id="grid1"> + <!-- n-columns=2 n-rows=3 --> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="margin-start">12</property> @@ -354,19 +335,10 @@ signals or widgets which are not available in the target version</property> <property name="top-attach">1</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> </child> <child type="label"> - <object class="GtkLabel" id="label2"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">Image resources are loaded locally:</property> @@ -383,13 +355,13 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkFrame" id="frame3"> + <object class="GtkFrame"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=3 n-rows=3 --> + <!-- n-columns=3 n-rows=1 --> <object class="GtkGrid" id="toolkit_grid"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -406,31 +378,107 @@ signals or widgets which are not available in the target version</property> <child> <placeholder/> </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Toolkit version required:</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">12</property> + <property name="margin-top">6</property> + <property name="orientation">vertical</property> + <property name="spacing">4</property> <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="shadow-type">in</property> + <property name="min-content-height">128</property> + <child> + <object class="GtkTextView"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="wrap-mode">word</property> + <property name="buffer">warnings_textbuffer</property> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="spacing">4</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Verify objects, properties and signals deprecations</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="verify_button"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="image">image1</property> + <property name="always-show-image">True</property> + <signal name="clicked" handler="verify_clicked" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> </child> </object> </child> <child type="label"> - <object class="GtkLabel" id="label3"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes">Toolkit version required:</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Warnings:</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -438,29 +486,19 @@ signals or widgets which are not available in the target version</property> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> - </child> - <child type="tab"> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Properties</property> - <property name="use-markup">True</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> <packing> - <property name="tab-fill">False</property> + <property name="name">page0</property> + <property name="title" translatable="yes">Properties</property> </packing> </child> <child> - <object class="GtkBox" id="box3"> + <object class="GtkBox"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="margin-start">12</property> @@ -470,14 +508,14 @@ signals or widgets which are not available in the target version</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <!-- n-columns=3 n-rows=5 --> - <object class="GtkGrid" id="grid3"> + <!-- n-columns=2 n-rows=5 --> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="row-spacing">6</property> <property name="column-spacing">6</property> <child> - <object class="GtkLabel" id="label7"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">Name:</property> @@ -489,7 +527,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkLabel" id="label8"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">Copyright:</property> @@ -515,7 +553,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkLabel" id="label9"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">Author(s):</property> @@ -527,7 +565,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkLabel" id="label6"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">License:</property> @@ -539,7 +577,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow2"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="shadow-type">in</property> @@ -557,7 +595,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow3"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="shadow-type">in</property> @@ -575,7 +613,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkLabel" id="label10"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="label" translatable="yes">Description:</property> @@ -625,21 +663,6 @@ signals or widgets which are not available in the target version</property> <property name="top-attach">4</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="expand">False</property> @@ -648,7 +671,7 @@ signals or widgets which are not available in the target version</property> </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> @@ -673,34 +696,19 @@ signals or widgets which are not available in the target version</property> </child> </object> <packing> + <property name="name">page1</property> + <property name="title" translatable="yes">License</property> <property name="position">1</property> </packing> </child> - <child type="tab"> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">License</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="position">1</property> - <property name="tab-fill">False</property> - </packing> - </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">2</property> </packing> </child> </object> </child> - <action-widgets> - <action-widget response="-3">close_button</action-widget> - </action-widgets> </template> </interface> diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c index 7970d7ff..b6045009 100644 --- a/gladeui/glade-project.c +++ b/gladeui/glade-project.c @@ -2201,36 +2201,16 @@ glade_project_load_internal (GladeProject *project) } -static void -glade_project_update_properties_title (GladeProject *project) -{ - gchar *name, *title; - - /* Update prefs dialogs here... */ - name = glade_project_get_name (project); - title = g_strdup_printf (_("%s document properties"), name); - - if (project->priv->prefs_dialog) - gtk_window_set_title (GTK_WINDOW (project->priv->prefs_dialog), title); - g_free (title); - g_free (name); -} - gboolean glade_project_load_from_file (GladeProject *project, const gchar *path) { - gboolean retval; - g_return_val_if_fail (path != NULL, FALSE); g_return_val_if_fail (GLADE_IS_PROJECT (project), FALSE); project->priv->path = glade_util_canonical_path (path); g_object_notify_by_pspec (G_OBJECT (project), glade_project_props[PROP_PATH]); - if ((retval = glade_project_load_internal (project))) - glade_project_update_properties_title (project); - - return retval; + return glade_project_load_internal (project); } /** @@ -2254,15 +2234,10 @@ glade_project_load (const gchar *path) project->priv->path = glade_util_canonical_path (path); if (glade_project_load_internal (project)) - { - glade_project_update_properties_title (project); - return project; - } - else - { - g_object_unref (project); - return NULL; - } + return project; + + g_object_unref (project); + return NULL; } /******************************************************************* @@ -2948,8 +2923,6 @@ glade_project_save_verify (GladeProject *project, g_strdup (canonical_path)); g_object_notify_by_pspec (G_OBJECT (project), glade_project_props[PROP_PATH]); - glade_project_update_properties_title (project); - /* Sync selected objects pixbuf properties */ sync_project_resource_path (project); } @@ -3080,12 +3053,12 @@ glade_project_writing_preview (GladeProject *project) "while project targets %s %d.%d") /* translators: refers to a widget '[%s]' introduced in toolkit version '%s %d.%d' */ -#define WIDGET_VERSION_CONFLICT_FMT _("[%s] Object class '<b>%s</b>' was introduced in %s %d.%d\n") +#define WIDGET_VERSION_CONFLICT_FMT _("[%s]\n\tObject class '<b>%s</b>' was introduced in %s %d.%d\n") #define WIDGET_DEPRECATED_MSG _("This widget is deprecated") /* translators: refers to a widget '[%s]' loaded from toolkit version '%s %d.%d' */ -#define WIDGET_DEPRECATED_FMT _("[%s] Object class '<b>%s</b>' from %s %d.%d is deprecated\n") +#define WIDGET_DEPRECATED_FMT _("[%s]\n\tObject class '<b>%s</b>' from %s %d.%d is deprecated\n") /* translators: refers to a property in toolkit version '%s %d.%d' @@ -3094,17 +3067,17 @@ glade_project_writing_preview (GladeProject *project) "while project targets %s %d.%d") /* translators: refers to a property '%s' of widget '[%s]' in toolkit version '%s %d.%d' */ -#define PROP_VERSION_CONFLICT_FMT _("[%s] Property '<b>%s</b>' of object class '<b>%s</b>' " \ +#define PROP_VERSION_CONFLICT_FMT _("[%s]\n\tProperty '<b>%s</b>' of object class '<b>%s</b>' " \ "was introduced in %s %d.%d\n") /* translators: refers to a property '%s' of widget '[%s]' in toolkit version '%s %d.%d' */ -#define PACK_PROP_VERSION_CONFLICT_FMT _("[%s] Packing property '<b>%s</b>' of object class '<b>%s</b>' " \ +#define PACK_PROP_VERSION_CONFLICT_FMT _("[%s]\n\tPacking property '<b>%s</b>' of object class '<b>%s</b>' " \ "was introduced in %s %d.%d\n") #define PROP_DEPRECATED_MSG _("This property is deprecated") /* translators: refers to a property '%s' of widget '[%s]' */ -#define PROP_DEPRECATED_FMT _("[%s] Property '<b>%s</b>' of object class '<b>%s</b>' is deprecated\n") +#define PROP_DEPRECATED_FMT _("[%s]\n\tProperty '<b>%s</b>' of object class '<b>%s</b>' is deprecated\n") /* translators: refers to a signal in toolkit version '%s %d.%d' * and a project targeting toolkit version '%s %d.%d' */ @@ -3112,13 +3085,13 @@ glade_project_writing_preview (GladeProject *project) "while project targets %s %d.%d") /* translators: refers to a signal '%s' of widget '[%s]' in toolkit version '%s %d.%d' */ -#define SIGNAL_VERSION_CONFLICT_FMT _("[%s] Signal '<b>%s</b>' of object class '<b>%s</b>' " \ +#define SIGNAL_VERSION_CONFLICT_FMT _("[%s]\n\tSignal '<b>%s</b>' of object class '<b>%s</b>' " \ "was introduced in %s %d.%d\n") #define SIGNAL_DEPRECATED_MSG _("This signal is deprecated") /* translators: refers to a signal '%s' of widget '[%s]' */ -#define SIGNAL_DEPRECATED_FMT _("[%s] Signal '<b>%s</b>' of object class '<b>%s</b>' is deprecated\n") +#define SIGNAL_DEPRECATED_FMT _("[%s]\n\tSignal '<b>%s</b>' of object class '<b>%s</b>' is deprecated\n") static void @@ -3400,9 +3373,7 @@ glade_project_verify_properties (GladeWidget *widget) } static gboolean -glade_project_verify_dialog (GladeProject *project, - GString *string, - gboolean saving) +glade_project_verify_dialog (GladeProject *project, GString *string) { GtkWidget *swindow; GtkWidget *textview; @@ -3429,12 +3400,10 @@ glade_project_verify_dialog (GladeProject *project, name = glade_project_get_name (project); ret = glade_util_ui_message (glade_app_get_window (), - saving ? GLADE_UI_YES_OR_NO : GLADE_UI_INFO, + GLADE_UI_YES_OR_NO, expander, - saving ? - _("Project \"%s\" has errors. Save anyway?") : - _("Project \"%s\" has deprecated widgets " - "and/or version mismatches."), name); + _("Project \"%s\" has errors. Save anyway?"), + name); g_free (name); return ret; @@ -3446,6 +3415,7 @@ glade_project_verify (GladeProject *project, gboolean saving, GladeVerifyFlags flags) { + GladeProjectPrivate *priv = project->priv; GString *string = g_string_new (NULL); GList *list; gboolean ret = TRUE; @@ -3458,7 +3428,7 @@ glade_project_verify (GladeProject *project, glade_project_get_target_version (project, "gtk+", &major, &minor); if (major == 3 && minor < 10) - g_string_append_printf (string, _("Object %s is a class template but this is not supported in gtk+ %d.%d"), + g_string_append_printf (string, _("Object %s is a class template but this is not supported in gtk+ %d.%d\n"), glade_widget_get_name (project->priv->template), major, minor); } @@ -3490,11 +3460,15 @@ glade_project_verify (GladeProject *project, } } + /* Update project warnings */ + _glade_project_properties_set_warnings (GLADE_PROJECT_PROPERTIES (priv->prefs_dialog), + string->str); + if (string->len > 0) { - ret = glade_project_verify_dialog (project, string, saving); - - if (!saving) + if (saving) + ret = glade_project_verify_dialog (project, string); + else ret = FALSE; } @@ -5022,7 +4996,13 @@ glade_project_properties (GladeProject *project) g_return_if_fail (GLADE_IS_PROJECT (project)); if (project->priv->prefs_dialog) - gtk_window_present (GTK_WINDOW (project->priv->prefs_dialog)); + { + glade_project_verify (project, FALSE, + GLADE_VERIFY_VERSIONS | + GLADE_VERIFY_DEPRECATIONS | + GLADE_VERIFY_UNRECOGNIZED); + gtk_window_present (GTK_WINDOW (project->priv->prefs_dialog)); + } } gchar * |