Commit 8b9d64e7 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

added the list tools toolbutton in the viewer toolbar as well

parent a2ad243a
......@@ -70,7 +70,6 @@ static GtkActionEntry action_entries[] = {
typedef struct {
GthBrowser *browser;
GtkToolItem *tool_item;
GtkActionGroup *action_group;
gulong scripts_changed_id;
} BrowserData;
......@@ -206,6 +205,7 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
{
BrowserData *data;
GError *error = NULL;
GtkToolItem *tool_item;
g_return_if_fail (GTH_IS_BROWSER (browser));
......@@ -226,13 +226,21 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
/* tools menu button */
data->tool_item = gth_toggle_menu_tool_button_new ();
gtk_tool_button_set_label (GTK_TOOL_BUTTON (data->tool_item), _("Tools"));
gtk_widget_set_tooltip_text (GTK_WIDGET (data->tool_item), _("Batch tools for multiple files"));
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (data->tool_item), GTK_STOCK_EXECUTE);
gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (data->tool_item), gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup"));
gtk_widget_show (GTK_WIDGET (data->tool_item));
gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_browser_toolbar (browser)), data->tool_item, -1);
tool_item = gth_toggle_menu_tool_button_new ();
gtk_tool_button_set_label (GTK_TOOL_BUTTON (tool_item), _("Tools"));
gtk_widget_set_tooltip_text (GTK_WIDGET (tool_item), _("Batch tools for multiple files"));
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (tool_item), GTK_STOCK_EXECUTE);
gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item), gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup"));
gtk_widget_show (GTK_WIDGET (tool_item));
gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_browser_toolbar (browser)), tool_item, -1);
tool_item = gth_toggle_menu_tool_button_new ();
gtk_tool_button_set_label (GTK_TOOL_BUTTON (tool_item), _("Tools"));
gtk_widget_set_tooltip_text (GTK_WIDGET (tool_item), _("Batch tools for multiple files"));
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (tool_item), GTK_STOCK_EXECUTE);
gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item), gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup"));
gtk_widget_show (GTK_WIDGET (tool_item));
gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_viewer_toolbar (browser)), tool_item, 9);
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
......
......@@ -40,11 +40,17 @@ static const char *ui_info =
" </placeholder>"
" </menu>"
" </menubar>"
" <toolbar name='ToolBar'>"
" <placeholder name='BrowserCommands'>"
" <toolitem action='View_Fullscreen'/>"
" <toolitem action='View_Slideshow'/>"
" </placeholder>"
" </toolbar>"
"</ui>";
static GtkActionEntry action_entries[] = {
{ "View_Slideshow", NULL,
{ "View_Slideshow", "x-office-presentation",
"_Slideshow", "F5",
N_("View as a slideshow"),
G_CALLBACK (gth_browser_activate_action_view_slideshow) }
......
......@@ -108,7 +108,6 @@ static const char *fixed_ui_info =
" <placeholder name='SourceCommands'/>"
" <separator/>"
" <placeholder name='BrowserCommands'/>"
" <separator/>"
" </toolbar>"
" <toolbar name='ViewerToolBar'>"
......@@ -116,12 +115,11 @@ static const char *fixed_ui_info =
" <separator/>"
" <toolitem action='View_Prev'/>"
" <toolitem action='View_Next'/>"
/*" <separator/>"
" <toolitem action='Edit_Metadata'/>"
" <separator/>"
" <toolitem action='View_Fullscreen'/>"*/
" <separator/>"
" <placeholder name='ViewerCommands'/>"
" <separator/>"
/*" <toolitem action='Edit_Metadata'/>"*/
" <placeholder name='Edit_Actions'/>"
" <separator expand='true'/>"
" <placeholder name='ViewerCommandsSecondary'/>"
" <toolitem action='Viewer_Properties'/>"
......@@ -215,9 +213,9 @@ static const char *browser_ui_info =
" </menubar>"
" <toolbar name='ToolBar'>"
" <placeholder name='BrowserCommands'>"
" <toolitem action='Edit_Metadata'/>"
" <separator/>"
" <toolitem action='View_Fullscreen'/>"
" <separator/>"
" <toolitem action='Edit_Metadata'/>"
" </placeholder>"
" </toolbar>"
"</ui>";
......
......@@ -319,7 +319,7 @@ gth_file_properties_init (GthFileProperties *file_properties)
/* edit button */
button = gtk_button_new_from_stock (GTK_STOCK_EDIT);
/* FIXME gtk_widget_show (button); */
/*gtk_widget_show (button); FIXME */
gtk_box_pack_start (GTK_BOX (file_properties), button, FALSE, FALSE, 0);
g_signal_connect (button,
......
......@@ -228,18 +228,14 @@ gth_toggle_menu_tool_button_destroy (GtkObject *object)
button = GTH_TOGGLE_MENU_TOOL_BUTTON (object);
if (button->priv->menu != NULL) {
g_signal_handlers_disconnect_by_func (button->priv->menu,
menu_deactivate_cb,
button);
gtk_menu_detach (button->priv->menu);
if (button->priv->toggle_button != NULL) {
g_signal_handlers_disconnect_by_func (button->priv->toggle_button,
real_button_toggled_cb,
button);
g_signal_handlers_disconnect_by_func (button->priv->toggle_button,
real_button_button_press_event_cb,
button);
button->priv->toggle_button = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
......@@ -365,18 +361,6 @@ gth_toggle_menu_tool_button_new_from_stock (const gchar *stock_id)
}
static void
menu_detacher (GtkWidget *widget,
GtkMenu *menu)
{
GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (widget);
g_return_if_fail (button->priv->menu == menu);
button->priv->menu = NULL;
}
void
gth_toggle_menu_tool_button_set_menu (GthToggleMenuToolButton *button,
GtkWidget *menu)
......@@ -388,22 +372,12 @@ gth_toggle_menu_tool_button_set_menu (GthToggleMenuToolButton *button,
if ((button->priv->menu != NULL) && GTK_WIDGET_VISIBLE (button->priv->menu))
gtk_menu_shell_deactivate (GTK_MENU_SHELL (button->priv->menu));
if (button->priv->menu != NULL) {
g_signal_handlers_disconnect_by_func (button->priv->menu,
menu_deactivate_cb,
button);
gtk_menu_detach (button->priv->menu);
}
button->priv->menu = GTK_MENU (menu);
if (button->priv->menu != NULL) {
gtk_menu_attach_to_widget (button->priv->menu,
GTK_WIDGET (button),
menu_detacher);
g_object_add_weak_pointer (G_OBJECT (button->priv->menu), (gpointer *) &button->priv->menu);
gtk_widget_set_sensitive (button->priv->toggle_button, TRUE);
g_signal_connect (button->priv->menu,
"deactivate",
G_CALLBACK (menu_deactivate_cb),
......
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