Skip to content

Commit

Permalink
Remove some leftover from toolbar rc entries
Browse files Browse the repository at this point in the history
This revert (partly) c95bd69 and d5b911c.
  • Loading branch information
mowgli committed May 19, 2016
1 parent 7978f86 commit a9ce4ed
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 105 deletions.
1 change: 0 additions & 1 deletion src/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,6 @@ void layout_free(LayoutWindow *lw)
for (i = 0; i < TOOLBAR_COUNT; i++)
{
if (lw->toolbar[i]) g_object_unref(lw->toolbar[i]);
string_list_free(lw->toolbar_actions[i]);
}

gtk_widget_destroy(lw->window);
Expand Down
111 changes: 14 additions & 97 deletions src/layout_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "view_dir.h"
#include "window.h"
#include "metadata.h"
#include "rcfile.h"
#include "desktop_file.h"

#include <gdk/gdkkeysyms.h> /* for keyboard values */
Expand Down Expand Up @@ -1650,8 +1649,22 @@ static const gchar *menu_ui_description =
" </menu>"
" </menubar>"
" <toolbar name='ToolBar'>"
" <toolitem action='Thumbnails'/>"
" <toolitem action='Back'/>"
" <toolitem action='Up'/>"
" <toolitem action='Home'/>"
" <toolitem action='Refresh'/>"
" <toolitem action='ZoomIn'/>"
" <toolitem action='ZoomOut'/>"
" <toolitem action='ZoomFit'/>"
" <toolitem action='Zoom100'/>"
" <toolitem action='Preferences'/>"
" <toolitem action='FloatTools'/>"
" </toolbar>"
" <toolbar name='StatusBar'>"
" <toolitem action='ShowInfoPixel'/>"
" <toolitem action='UseColorProfiles'/>"
" <toolitem action='SaveMetadata'/>"
" </toolbar>"
"<accelerator action='PrevImageAlt1'/>"
"<accelerator action='PrevImageAlt2'/>"
Expand Down Expand Up @@ -1976,14 +1989,6 @@ void layout_actions_setup(LayoutWindow *lw)
exit(EXIT_FAILURE);
}

DEBUG_1("%s layout_actions_setup: add toolbar", get_exec_time());
for (i = 0; i < TOOLBAR_COUNT; i++)
{
layout_toolbar_clear(lw, i);
layout_toolbar_add_default(lw, i);
}


DEBUG_1("%s layout_actions_setup: marks", get_exec_time());
layout_actions_setup_marks(lw);

Expand Down Expand Up @@ -2105,94 +2110,6 @@ GtkWidget *layout_actions_toolbar(LayoutWindow *lw, ToolbarType type)
return lw->toolbar[type];
}

void layout_toolbar_clear(LayoutWindow *lw, ToolbarType type)
{
if (lw->toolbar_merge_id[type])
{
gtk_ui_manager_remove_ui(lw->ui_manager, lw->toolbar_merge_id[type]);
gtk_ui_manager_ensure_update(lw->ui_manager);
}
string_list_free(lw->toolbar_actions[type]);
lw->toolbar_actions[type] = NULL;

lw->toolbar_merge_id[type] = gtk_ui_manager_new_merge_id(lw->ui_manager);
}


void layout_toolbar_add(LayoutWindow *lw, ToolbarType type, const gchar *action)
{
const gchar *path = NULL;
if (!action || !lw->ui_manager) return;

if (g_list_find_custom(lw->toolbar_actions[type], action, (GCompareFunc)strcmp)) return;

switch (type)
{
case TOOLBAR_MAIN:
path = "/ToolBar";
break;
case TOOLBAR_STATUS:
path = "/StatusBar";
break;
default:
break;
}


if (g_str_has_suffix(action, ".desktop"))
{
/* this may be called before the external editors are read
create a dummy action for now */

if (!lw->action_group_editors)
{
lw->action_group_editors = gtk_action_group_new("MenuActionsExternal");
gtk_ui_manager_insert_action_group(lw->ui_manager, lw->action_group_editors, 1);
}
if (!gtk_action_group_get_action(lw->action_group_editors, action))
{
GtkActionEntry entry = { action,
GTK_STOCK_MISSING_IMAGE,
action,
NULL,
NULL,
NULL };
DEBUG_1("Creating temporary action %s", action);
gtk_action_group_add_actions(lw->action_group_editors, &entry, 1, lw);
}
}
gtk_ui_manager_add_ui(lw->ui_manager, lw->toolbar_merge_id[type], path, action, action, GTK_UI_MANAGER_TOOLITEM, FALSE);
lw->toolbar_actions[type] = g_list_append(lw->toolbar_actions[type], g_strdup(action));
}


void layout_toolbar_add_default(LayoutWindow *lw, ToolbarType type)
{
switch (type)
{
case TOOLBAR_MAIN:
layout_toolbar_add(lw, type, "Thumbnails");
layout_toolbar_add(lw, type, "Back");
layout_toolbar_add(lw, type, "Up");
layout_toolbar_add(lw, type, "Home");
layout_toolbar_add(lw, type, "Refresh");
layout_toolbar_add(lw, type, "ZoomIn");
layout_toolbar_add(lw, type, "ZoomOut");
layout_toolbar_add(lw, type, "ZoomFit");
layout_toolbar_add(lw, type, "Zoom100");
layout_toolbar_add(lw, type, "Preferences");
layout_toolbar_add(lw, type, "FloatTools");
break;
case TOOLBAR_STATUS:
layout_toolbar_add(lw, type, "ShowInfoPixel");
layout_toolbar_add(lw, type, "UseColorProfiles");
layout_toolbar_add(lw, type, "SaveMetadata");
break;
default:
break;
}
}

/*
*-----------------------------------------------------------------------------
* misc
Expand Down
6 changes: 0 additions & 6 deletions src/layout_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,8 @@ GtkWidget *layout_actions_menu_bar(LayoutWindow *lw);

GtkWidget *layout_actions_toolbar(LayoutWindow *lw, ToolbarType type);

void layout_toolbar_clear(LayoutWindow *lw, ToolbarType type);
void layout_toolbar_add(LayoutWindow *lw, ToolbarType type, const gchar *action);
void layout_toolbar_add_default(LayoutWindow *lw, ToolbarType type);


void layout_keyboard_init(LayoutWindow *lw, GtkWidget *window);


void layout_bar_toggle(LayoutWindow *lw);
void layout_bar_set(LayoutWindow *lw, GtkWidget *bar);

Expand Down
1 change: 0 additions & 1 deletion src/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ struct _LayoutWindow
GtkActionGroup *action_group_editors;
guint ui_editors_id;
GtkUIManager *ui_manager;
guint toolbar_merge_id[TOOLBAR_COUNT];
GList *toolbar_actions[TOOLBAR_COUNT];

GtkWidget *path_entry;
Expand Down

0 comments on commit a9ce4ed

Please sign in to comment.