Commit b67b2074 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

reorganized the header bar buttons and sections

parent 9ff54c10
......@@ -52,8 +52,12 @@ static const GthMenuEntry fixed_menu_entries[] = {
};
static const GthMenuEntry file_list_popup_entries[] = {
static const GthMenuEntry vfs_open_actions_entries[] = {
{ N_("Open Folder"), "win.go-to-container-from-catalog", "<Alt>end" },
};
static const GthMenuEntry vfs_other_actions_entries[] = {
{ N_("Remove from Catalog"), "win.remove-from-catalog" },
};
......@@ -70,7 +74,8 @@ static const GthMenuEntry folder_popup_entries[] = {
typedef struct {
GthBrowser *browser;
guint folder_popup_merge_id;
guint vfs_merge_id;
guint vfs_open_actions_merge_id;
guint vfs_other_actions_merge_id;
gboolean catalog_menu_loaded;
guint n_top_catalogs;
guint monitor_events;
......@@ -274,15 +279,23 @@ catalogs__gth_browser_load_location_after_cb (GthBrowser *browser,
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
if (GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source (browser))) {
if (data->vfs_merge_id == 0)
data->vfs_merge_id =
if (data->vfs_open_actions_merge_id == 0)
data->vfs_open_actions_merge_id =
gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS),
vfs_open_actions_entries,
G_N_ELEMENTS (vfs_open_actions_entries));
if (data->vfs_other_actions_merge_id == 0)
data->vfs_other_actions_merge_id =
gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS),
file_list_popup_entries,
G_N_ELEMENTS (file_list_popup_entries));
vfs_other_actions_entries,
G_N_ELEMENTS (vfs_other_actions_entries));
}
else {
gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS), data->vfs_merge_id);
data->vfs_merge_id = 0;
gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS), data->vfs_open_actions_merge_id);
data->vfs_open_actions_merge_id = 0;
gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS), data->vfs_other_actions_merge_id);
data->vfs_other_actions_merge_id = 0;
}
}
......
......@@ -60,18 +60,6 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
action_entries,
G_N_ELEMENTS (action_entries));
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
"comment-symbolic",
_("Comment"),
"win.edit-metadata",
NULL);
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
"tag-symbolic",
_("Tags"),
"win.edit-tags",
NULL);
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
"comment-symbolic",
......
......@@ -711,7 +711,7 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
browser);
self->priv->screenshot_button =
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
"camera-photo-symbolic",
_("Take a screenshot"),
"win.video-screenshot",
......
......@@ -42,8 +42,8 @@ static const GActionEntry actions[] = {
static const GthMenuEntry tools1_action_entries[] = {
{ N_("Rotate Right"), "win.rotate-right", "bracketright", "object-rotate-right-symbolic" },
{ N_("Rotate Left"), "win.rotate-left", "bracketleft", "object-rotate-left-symbolic" },
{ N_("Rotate Right"), "win.rotate-right", "bracketright", "object-rotate-right-symbolic" },
};
......
......@@ -4,9 +4,8 @@
<menu id="tools-menu">
<section id="tools1">
</section>
<submenu id="tools2">
<attribute name="label" translatable="yes">More</attribute>
</submenu>
<section id="tools2">
</section>
<section id="tools3">
</section>
<section>
......
......@@ -48,7 +48,7 @@ ss__gth_browser_construct_cb (GthBrowser *browser)
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW,
"view-presentation-symbolic",
_("View as a slideshow"),
_("Presentation"),
"win.slideshow",
"F5");
}
......
......@@ -67,6 +67,10 @@ static const GthAccelerator gth_browser_accelerators[] = {
{ "revert-to-saved", "F4" },
{ "show-sidebar", "F9" },
{ "show-thumbnail-list", "F8" },
{ "go-back", "<Alt>Left" },
{ "go-forward", "<Alt>Right" },
{ "go-up", "<Alt>Up" },
{ "go-home", "<Alt>Home" }
};
......
......@@ -2182,13 +2182,13 @@ _gth_browser_real_set_current_page (GthWindow *window,
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS, page == GTH_BROWSER_PAGE_BROWSER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS, page == GTH_BROWSER_PAGE_BROWSER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW, page == GTH_BROWSER_PAGE_BROWSER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT, page == GTH_BROWSER_PAGE_BROWSER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS, page == GTH_BROWSER_PAGE_BROWSER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION, page == GTH_BROWSER_PAGE_VIEWER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS, page == GTH_BROWSER_PAGE_VIEWER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW, page == GTH_BROWSER_PAGE_VIEWER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT, page == GTH_BROWSER_PAGE_VIEWER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR, page == GTH_BROWSER_PAGE_VIEWER);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS, page == GTH_BROWSER_PAGE_VIEWER);
gtk_widget_set_visible (browser->priv->browser_status_commands, page == GTH_BROWSER_PAGE_BROWSER);
......@@ -3867,29 +3867,30 @@ gth_browser_init (GthBrowser *browser)
/* -- browser page -- */
/* headerbar */
/* dynamic header sections */
{
GtkWidget *header_bar;
GtkWidget *button;
for (i = 0; i < GTH_BROWSER_N_HEADER_SECTIONS; i++) {
gboolean separated_buttons;
header_bar = gth_window_get_header_bar (GTH_WINDOW (browser));
separated_buttons = ((i == GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)
|| (i == GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS)
|| (i == GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR));
/* dynamic sections */
browser->priv->header_sections[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, separated_buttons ? 6 : 0);
gtk_widget_set_valign (browser->priv->header_sections[i], GTK_ALIGN_CENTER);
if (! separated_buttons)
gtk_style_context_add_class (gtk_widget_get_style_context (browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
}
for (i = 0; i < GTH_BROWSER_N_HEADER_SECTIONS; i++) {
gboolean separated_buttons;
/* window header bar */
separated_buttons = (i == GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS) || (i == GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS);
{
GtkWidget *header_bar;
browser->priv->header_sections[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, separated_buttons ? 6 : 0);
gtk_widget_set_valign (browser->priv->header_sections[i], GTK_ALIGN_CENTER);
if (! separated_buttons)
gtk_style_context_add_class (gtk_widget_get_style_context (browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
}
header_bar = gth_window_get_header_bar (GTH_WINDOW (browser));
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW], SECTION_BIG_MARGIN);
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT], SECTION_BIG_MARGIN);
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS], SECTION_BIG_MARGIN);
gtk_widget_set_margin_right (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW], SECTION_BIG_MARGIN);
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT], SECTION_BIG_MARGIN);
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW], SECTION_BIG_MARGIN);
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS], SECTION_BIG_MARGIN);
......@@ -3897,14 +3898,14 @@ gth_browser_init (GthBrowser *browser)
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION]);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS]);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS]);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION]);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW]);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT]);
/* gears menu button */
......@@ -3938,30 +3939,19 @@ gth_browser_init (GthBrowser *browser)
"go-previous-symbolic",
_("Go to the previous visited location"),
"win.go-back",
"<alt>Left");
NULL);
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
"go-next-symbolic",
_("Go to the next visited location"),
"win.go-forward",
"<alt>Right");
/*gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
"go-up-symbolic",
_("Go up one level"),
"win.go-up",
"<alt>Up");*/
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS,
"user-home-symbolic",
NULL,
"win.go-home",
"<alt>Home");
NULL);
/* history menu button */
{
GtkBuilder *builder;
GtkWidget *button;
builder = _gtk_builder_new_from_resource ("history-menu.ui");
button = _gtk_menu_button_new_for_header_bar ();
......@@ -3976,15 +3966,6 @@ gth_browser_init (GthBrowser *browser)
g_object_unref (builder);
}
/* browser commands */
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
"palette-symbolic",
_("Edit file"),
"win.browser-edit-file",
NULL);
/* viewer navigation */
gth_browser_add_header_bar_button (browser,
......@@ -3997,7 +3978,13 @@ gth_browser_init (GthBrowser *browser)
/* viewer edit */
gth_browser_add_header_bar_toggle_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR,
"dialog-information-symbolic",
_("Properties"),
"win.viewer-properties",
NULL);
gth_browser_add_header_bar_toggle_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR,
"palette-symbolic",
_("Edit file"),
"win.viewer-edit-file",
......@@ -4038,12 +4025,6 @@ gth_browser_init (GthBrowser *browser)
/*gtk_style_context_add_class (gtk_widget_get_style_context (browser->priv->viewer_status_commands), GTK_STYLE_CLASS_LINKED);*/
gtk_box_pack_start (GTK_BOX (gth_statubar_get_action_area (GTH_STATUSBAR (browser->priv->statusbar))), browser->priv->viewer_status_commands, FALSE, FALSE, 0);
button = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("dialog-information-symbolic", GTK_ICON_SIZE_MENU));
gtk_widget_show_all (button);
gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.viewer-properties");
gtk_box_pack_end (GTK_BOX (browser->priv->viewer_status_commands), button, FALSE, FALSE, 0);
button = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("view-grid-symbolic", GTK_ICON_SIZE_MENU));
gtk_widget_show_all (button);
......
......@@ -82,11 +82,11 @@ typedef enum { /*< skip >*/
GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS,
GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS,
GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW,
GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION,
GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS,
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR,
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
GTH_BROWSER_N_HEADER_SECTIONS
} GthBrowserHeaderSection;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment