summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2017-08-07 21:55:01 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2017-12-30 13:42:16 -0300
commit91072843db6c1fd2bfdbd26e4ac5ac58de4567b2 (patch)
treed43b5c7beba190218b85d893de7dbb40eb479626
parent50579829df4bf0a1c0153d135e60b6d431875981 (diff)
downloadglade-91072843db6c1fd2bfdbd26e4ac5ac58de4567b2.tar.gz
GladeWindow: move all project actions to headerbar
- Use GtkStackSwitcher in headerbar to change project - Undo/Redo right click to activate command menu
-rw-r--r--src/glade-window.c249
-rw-r--r--src/glade.glade382
2 files changed, 245 insertions, 386 deletions
diff --git a/src/glade-window.c b/src/glade-window.c
index 9bc96731..1e9fe320 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -81,13 +81,10 @@ struct _GladeWindowPrivate
GtkStack *view_stack;
GtkHeaderBar *headerbar;
+ GtkWidget *project_switcher ;
GtkWindow *about_dialog;
GladePreferences *preferences;
- GtkLabel *title;
- GtkLabel *subtitle;
- GtkWidget *project_button;
-
GtkWidget *start_page;
GtkLabel *version_label;
@@ -119,8 +116,8 @@ struct _GladeWindowPrivate
gchar *default_path; /* the default path for open/save operations */
- GtkMenuButton *undo_menu_button; /* customized buttons for undo/redo with history */
- GtkMenuButton *redo_menu_button;
+ GtkMenuButton *undo_button; /* undo/redo button, right click for history */
+ GtkMenuButton *redo_button;
GtkWidget *toolbar; /* Actions are added to the toolbar */
gint actions_start; /* start of action items */
@@ -128,6 +125,7 @@ struct _GladeWindowPrivate
GtkWidget *center_paned;
GtkWidget *left_paned;
GtkWidget *open_button_box; /* gtk_button_box_set_layout() set homogeneous to TRUE, and we do not want that in this case */
+ GtkWidget *save_button_box;
GtkWidget *registration; /* Registration and user survey dialog */
@@ -138,56 +136,6 @@ static void check_reload_project (GladeWindow *window, GladeProject *project);
G_DEFINE_TYPE_WITH_PRIVATE (GladeWindow, glade_window, GTK_TYPE_WINDOW)
-/* the following functions are taken from gedit-utils.c */
-static gchar *
-str_middle_truncate (const gchar *string, guint truncate_length)
-{
- GString *truncated;
- guint length;
- guint n_chars;
- guint num_left_chars;
- guint right_offset;
- guint delimiter_length;
- const gchar *delimiter = "\342\200\246";
-
- g_return_val_if_fail (string != NULL, NULL);
-
- length = strlen (string);
-
- g_return_val_if_fail (g_utf8_validate (string, length, NULL), NULL);
-
- /* It doesnt make sense to truncate strings to less than
- * the size of the delimiter plus 2 characters (one on each
- * side)
- */
- delimiter_length = g_utf8_strlen (delimiter, -1);
- if (truncate_length < (delimiter_length + 2))
- {
- return g_strdup (string);
- }
-
- n_chars = g_utf8_strlen (string, length);
-
- /* Make sure the string is not already small enough. */
- if (n_chars <= truncate_length)
- {
- return g_strdup (string);
- }
-
- /* Find the 'middle' where the truncation will occur. */
- num_left_chars = (truncate_length - delimiter_length) / 2;
- right_offset = n_chars - truncate_length + num_left_chars + delimiter_length;
-
- truncated = g_string_new_len (string,
- g_utf8_offset_to_pointer (string,
- num_left_chars) -
- string);
- g_string_append (truncated, delimiter);
- g_string_append (truncated, g_utf8_offset_to_pointer (string, right_offset));
-
- return g_string_free (truncated, FALSE);
-}
-
/*
* Doubles underscore to avoid spurious menu accels - taken from gedit-utils.c
*/
@@ -229,104 +177,66 @@ escape_underscores (const gchar *text, gssize length)
return g_string_free (str, FALSE);
}
-typedef enum
-{
- FORMAT_NAME_MARK_UNSAVED = 1 << 0,
- FORMAT_NAME_ESCAPE_UNDERSCORES = 1 << 1,
- FORMAT_NAME_MIDDLE_TRUNCATE = 1 << 2
-} FormatNameFlags;
-
-#define MAX_TITLE_LENGTH 100
-
-static gchar *
-get_formatted_project_name_for_display (GladeProject *project,
- FormatNameFlags format_flags)
-{
- gchar *name, *pass1, *pass2, *pass3;
-
- g_return_val_if_fail (project != NULL, NULL);
-
- name = glade_project_get_name (project);
-
- if ((format_flags & FORMAT_NAME_MARK_UNSAVED)
- && glade_project_get_modified (project))
- pass1 = g_strdup_printf ("*%s", name);
- else
- pass1 = g_strdup (name);
-
- if (format_flags & FORMAT_NAME_ESCAPE_UNDERSCORES)
- pass2 = escape_underscores (pass1, -1);
- else
- pass2 = g_strdup (pass1);
-
- if (format_flags & FORMAT_NAME_MIDDLE_TRUNCATE)
- pass3 = str_middle_truncate (pass2, MAX_TITLE_LENGTH);
- else
- pass3 = g_strdup (pass2);
-
- g_free (name);
- g_free (pass1);
- g_free (pass2);
-
- return pass3;
-}
-
static void
refresh_title (GladeWindow *window)
{
- GladeProject *project = NULL;
- gchar *title, *name = NULL;
- const gchar *path;
-
if (GLADE_WINDOW_ACTIVE_VIEW (window))
{
- project = glade_design_view_get_project (GLADE_WINDOW_ACTIVE_VIEW (window));
+ GladeProject *project = glade_design_view_get_project (GLADE_WINDOW_ACTIVE_VIEW (window));
+ gchar *title, *name = NULL;
+ GList *p;
+
+ gtk_header_bar_set_custom_title (window->priv->headerbar, NULL);
- name = get_formatted_project_name_for_display (project,
- FORMAT_NAME_MARK_UNSAVED |
- FORMAT_NAME_MIDDLE_TRUNCATE);
+ name = glade_project_get_name (project);
+
+ if (glade_project_get_modified (project))
+ name = g_strdup_printf ("*%s", name);
+ else
+ name = g_strdup (name);
if (glade_project_get_readonly (project) != FALSE)
title = g_strdup_printf ("%s %s", name, READONLY_INDICATOR);
else
title = g_strdup_printf ("%s", name);
+ gtk_header_bar_set_title (window->priv->headerbar, title);
+ g_free (title);
g_free (name);
- }
- else
- title = g_strdup (_("User Interface Designer"));
-
- gtk_label_set_label (window->priv->title, title);
- /* Show path */
- if (project && (path = glade_project_get_path (project)))
- {
- 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_label_set_label (window->priv->subtitle, subtitle);
- }
+ if ((p = glade_app_get_projects ()) && g_list_next (p))
+ gtk_header_bar_set_custom_title (window->priv->headerbar, window->priv->project_switcher);
else
- gtk_label_set_label (window->priv->subtitle, dirname);
+ {
+ const gchar *path;
- gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->project_button),
- "glade-tight-fit");
- gtk_widget_show (GTK_WIDGET (window->priv->subtitle));
- g_free (dirname);
+ /* Show path */
+ if (project && (path = glade_project_get_path (project)))
+ {
+ 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 (window->priv->headerbar, subtitle);
+ }
+ else
+ gtk_header_bar_set_subtitle (window->priv->headerbar, dirname);
+
+ g_free (dirname);
+ }
+ else
+ gtk_header_bar_set_subtitle (window->priv->headerbar, NULL);
+ }
}
else
{
- gtk_style_context_remove_class (gtk_widget_get_style_context (window->priv->project_button),
- "glade-tight-fit");
- gtk_label_set_label (window->priv->subtitle, NULL);
- gtk_widget_hide (GTK_WIDGET (window->priv->subtitle));
+ gtk_header_bar_set_custom_title (window->priv->headerbar, NULL);
+ gtk_header_bar_set_title (window->priv->headerbar, _("User Interface Designer"));
+ gtk_header_bar_set_subtitle (window->priv->headerbar, NULL);
}
-
- g_free (title);
}
static const gchar *
@@ -510,11 +420,21 @@ refresh_stack_title_for_project (GladeWindow *window, GladeProject *project)
if (project == glade_design_view_get_project (GLADE_DESIGN_VIEW (view)))
{
- gchar *str = get_formatted_project_name_for_display (project,
- FORMAT_NAME_MARK_UNSAVED |
- FORMAT_NAME_MIDDLE_TRUNCATE);
+ gchar *name = glade_project_get_name (project);
+ gchar *str;
+
+ /* remove extension */
+ if ((str = g_utf8_strrchr (name, -1, '.')))
+ *str = '\0';
+
+ if (glade_project_get_modified (project))
+ str = g_strdup_printf ("*%s", name);
+ else
+ str = g_strdup (name);
+
gtk_container_child_set (GTK_CONTAINER (window->priv->view_stack), view,
"title", str, NULL);
+ g_free (name);
g_free (str);
break;
@@ -586,12 +506,6 @@ refresh_undo_redo (GladeWindow *window, GladeProject *project)
redo ? glade_command_description (redo) : _("the last action"));
g_object_set (priv->redo_action, "tooltip", tooltip, NULL);
g_free (tooltip);
-
- /* Refresh menus */
- gtk_menu_button_set_popup (priv->undo_menu_button,
- glade_project_undo_items (project));
- gtk_menu_button_set_popup (priv->redo_menu_button,
- glade_project_redo_items (project));
}
static void
@@ -1522,8 +1436,6 @@ on_stack_visible_child_notify (GObject *gobject,
on_pointer_mode_changed (project, NULL, window);
}
-
- refresh_title (window);
}
static void
@@ -1826,7 +1738,6 @@ add_project (GladeWindow *window, GladeProject *project, gboolean for_file)
gtk_widget_show (inspector);
set_sensitivity_according_to_project (window, project);
- refresh_title (window);
gtk_action_group_set_sensitive (priv->project_actiongroup, TRUE);
@@ -1834,13 +1745,13 @@ add_project (GladeWindow *window, GladeProject *project, gboolean for_file)
glade_app_add_project (project);
g_object_unref (project);
-
/* Add view to stack */
gtk_container_add (GTK_CONTAINER (priv->view_stack), view);
gtk_widget_show (view);
gtk_stack_set_visible_child (priv->view_stack, view);
refresh_stack_title_for_project (window, project);
+ refresh_title (window);
}
static void
@@ -1850,6 +1761,38 @@ on_registration_action_activate (GtkAction *action,
gtk_window_present (GTK_WINDOW (window->priv->registration));
}
+static gboolean
+on_undo_button_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ GladeWindow *window)
+{
+ GladeProject *project = get_active_project (window);
+
+ if (project && event->button.button == 3)
+ gtk_menu_popup_at_widget (GTK_MENU (glade_project_undo_items (project)),
+ widget,
+ GDK_GRAVITY_NORTH_WEST,
+ GDK_GRAVITY_SOUTH_WEST,
+ event);
+ return FALSE;
+}
+
+static gboolean
+on_redo_button_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ GladeWindow *window)
+{
+ GladeProject *project = get_active_project (window);
+
+ if (project && event->button.button == 3)
+ gtk_menu_popup_at_widget (GTK_MENU (glade_project_redo_items (project)),
+ widget,
+ GDK_GRAVITY_NORTH_WEST,
+ GDK_GRAVITY_SOUTH_WEST,
+ event);
+ return FALSE;
+}
+
void
glade_window_new_project (GladeWindow *window)
{
@@ -2304,6 +2247,7 @@ glade_window_init (GladeWindow *window)
gtk_widget_init_template (GTK_WIDGET (window));
gtk_box_set_homogeneous (GTK_BOX (priv->open_button_box), FALSE);
+ gtk_box_set_homogeneous (GTK_BOX (priv->save_button_box), FALSE);
priv->registration = glade_registration_new ();
}
@@ -2422,23 +2366,22 @@ glade_window_class_init (GladeWindowClass *klass)
/* Internal children */
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, adaptor_chooser);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, headerbar);
- gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, title);
- gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, subtitle);
- gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, project_button);
+ gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, project_switcher);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, about_dialog);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, start_page);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, version_label);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, center_paned);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, left_paned);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, open_button_box);
+ gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, save_button_box);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, stack);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, view_stack);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, inspectors_stack);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, editor);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, statusbar);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, toolbar);
- gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, undo_menu_button);
- gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, redo_menu_button);
+ gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, undo_button);
+ gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, redo_button);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, accelgroup);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, project_actiongroup);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, pointer_mode_actiongroup);
@@ -2476,6 +2419,8 @@ glade_window_class_init (GladeWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_reference_action_activate);
gtk_widget_class_bind_template_callback (widget_class, on_preferences_action_activate);
gtk_widget_class_bind_template_callback (widget_class, on_registration_action_activate);
+ gtk_widget_class_bind_template_callback (widget_class, on_undo_button_button_press_event);
+ gtk_widget_class_bind_template_callback (widget_class, on_redo_button_button_press_event);
gtk_widget_class_bind_template_callback (widget_class, on_open_recent_action_item_activated);
gtk_widget_class_bind_template_callback (widget_class, on_selector_radioaction_changed);
diff --git a/src/glade.glade b/src/glade.glade
index d9772ddf..d41ec383 100644
--- a/src/glade.glade
+++ b/src/glade.glade
@@ -177,7 +177,7 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
</child>
<child>
<object class="GtkAction" id="close_action">
- <property name="label" translatable="yes">Close</property>
+ <property name="label" translatable="yes">Close project</property>
<property name="tooltip" translatable="yes">Close the current project</property>
<property name="icon_name">window-close</property>
<signal name="activate" handler="on_close_action_activate" swapped="no"/>
@@ -342,66 +342,125 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
</object>
</child>
</object>
- <object class="GtkMenu" id="main_menu">
- <property name="visible">True</property>
+ <object class="GtkPopoverMenu" id="main_menu">
<property name="can_focus">False</property>
- <property name="accel_group">accelgroup</property>
- <property name="menu_type_hint">dropdown-menu</property>
- <child>
- <object class="GtkMenuItem" id="registration_menuitem">
- <property name="use_action_appearance">True</property>
- <property name="related_action">registration_action</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Registration &amp; User Survey</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="reference_menuitem">
- <property name="use_action_appearance">True</property>
- <property name="related_action">reference_action</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="preferences_menuitem">
- <property name="use_action_appearance">True</property>
- <property name="related_action">preferences_action</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
<child>
- <object class="GtkSeparatorMenuItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="about_menuitem">
- <property name="use_action_appearance">True</property>
- <property name="related_action">about_action</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="quit_menuitem">
- <property name="use_action_appearance">True</property>
- <property name="related_action">quit_action</property>
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
+ <property name="border_width">4</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkModelButton">
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">close_action</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">registration_action</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">reference_action</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">preferences_action</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">about_action</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">quit_action</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="submenu">main</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<object class="GtkRecentChooserMenu" id="recent_menu">
@@ -781,12 +840,13 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
<property name="can_focus">False</property>
<property name="layout_style">expand</property>
<child>
- <object class="GtkButton">
+ <object class="GtkButton" id="undo_button">
<property name="use_action_appearance">False</property>
<property name="related_action">undo_action</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <signal name="button-press-event" handler="on_undo_button_button_press_event" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
@@ -802,43 +862,14 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
</packing>
</child>
<child>
- <object class="GtkMenuButton" id="undo_menu_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_popover">False</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">pan-down-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkButtonBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">True</property>
- <property name="layout_style">expand</property>
- <child>
- <object class="GtkButton">
+ <object class="GtkButton" id="redo_button">
<property name="use_action_appearance">False</property>
<property name="related_action">redo_action</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="button-press-event" handler="on_redo_button_button_press_event" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
@@ -850,82 +881,19 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="redo_menu_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_popover">False</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">pan-down-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="position">6</property>
+ <property name="position">5</property>
</packing>
</child>
<child type="title">
- <object class="GtkMenuButton" id="project_button">
+ <object class="GtkStackSwitcher" id="project_switcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="receives_default">True</property>
- <property name="valign">center</property>
- <property name="use_popover">False</property>
- <property name="popover">project_popover</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel" id="title">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <style>
- <class name="title"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="subtitle">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <style>
- <class name="subtitle"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <style>
- <class name="titlebutton"/>
- <class name="glade-tight-fit"/>
- </style>
+ <property name="stack">view_stack</property>
</object>
</child>
<child>
@@ -933,7 +901,7 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="popup">main_menu</property>
+ <property name="popover">main_menu</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
@@ -944,62 +912,46 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
</object>
<packing>
<property name="pack_type">end</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
- <property name="label" translatable="yes">button</property>
- <property name="use_action_appearance">True</property>
- <property name="related_action">save_action</property>
+ <property name="use_action_appearance">False</property>
+ <property name="related_action">properties_action</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Save the current project</property>
+ <property name="tooltip_text" translatable="yes">Edit project properties</property>
+ <property name="use_underline">True</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">document-properties-symbolic</property>
+ </object>
+ </child>
</object>
<packing>
<property name="pack_type">end</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
- </object>
- </child>
- </template>
- <object class="GtkPopover" id="project_popover">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">2</property>
- <property name="margin_right">2</property>
- <property name="margin_top">2</property>
- <property name="margin_bottom">2</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkButtonBox">
+ <object class="GtkButtonBox" id="save_button_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="homogeneous">True</property>
<property name="layout_style">expand</property>
<child>
<object class="GtkButton">
- <property name="use_action_appearance">False</property>
- <property name="related_action">save_as_action</property>
+ <property name="label" translatable="yes">Save</property>
+ <property name="use_action_appearance">True</property>
+ <property name="related_action">save_action</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Save the current project with a different name</property>
+ <property name="tooltip_text" translatable="yes">Save the current project</property>
<property name="use_underline">True</property>
- <property name="always_show_image">True</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">document-save-as-symbolic</property>
- </object>
- </child>
</object>
<packing>
<property name="expand">True</property>
@@ -1010,18 +962,17 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
<child>
<object class="GtkButton">
<property name="use_action_appearance">False</property>
- <property name="related_action">properties_action</property>
+ <property name="related_action">save_as_action</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Edit project properties</property>
+ <property name="tooltip_text" translatable="yes">Save the current project with a different name</property>
<property name="use_underline">True</property>
- <property name="always_show_image">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">document-properties-symbolic</property>
+ <property name="icon_name">document-save-as-symbolic</property>
</object>
</child>
</object>
@@ -1031,50 +982,13 @@ Andreas Nilsson &lt;andreas@andreasn.se&gt;</property>
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkButton">
- <property name="use_action_appearance">False</property>
- <property name="related_action">close_action</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Close the current project</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">window-close-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkStackSwitcher">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="stack">view_stack</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="pack_type">end</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
</child>
- </object>
+ </template>
</interface>