[goobox] removed the menubar, added a menu button on the toolbar
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goobox] removed the menubar, added a menu button on the toolbar
- Date: Sun, 3 Jun 2012 19:51:37 +0000 (UTC)
commit 67320f50bacfa403c904df27da12136414809c77
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Jun 3 09:34:58 2012 +0200
removed the menubar, added a menu button on the toolbar
src/Makefile.am | 4 +
src/actions.c | 8 +
src/actions.h | 1 +
src/dlg-properties.c | 2 +-
src/goo-window.c | 127 ++---
src/gth-toggle-menu-action.c | 186 +++++++
src/gth-toggle-menu-action.h | 62 +++
src/gth-toggle-menu-tool-button.c | 1056 +++++++++++++++++++++++++++++++++++++
src/gth-toggle-menu-tool-button.h | 80 +++
src/ui.h | 55 +--
src/ui/menu-toolbars.ui | 51 +--
11 files changed, 1450 insertions(+), 182 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 7198f7d..0f61475 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,6 +62,10 @@ goobox_SOURCES = \
goo-volume-tool-button.h \
goo-window.c \
goo-window.h \
+ gth-toggle-menu-action.c \
+ gth-toggle-menu-action.h \
+ gth-toggle-menu-tool-button.c \
+ gth-toggle-menu-tool-button.h \
gth-user-dir.c \
gth-user-dir.h \
gth-window.c \
diff --git a/src/actions.c b/src/actions.c
index 2b89131..85f52a0 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -173,6 +173,14 @@ activate_action_about (GtkAction *action,
void
+activate_action_close (GtkAction *action,
+ gpointer data)
+{
+ goo_window_close (GOO_WINDOW (data));
+}
+
+
+void
activate_action_quit (GtkAction *action,
gpointer data)
{
diff --git a/src/actions.h b/src/actions.h
index 267b7dc..fb639f1 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -37,6 +37,7 @@ void activate_action_reload (GtkAction *action, gpointer data);
void activate_action_manual (GtkAction *action, gpointer data);
void activate_action_shortcuts (GtkAction *action, gpointer data);
void activate_action_about (GtkAction *action, gpointer data);
+void activate_action_close (GtkAction *action, gpointer data);
void activate_action_quit (GtkAction *action, gpointer data);
void activate_action_view_toolbar (GtkAction *action, gpointer data);
void activate_action_view_statusbar (GtkAction *action, gpointer data);
diff --git a/src/dlg-properties.c b/src/dlg-properties.c
index acadd56..1873720 100644
--- a/src/dlg-properties.c
+++ b/src/dlg-properties.c
@@ -579,7 +579,7 @@ dlg_properties (GooWindow *window)
/* run dialog. */
gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (window));
- gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
+ gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
gtk_widget_show (data->dialog);
set_data_from_album (data, goo_window_get_album (data->window));
diff --git a/src/goo-window.c b/src/goo-window.c
index 3e751ed..c11b857 100644
--- a/src/goo-window.c
+++ b/src/goo-window.c
@@ -36,6 +36,7 @@
#include "goo-player-info.h"
#include "goo-window.h"
#include "goo-volume-tool-button.h"
+#include "gth-toggle-menu-tool-button.h"
#include "gth-user-dir.h"
#include "gtk-utils.h"
#include "gtk-file-chooser-preview.h"
@@ -55,7 +56,8 @@
#define IDLE_TIMEOUT 200
#define FALLBACK_ICON_SIZE 16
#define CONFIG_KEY_AUTOFETCH_GROUP "AutoFetch"
-#define VOLUME_BUTTON_POSITION 7
+#define ACTIONS_MENU_BUTTON_POSITION 6
+#define VOLUME_BUTTON_POSITION 8
#define TRAY_TOOLTIP_DELAY 500
#define AUTOPLAY_DELAY 250
@@ -143,18 +145,6 @@ G_DEFINE_TYPE (GooWindow, goo_window, GTH_TYPE_WINDOW)
static void
-set_active (GooWindow *window,
- const char *action_name,
- gboolean is_active)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->actions, action_name);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), is_active);
-}
-
-
-static void
set_sensitive (GooWindow *window,
const char *action_name,
gboolean sensitive)
@@ -208,7 +198,6 @@ window_update_sensitivity (GooWindow *window)
gboolean audio_cd;
gboolean playing;
gboolean paused;
- gboolean play_all;
n_selected = _gtk_count_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view)));
one_file_selected = n_selected == 1;
@@ -216,7 +205,6 @@ window_update_sensitivity (GooWindow *window)
error = ! goo_player_is_audio_cd (window->priv->player) || window->priv->hibernate;
playing = state == GOO_PLAYER_STATE_PLAYING;
paused = state == GOO_PLAYER_STATE_PAUSED;
- play_all = g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_PLAYALL);
audio_cd = (! error) && (goo_player_get_discid (window->priv->player) != NULL);
set_sensitive (window, "Play", audio_cd && !playing);
@@ -234,14 +222,10 @@ window_update_sensitivity (GooWindow *window)
set_sensitive (window, "RemoveCover", audio_cd);
set_sensitive (window, "SearchCoverFromWeb", audio_cd);
- set_sensitive (window, "Repeat", play_all);
- set_sensitive (window, "Shuffle", play_all);
-
gtk_widget_set_sensitive (window->priv->list_view, audio_cd);
set_sensitive (window, "Eject", ! window->priv->hibernate);
set_sensitive (window, "EjectToolBar", ! window->priv->hibernate);
- set_sensitive (window, "Preferences", ! window->priv->hibernate);
}
@@ -899,21 +883,6 @@ pref_playlist_playall_changed (GSettings *settings,
create_playlist (window, play_all, shuffle);
window_update_sensitivity (window);
-
- set_active (window, "PlayAll", play_all);
-}
-
-
-static void
-pref_playlist_repeat_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
-{
- GooWindow *window = user_data;
-
- g_return_if_fail (window != NULL);
-
- set_active (window, "Repeat", g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_REPEAT));
}
@@ -931,8 +900,6 @@ pref_playlist_shuffle_changed (GSettings *settings,
play_all = g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_PLAYALL);
shuffle = g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_SHUFFLE);
create_playlist (window, play_all, shuffle);
-
- set_active (window, "Shuffle", shuffle);
}
@@ -995,11 +962,9 @@ goo_window_show (GtkWidget *widget)
arg_toggle_visibility = FALSE;
view_foobar = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_TOOLBAR);
- set_active (window, "ViewToolbar", view_foobar);
goo_window_set_toolbar_visibility (window, view_foobar);
view_foobar = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_STATUSBAR);
- set_active (window, "ViewStatusbar", view_foobar);
goo_window_set_statusbar_visibility (window, view_foobar);
if (window->priv->first_time_event == 0)
@@ -1459,43 +1424,24 @@ static void
window_update_title (GooWindow *window)
{
GooPlayerState state;
- gboolean paused;
GString *title;
- state = goo_player_get_state (window->priv->player);
- paused = state == GOO_PLAYER_STATE_PAUSED;
-
title = g_string_new ("");
- if (window->priv->current_track != NULL) {
- g_string_append (title, window->priv->current_track->title);
- if (window->priv->current_track->artist != NULL) {
- g_string_append (title, " - ");
- g_string_append (title, window->priv->current_track->artist);
- }
- g_string_append_printf (title,
- " [%d/%d]",
- window->priv->current_track->number + 1,
- window->priv->album->n_tracks);
- if (paused)
- g_string_append_printf (title,
- " [%s]",
- _("Paused"));
- }
- else if (state == GOO_PLAYER_STATE_NO_DISC) {
- g_string_append (title, _("No Disc"));
- }
- else if (state == GOO_PLAYER_STATE_DATA_DISC) {
- g_string_append (title, _("Data Disc"));
- }
- else {
- if ((window->priv->album->title == NULL) || (window->priv->album->artist == NULL))
- g_string_append (title, _("Audio CD"));
- else {
+ state = goo_player_get_state (window->priv->player);
+ switch (state) {
+ case GOO_PLAYER_STATE_NO_DISC:
+ case GOO_PLAYER_STATE_DATA_DISC:
+ case GOO_PLAYER_STATE_ERROR:
+ g_string_append (title, _("CD Player"));
+ break;
+
+ default:
+ if ((window->priv->album != NULL) && (window->priv->album->title != NULL))
g_string_append (title, window->priv->album->title);
- g_string_append (title, " - ");
- g_string_append (title, window->priv->album->artist);
- }
+ else
+ g_string_append (title, _("Audio CD"));
+ break;
}
gtk_window_set_title (GTK_WINDOW (window), title->str);
@@ -1998,10 +1944,6 @@ player_info_cover_clicked_cb (GooPlayerInfo *info,
static void
window_sync_ui_with_preferences (GooWindow *window)
{
- set_active (window, "PlayAll", g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_PLAYALL));
- set_active (window, "Repeat", g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_REPEAT));
- set_active (window, "Shuffle", g_settings_get_boolean (window->priv->settings_playlist, PREF_PLAYLIST_SHUFFLE));
-
update_ui_from_expander_state (window);
}
@@ -2265,7 +2207,7 @@ goo_window_construct (GooWindow *window,
BraseroDrive *drive)
{
- GtkWidget *menubar, *toolbar;
+ GtkWidget *toolbar;
GtkWidget *scrolled_window;
GtkWidget *vbox;
GtkWidget *hbox;
@@ -2377,6 +2319,7 @@ goo_window_construct (GooWindow *window,
GTK_POLICY_NEVER,
GTK_POLICY_NEVER);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_NONE);
+ gtk_widget_set_hexpand (scrolled_window, TRUE);
gtk_container_add (GTK_CONTAINER (scrolled_window), window->priv->list_view);
/* Build the menu and the toolbar. */
@@ -2387,10 +2330,6 @@ goo_window_construct (GooWindow *window,
action_entries,
n_action_entries,
window);
- gtk_action_group_add_toggle_actions (actions,
- action_toggle_entries,
- n_action_toggle_entries,
- window);
window->priv->ui = ui = gtk_ui_manager_new ();
@@ -2406,10 +2345,6 @@ goo_window_construct (GooWindow *window,
g_error_free (error);
}
- menubar = gtk_ui_manager_get_widget (ui, "/MenuBar");
- gtk_widget_show (menubar);
- gth_window_attach (GTH_WINDOW (window), menubar, GTH_WINDOW_MENUBAR);
-
window->priv->toolbar = toolbar = gtk_ui_manager_get_widget (ui, "/ToolBar");
gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
gtk_widget_set_hexpand (toolbar, TRUE);
@@ -2461,6 +2396,27 @@ goo_window_construct (GooWindow *window,
window->priv->file_popup_menu = gtk_ui_manager_get_widget (ui, "/ListPopupMenu");
window->priv->cover_popup_menu = gtk_ui_manager_get_widget (ui, "/CoverPopupMenu");
+ /* Add the action menu button to the toolbar. */
+
+ {
+ GtkToolItem *item;
+
+ item = gtk_separator_tool_item_new ();
+ gtk_widget_show (GTK_WIDGET (item));
+ gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar),
+ item,
+ ACTIONS_MENU_BUTTON_POSITION);
+
+ item = gth_toggle_menu_tool_button_new ();
+ gth_toggle_menu_tool_button_set_icon_name (GTH_TOGGLE_MENU_TOOL_BUTTON (item), "emblem-system-symbolic");
+ gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (item), gtk_ui_manager_get_widget (ui, "/ActionsMenu"));
+ gtk_tool_item_set_tooltip_text (item, _("Other actions"));
+ gtk_widget_show (GTK_WIDGET (item));
+ gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar),
+ item,
+ ACTIONS_MENU_BUTTON_POSITION + 1);
+ }
+
/* Add the volume button to the toolbar. */
{
@@ -2596,10 +2552,6 @@ goo_window_construct (GooWindow *window,
"changed::" PREF_PLAYLIST_SHUFFLE,
G_CALLBACK (pref_playlist_shuffle_changed),
window);
- g_signal_connect (window->priv->settings_playlist,
- "changed::" PREF_PLAYLIST_REPEAT,
- G_CALLBACK (pref_playlist_repeat_changed),
- window);
/* Media keys*/
@@ -3176,7 +3128,6 @@ goo_window_toggle_visibility (GooWindow *window)
_("_Hide Window"),
_("Hide the main window"),
NULL,
- /*"/MenuBar/View/", FIXME*/
"/TrayPopupMenu/",
NULL);
}
diff --git a/src/gth-toggle-menu-action.c b/src/gth-toggle-menu-action.c
new file mode 100644
index 0000000..3458d6c
--- /dev/null
+++ b/src/gth-toggle-menu-action.c
@@ -0,0 +1,186 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2011 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include "gth-toggle-menu-action.h"
+#include "gth-toggle-menu-tool-button.h"
+
+
+G_DEFINE_TYPE (GthToggleMenuAction, gth_toggle_menu_action, GTK_TYPE_TOGGLE_ACTION)
+
+
+/* Properties */
+enum {
+ PROP_0,
+ PROP_MENU
+};
+
+
+struct _GthToggleMenuActionPrivate {
+ GtkWidget *menu;
+ GthShowMenuFunc show_menu_func;
+ gpointer show_menu_data;
+ GDestroyNotify show_menu_data_destroy;
+};
+
+
+static void
+gth_toggle_menu_action_init (GthToggleMenuAction *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_TOGGLE_MENU_ACTION, GthToggleMenuActionPrivate);
+ self->priv->menu = gtk_menu_new ();
+ g_object_ref_sink (self->priv->menu);
+}
+
+
+
+static void
+gth_toggle_menu_action_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GthToggleMenuAction *self = GTH_TOGGLE_MENU_ACTION (object);
+
+ switch (property_id) {
+ case PROP_MENU:
+ if (self->priv->menu != NULL)
+ g_object_unref (self->priv->menu);
+ self->priv->menu = g_value_dup_object (value);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+static void
+gth_toggle_menu_action_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GthToggleMenuAction *self = GTH_TOGGLE_MENU_ACTION (object);
+
+ switch (property_id) {
+ case PROP_MENU:
+ g_value_set_object (value, self->priv->menu);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void
+tool_item_show_menu_cb (GthToggleMenuToolButton *button,
+ gpointer user_data)
+{
+ GthToggleMenuAction *self = user_data;
+
+ self->priv->show_menu_func (GTK_ACTION (self), self->priv->show_menu_data);
+}
+
+
+static GtkWidget *
+gth_toggle_menu_action_create_tool_item (GtkAction *action)
+{
+ GthToggleMenuAction *self = GTH_TOGGLE_MENU_ACTION (action);
+ GtkWidget *tool_item;
+
+ tool_item = g_object_new (GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, NULL);
+ if (self->priv->show_menu_func != NULL)
+ g_signal_connect (tool_item,
+ "show_menu",
+ G_CALLBACK (tool_item_show_menu_cb),
+ self);
+
+ return tool_item;
+}
+
+
+static void
+gth_toggle_menu_action_finalize (GObject *base)
+{
+ GthToggleMenuAction *self = GTH_TOGGLE_MENU_ACTION (base);
+
+ if (self->priv->show_menu_data_destroy != NULL)
+ self->priv->show_menu_data_destroy (self->priv->show_menu_data);
+ if (self->priv->menu != NULL)
+ g_object_unref (self->priv->menu);
+
+ G_OBJECT_CLASS (gth_toggle_menu_action_parent_class)->finalize (base);
+}
+
+
+static void
+gth_toggle_menu_action_class_init (GthToggleMenuActionClass *klass)
+{
+ GObjectClass *object_class;
+ GtkActionClass *action_class;
+
+ g_type_class_add_private (klass, sizeof (GthToggleMenuActionPrivate));
+
+ object_class = (GObjectClass *) klass;
+ object_class->set_property = gth_toggle_menu_action_set_property;
+ object_class->get_property = gth_toggle_menu_action_get_property;
+ object_class->finalize = gth_toggle_menu_action_finalize;
+
+ action_class = (GtkActionClass *) klass;
+ action_class->toolbar_item_type = GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON;
+ action_class->create_tool_item = gth_toggle_menu_action_create_tool_item;
+
+ /* properties */
+
+ g_object_class_install_property (object_class,
+ PROP_MENU,
+ g_param_spec_object ("menu",
+ "Menu",
+ "The menu to show",
+ GTK_TYPE_MENU,
+ G_PARAM_READWRITE));
+}
+
+
+void
+gth_toggle_menu_action_set_show_menu_func (GthToggleMenuAction *self,
+ GthShowMenuFunc func,
+ gpointer data,
+ GDestroyNotify destroy)
+{
+ self->priv->show_menu_func = func;
+ if (self->priv->show_menu_data_destroy != NULL)
+ self->priv->show_menu_data_destroy (self->priv->show_menu_data);
+ self->priv->show_menu_data = data;
+ self->priv->show_menu_data_destroy = destroy;
+}
+
+
+GtkWidget *
+gth_toggle_menu_action_get_menu (GthToggleMenuAction *self)
+{
+ return self->priv->menu;
+}
diff --git a/src/gth-toggle-menu-action.h b/src/gth-toggle-menu-action.h
new file mode 100644
index 0000000..9753ce6
--- /dev/null
+++ b/src/gth-toggle-menu-action.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2011 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GTH_TOGGLE_MENU_ACTION_H
+#define GTH_TOGGLE_MENU_ACTION_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef void (*GthShowMenuFunc) (GtkAction *action,
+ gpointer user_data);
+
+#define GTH_TYPE_TOGGLE_MENU_ACTION (gth_toggle_menu_action_get_type ())
+#define GTH_TOGGLE_MENU_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_TOGGLE_MENU_ACTION, GthToggleMenuAction))
+#define GTH_TOGGLE_MENU_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_TOGGLE_MENU_ACTION, GthToggleMenuActionClass))
+#define GTH_IS_TOGGLE_MENU_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_TOGGLE_MENU_ACTION))
+#define GTH_IS_TOGGLE_MENU_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GTH_TYPE_TOGGLE_MENU_ACTION))
+#define GTH_TOGGLE_MENU_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_TOGGLE_MENU_ACTION, GthToggleMenuActionClass))
+
+typedef struct _GthToggleMenuAction GthToggleMenuAction;
+typedef struct _GthToggleMenuActionClass GthToggleMenuActionClass;
+typedef struct _GthToggleMenuActionPrivate GthToggleMenuActionPrivate;
+
+struct _GthToggleMenuAction {
+ GtkToggleAction parent;
+ GthToggleMenuActionPrivate *priv;
+};
+
+struct _GthToggleMenuActionClass {
+ GtkToggleActionClass parent_class;
+};
+
+GType gth_toggle_menu_action_get_type (void) G_GNUC_CONST;
+void gth_toggle_menu_action_set_show_menu_func (GthToggleMenuAction *action,
+ GthShowMenuFunc func,
+ gpointer data,
+ GDestroyNotify destroy);
+GtkWidget * gth_toggle_menu_action_get_menu (GthToggleMenuAction *action);
+
+G_END_DECLS
+
+#endif /* GTH_TOGGLE_MENU_ACTION_H */
+
diff --git a/src/gth-toggle-menu-tool-button.c b/src/gth-toggle-menu-tool-button.c
new file mode 100644
index 0000000..323222b
--- /dev/null
+++ b/src/gth-toggle-menu-tool-button.c
@@ -0,0 +1,1056 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <string.h>
+#include <gtk/gtk.h>
+#include "gth-toggle-menu-action.h"
+#include "gth-toggle-menu-tool-button.h"
+
+#define MENU_ID "gth-toggle-menu-tool-button-menu-id"
+
+struct _GthToggleMenuToolButtonPrivate {
+ guint active : 1;
+ guint use_underline : 1;
+ guint contents_invalid : 1;
+ char *stock_id;
+ char *icon_name;
+ char *label_text;
+ GtkWidget *toggle_button;
+ GtkMenu *menu;
+ GtkWidget *icon_widget;
+ GtkWidget *label_widget;
+};
+
+enum {
+ SHOW_MENU,
+ LAST_SIGNAL
+};
+
+enum {
+ PROP_0,
+ PROP_LABEL,
+ PROP_USE_UNDERLINE,
+ PROP_STOCK_ID,
+ PROP_ICON_NAME,
+ PROP_ACTIVE,
+ PROP_MENU
+};
+
+
+static GtkActivatableIface *parent_activatable_iface;
+static int signals[LAST_SIGNAL];
+
+
+static void gth_toggle_menu_tool_button_gtk_activable_interface_init (GtkActivatableIface *iface);
+
+
+G_DEFINE_TYPE_WITH_CODE (GthToggleMenuToolButton,
+ gth_toggle_menu_tool_button,
+ GTK_TYPE_TOOL_ITEM,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
+ gth_toggle_menu_tool_button_gtk_activable_interface_init))
+
+
+gchar *
+_gtk_toolbar_elide_underscores (const gchar *original)
+{
+ gchar *q, *result;
+ const gchar *p, *end;
+ gsize len;
+ gboolean last_underscore;
+
+ if (!original)
+ return NULL;
+
+ len = strlen (original);
+ q = result = g_malloc (len + 1);
+ last_underscore = FALSE;
+
+ end = original + len;
+ for (p = original; p < end; p++)
+ {
+ if (!last_underscore && *p == '_')
+ last_underscore = TRUE;
+ else
+ {
+ last_underscore = FALSE;
+ if (original + 2 <= p && p + 1 <= end &&
+ p[-2] == '(' && p[-1] == '_' && p[0] != '_' && p[1] == ')')
+ {
+ q--;
+ *q = '\0';
+ p++;
+ }
+ else
+ *q++ = *p;
+ }
+ }
+
+ if (last_underscore)
+ *q++ = '_';
+
+ *q = '\0';
+
+ return result;
+}
+
+
+static void
+gth_toggle_menu_tool_button_construct_contents (GtkToolItem *tool_item)
+{
+ GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item);
+ GtkWidget *label = NULL;
+ GtkWidget *icon = NULL;
+ GtkToolbarStyle style;
+ gboolean need_label = FALSE;
+ gboolean need_icon = FALSE;
+ GtkWidget *arrow;
+ GtkWidget *arrow_align;
+ GtkIconSize icon_size;
+ GtkWidget *main_box;
+ GtkWidget *box;
+ guint icon_spacing;
+ GtkOrientation text_orientation = GTK_ORIENTATION_HORIZONTAL;
+ GtkSizeGroup *size_group = NULL;
+
+ button->priv->contents_invalid = FALSE;
+
+ gtk_widget_style_get (GTK_WIDGET (tool_item),
+ "icon-spacing", &icon_spacing,
+ NULL);
+
+ if ((button->priv->icon_widget != NULL) && (gtk_widget_get_parent (button->priv->icon_widget) != NULL))
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->icon_widget)),
+ button->priv->icon_widget);
+
+ if ((button->priv->label_widget != NULL) && (gtk_widget_get_parent (button->priv->label_widget) != NULL))
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->label_widget)),
+ button->priv->label_widget);
+
+ if (gtk_bin_get_child (GTK_BIN (button->priv->toggle_button)) != NULL)
+ /* Note: we are not destroying the label_widget or icon_widget
+ * here because they were removed from their containers above
+ */
+ gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (button->priv->toggle_button)));
+
+ style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button));
+
+ if (style != GTK_TOOLBAR_TEXT)
+ need_icon = TRUE;
+
+ if ((style != GTK_TOOLBAR_ICONS) && (style != GTK_TOOLBAR_BOTH_HORIZ))
+ need_label = TRUE;
+
+ if ((style == GTK_TOOLBAR_BOTH_HORIZ) &&
+ (gtk_tool_item_get_is_important (GTK_TOOL_ITEM (button))
+ || (gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button)) == GTK_ORIENTATION_VERTICAL)
+ || (gtk_tool_item_get_text_orientation (GTK_TOOL_ITEM (button)) == GTK_ORIENTATION_VERTICAL)))
+ {
+ need_label = TRUE;
+ }
+
+ if ((style == GTK_TOOLBAR_ICONS)
+ && (button->priv->icon_widget == NULL)
+ && (button->priv->stock_id == NULL)
+ && button->priv->icon_name == NULL)
+ {
+ need_label = TRUE;
+ need_icon = FALSE;
+ style = GTK_TOOLBAR_TEXT;
+ }
+
+ if ((style == GTK_TOOLBAR_TEXT)
+ && (button->priv->label_widget == NULL)
+ && (button->priv->stock_id == NULL)
+ && (button->priv->label_text == NULL))
+ {
+ need_label = FALSE;
+ need_icon = TRUE;
+ style = GTK_TOOLBAR_ICONS;
+ }
+
+ if (need_label) {
+ if (button->priv->label_widget) {
+ label = button->priv->label_widget;
+ }
+ else {
+ GtkStockItem stock_item;
+ gboolean elide;
+ char *label_text;
+
+ if (button->priv->label_text) {
+ label_text = button->priv->label_text;
+ elide = button->priv->use_underline;
+ }
+ else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item)) {
+ label_text = stock_item.label;
+ elide = TRUE;
+ }
+ else {
+ label_text = "";
+ elide = FALSE;
+ }
+
+ if (elide)
+ label_text = _gtk_toolbar_elide_underscores (label_text);
+ else
+ label_text = g_strdup (label_text);
+
+ label = gtk_label_new (label_text);
+
+ g_free (label_text);
+
+ gtk_widget_show (label);
+ }
+
+ gtk_label_set_ellipsize (GTK_LABEL (label),
+ gtk_tool_item_get_ellipsize_mode (GTK_TOOL_ITEM (button)));
+ text_orientation = gtk_tool_item_get_text_orientation (GTK_TOOL_ITEM (button));
+ if (text_orientation == GTK_ORIENTATION_HORIZONTAL) {
+ gtk_label_set_angle (GTK_LABEL (label), 0);
+ gtk_misc_set_alignment (GTK_MISC (label),
+ gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
+ 0.5);
+ }
+ else {
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE);
+ if (gtk_widget_get_direction (GTK_WIDGET (tool_item)) == GTK_TEXT_DIR_RTL)
+ gtk_label_set_angle (GTK_LABEL (label), -90);
+ else
+ gtk_label_set_angle (GTK_LABEL (label), 90);
+ gtk_misc_set_alignment (GTK_MISC (label),
+ 0.5,
+ 1 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
+ }
+ }
+
+ icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
+ if (need_icon) {
+ if (button->priv->icon_widget) {
+ icon = button->priv->icon_widget;
+
+ if (GTK_IS_IMAGE (icon)) {
+ g_object_set (button->priv->icon_widget,
+ "icon-size", icon_size,
+ NULL);
+ }
+ }
+ else if (button->priv->stock_id
+ && gtk_icon_factory_lookup_default (button->priv->stock_id))
+ {
+ icon = gtk_image_new_from_stock (button->priv->stock_id, icon_size);
+ gtk_widget_show (icon);
+ }
+ else if (button->priv->icon_name) {
+ icon = gtk_image_new_from_icon_name (button->priv->icon_name, icon_size);
+ gtk_widget_show (icon);
+ }
+
+ if (icon && text_orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_misc_set_alignment (GTK_MISC (icon),
+ 1.0 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
+ 0.5);
+ else if (icon)
+ gtk_misc_set_alignment (GTK_MISC (icon),
+ 0.5,
+ gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
+
+ if (icon) {
+ size_group = gtk_tool_item_get_text_size_group (GTK_TOOL_ITEM (button));
+ if (size_group != NULL)
+ gtk_size_group_add_widget (size_group, icon);
+ }
+ }
+
+ arrow = gtk_arrow_new ((text_orientation == GTK_ORIENTATION_HORIZONTAL) ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
+ gtk_widget_show (arrow);
+
+ arrow_align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (arrow_align), 0, 0, icon_spacing, 0);
+ gtk_widget_show (arrow_align);
+ gtk_container_add (GTK_CONTAINER (arrow_align), arrow);
+
+ size_group = gtk_tool_item_get_text_size_group (GTK_TOOL_ITEM (button));
+ if (size_group != NULL)
+ gtk_size_group_add_widget (size_group, arrow_align);
+
+ main_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, icon_spacing);
+ gtk_widget_show (main_box);
+ gtk_container_add (GTK_CONTAINER (button->priv->toggle_button), main_box);
+
+ if (style == GTK_TOOLBAR_BOTH_HORIZ)
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, icon_spacing);
+ else
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, icon_spacing);
+ gtk_widget_show (box);
+
+ gtk_box_pack_start (GTK_BOX (main_box), box, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (main_box), arrow_align, FALSE, FALSE, 0);
+
+ switch (style) {
+ case GTK_TOOLBAR_ICONS:
+ if (icon)
+ gtk_box_pack_start (GTK_BOX (box), icon, TRUE, TRUE, 0);
+ break;
+
+ case GTK_TOOLBAR_BOTH:
+ if (icon)
+ gtk_box_pack_start (GTK_BOX (box), icon, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (box), label, FALSE, TRUE, 0);
+ break;
+
+ case GTK_TOOLBAR_BOTH_HORIZ:
+ if (text_orientation == GTK_ORIENTATION_HORIZONTAL) {
+ if (icon)
+ gtk_box_pack_start (GTK_BOX (box), icon, label? FALSE : TRUE, TRUE, 0);
+ if (label)
+ gtk_box_pack_end (GTK_BOX (box), label, TRUE, TRUE, 0);
+ }
+ else {
+ if (icon)
+ gtk_box_pack_end (GTK_BOX (box), icon, label ? FALSE : TRUE, TRUE, 0);
+ if (label)
+ gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
+ }
+ break;
+
+ case GTK_TOOLBAR_TEXT:
+ gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
+ break;
+ }
+
+ gtk_button_set_relief (GTK_BUTTON (button->priv->toggle_button),
+ gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (button)));
+
+ gtk_tool_item_rebuild_menu (tool_item);
+
+ gtk_widget_queue_resize (GTK_WIDGET (button));
+}
+
+
+static void
+gth_toggle_menu_tool_button_state_changed (GtkWidget *widget,
+ GtkStateType previous_state)
+{
+ GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (widget);
+
+ if (! gtk_widget_is_sensitive (widget) && (button->priv->menu != NULL))
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (button->priv->menu));
+}
+
+
+static void
+gth_toggle_menu_tool_button_update_icon_spacing (GthToggleMenuToolButton *button)
+{
+ GtkWidget *box;
+ guint spacing;
+
+ box = gtk_bin_get_child (GTK_BIN (button->priv->toggle_button));
+ if (GTK_IS_BOX (box)) {
+ gtk_widget_style_get (GTK_WIDGET (button),
+ "icon-spacing", &spacing,
+ NULL);
+ gtk_box_set_spacing (GTK_BOX (box), spacing);
+ }
+}
+
+
+static void
+gth_toggle_menu_tool_button_style_updated (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (gth_toggle_menu_tool_button_parent_class)->style_updated (widget);
+ gth_toggle_menu_tool_button_update_icon_spacing (GTH_TOGGLE_MENU_TOOL_BUTTON (widget));
+}
+
+
+static void
+gth_toggle_menu_tool_button_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (object);
+
+ switch (prop_id) {
+ case PROP_LABEL:
+ gth_toggle_menu_tool_button_set_label (button, g_value_get_string (value));
+ break;
+ case PROP_USE_UNDERLINE:
+ gth_toggle_menu_tool_button_set_use_underline (button, g_value_get_boolean (value));
+ break;
+ case PROP_STOCK_ID:
+ gth_toggle_menu_tool_button_set_stock_id (button, g_value_get_string (value));
+ break;
+ case PROP_ICON_NAME:
+ gth_toggle_menu_tool_button_set_icon_name (button, g_value_get_string (value));
+ break;
+ case PROP_ACTIVE:
+ gth_toggle_menu_tool_button_set_active (button, g_value_get_boolean (value));
+ break;
+ case PROP_MENU:
+ gth_toggle_menu_tool_button_set_menu (button, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+static void
+gth_toggle_menu_tool_button_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (object);
+
+ switch (prop_id) {
+ case PROP_LABEL:
+ g_value_set_string (value, gth_toggle_menu_tool_button_get_label (button));
+ break;
+ case PROP_USE_UNDERLINE:
+ g_value_set_boolean (value, gth_toggle_menu_tool_button_get_use_underline (button));
+ break;
+ case PROP_STOCK_ID:
+ g_value_set_string (value, button->priv->stock_id);
+ break;
+ case PROP_ICON_NAME:
+ g_value_set_string (value, button->priv->icon_name);
+ break;
+ case PROP_ACTIVE:
+ g_value_set_boolean (value, gth_toggle_menu_tool_button_get_active (button));
+ break;
+ case PROP_MENU:
+ g_value_set_object (value, button->priv->menu);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+static void
+gth_toggle_menu_tool_button_property_notify (GObject *object,
+ GParamSpec *pspec)
+{
+ GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (object);
+
+ if (button->priv->contents_invalid || strcmp ("is-important", pspec->name) == 0)
+ gth_toggle_menu_tool_button_construct_contents (GTK_TOOL_ITEM (object));
+
+ if (G_OBJECT_CLASS (gth_toggle_menu_tool_button_parent_class)->notify)
+ G_OBJECT_CLASS (gth_toggle_menu_tool_button_parent_class)->notify (object, pspec);
+}
+
+
+/* Callback for the "deactivate" signal on the pop-up menu.
+ * This is used so that we unset the state of the toggle button
+ * when the pop-up menu disappears.
+ */
+static int
+menu_deactivate_cb (GtkMenuShell *menu_shell,
+ GthToggleMenuToolButton *button)
+{
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->priv->toggle_button), FALSE);
+ return TRUE;
+}
+
+
+static void
+menu_position_func (GtkMenu *menu,
+ int *x,
+ int *y,
+ gboolean *push_in,
+ GthToggleMenuToolButton *button)
+{
+ GtkWidget *widget = GTK_WIDGET (button);
+ GtkRequisition req;
+ GtkRequisition menu_req;
+ GtkOrientation orientation;
+ GtkTextDirection direction;
+ cairo_rectangle_int_t monitor;
+ int monitor_num;
+ GdkScreen *screen;
+ GtkAllocation allocation;
+
+ gtk_widget_get_preferred_size (GTK_WIDGET (button->priv->menu), &menu_req, NULL);
+
+ orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button));
+ direction = gtk_widget_get_direction (widget);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (menu));
+ monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
+ if (monitor_num < 0)
+ monitor_num = 0;
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
+ *x += allocation.x;
+ *y += allocation.y;
+
+ if (direction == GTK_TEXT_DIR_LTR)
+ *x += MAX (allocation.width - menu_req.width, 0);
+ else if (menu_req.width > allocation.width)
+ *x -= menu_req.width - allocation.width;
+
+ if ((*y + allocation.height + menu_req.height) <= monitor.y + monitor.height)
+ *y += allocation.height;
+ else if ((*y - menu_req.height) >= monitor.y)
+ *y -= menu_req.height;
+ else if (monitor.y + monitor.height - (*y + allocation.height) > *y)
+ *y += allocation.height;
+ else
+ *y -= menu_req.height;
+ }
+ else {
+ gdk_window_get_origin (gtk_button_get_event_window (GTK_BUTTON (widget)), x, y);
+ gtk_widget_get_preferred_size (widget, &req, NULL);
+
+ if (direction == GTK_TEXT_DIR_LTR)
+ *x += allocation.width;
+ else
+ *x -= menu_req.width;
+
+ if ((*y + menu_req.height > monitor.y + monitor.height) &&
+ (*y + allocation.height - monitor.y > monitor.y + monitor.height - *y))
+ {
+ *y += allocation.height - menu_req.height;
+ }
+ }
+
+ *push_in = FALSE;
+}
+
+
+static void
+popup_menu_under_button (GthToggleMenuToolButton *button,
+ GdkEventButton *event)
+{
+ g_signal_emit (button, signals[SHOW_MENU], 0);
+
+ if (button->priv->menu == NULL)
+ return;
+
+ if (gtk_menu_get_attach_widget (button->priv->menu) != NULL)
+ gtk_menu_detach (button->priv->menu);
+ gtk_menu_popup (button->priv->menu, NULL, NULL,
+ (GtkMenuPositionFunc) menu_position_func,
+ button,
+ event ? event->button : 0,
+ event ? event->time : gtk_get_current_event_time ());
+}
+
+
+static gboolean
+real_button_toggled_cb (GtkToggleButton *togglebutton,
+ GthToggleMenuToolButton *button)
+{
+ gboolean toggle_active = gtk_toggle_button_get_active (togglebutton);
+
+ if (button->priv->menu == NULL)
+ return FALSE;
+
+ if (button->priv->active != toggle_active) {
+ button->priv->active = toggle_active;
+ g_object_notify (G_OBJECT (button), "active");
+
+ if (button->priv->active && ! gtk_widget_get_visible (GTK_WIDGET (button->priv->menu))) {
+ /* we get here only when the menu is activated by a key
+ * press, so that we can select the first menu item */
+ popup_menu_under_button (button, NULL);
+ gtk_menu_shell_select_first (GTK_MENU_SHELL (button->priv->menu), FALSE);
+ }
+ }
+
+ return FALSE;
+}
+
+
+static gboolean
+real_button_button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ GthToggleMenuToolButton *button)
+{
+ if ((event->button == 1) && (button->priv->menu != NULL)) {
+ popup_menu_under_button (button, event);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+
+static void
+gth_toggle_menu_tool_button_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gth_toggle_menu_tool_button_parent_class)->finalize (object);
+}
+
+
+static gboolean
+gth_toggle_menu_tool_button_create_menu_proxy (GtkToolItem *item)
+{
+ GthToggleMenuToolButton *button;
+ GtkStockItem stock_item;
+ gboolean use_mnemonic = TRUE;
+ const char *label_text;
+ const char *stock_id;
+ const char *label;
+ GtkWidget *menu_item;
+ GtkWidget *menu_image;
+
+ button = GTH_TOGGLE_MENU_TOOL_BUTTON (item);
+
+ label_text = gth_toggle_menu_tool_button_get_label (button);
+ stock_id = gth_toggle_menu_tool_button_get_stock_id (button);
+
+ if (label_text) {
+ label = label_text;
+ use_mnemonic = gth_toggle_menu_tool_button_get_use_underline (button);
+ }
+ else if ((stock_id != NULL) && gtk_stock_lookup (stock_id, &stock_item)) {
+ label = stock_item.label;
+ }
+ else {
+ label = "";
+ }
+
+ if (use_mnemonic)
+ menu_item = gtk_image_menu_item_new_with_mnemonic (label);
+ else
+ menu_item = gtk_image_menu_item_new_with_label (label);
+
+ menu_image = NULL;
+ if (button->priv->stock_id)
+ menu_image = gtk_image_new_from_stock (button->priv->stock_id, GTK_ICON_SIZE_MENU);
+ else if (button->priv->icon_name)
+ menu_image = gtk_image_new_from_icon_name (button->priv->icon_name, GTK_ICON_SIZE_MENU);
+
+ if (menu_image != NULL)
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), menu_image);
+
+ g_object_ref (button->priv->menu);
+ if (gtk_menu_get_attach_widget (button->priv->menu) != NULL)
+ gtk_menu_detach (button->priv->menu);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), GTK_WIDGET (button->priv->menu));
+
+ gtk_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
+
+ return TRUE;
+}
+
+
+static void
+gth_toggle_menu_tool_button_toolbar_reconfigured (GtkToolItem *tool_item)
+{
+ gth_toggle_menu_tool_button_construct_contents (tool_item);
+}
+
+
+static void
+gth_toggle_menu_tool_button_class_init (GthToggleMenuToolButtonClass *klass)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkToolItemClass *tool_item_class;
+
+ g_type_class_add_private (klass, sizeof (GthToggleMenuToolButtonPrivate));
+
+ object_class = (GObjectClass *) klass;
+ object_class->finalize = gth_toggle_menu_tool_button_finalize;
+ object_class->set_property = gth_toggle_menu_tool_button_set_property;
+ object_class->get_property = gth_toggle_menu_tool_button_get_property;
+ object_class->notify = gth_toggle_menu_tool_button_property_notify;
+
+ widget_class = (GtkWidgetClass *) klass;
+ widget_class->state_changed = gth_toggle_menu_tool_button_state_changed;
+ widget_class->style_updated = gth_toggle_menu_tool_button_style_updated;
+
+ tool_item_class = (GtkToolItemClass *) klass;
+ tool_item_class->create_menu_proxy = gth_toggle_menu_tool_button_create_menu_proxy;
+ tool_item_class->toolbar_reconfigured = gth_toggle_menu_tool_button_toolbar_reconfigured;
+
+ /* signals */
+
+ /**
+ * GthToggleMenuToolButton::show-menu:
+ * @button: the object on which the signal is emitted
+ *
+ * The ::show-menu signal is emitted before the menu is shown.
+ *
+ * It can be used to populate the menu on demand, using
+ * gth_toggle_menu_tool_button_get_menu().
+ *
+ * Note that even if you populate the menu dynamically in this way,
+ * you must set an empty menu on the #GthToggleMenuToolButton beforehand,
+ * since the arrow is made insensitive if the menu is not set.
+ */
+ signals[SHOW_MENU] =
+ g_signal_new ("show-menu",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GthToggleMenuToolButtonClass, show_menu),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /* properties */
+
+ g_object_class_install_property (object_class,
+ PROP_LABEL,
+ g_param_spec_string ("label",
+ "Label",
+ "Text to show in the item.",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (object_class,
+ PROP_USE_UNDERLINE,
+ g_param_spec_boolean ("use-underline",
+ "Use underline",
+ "If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (object_class,
+ PROP_STOCK_ID,
+ g_param_spec_string ("stock-id",
+ "Stock Id",
+ "The stock icon displayed on the item",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (object_class,
+ PROP_ICON_NAME,
+ g_param_spec_string ("icon-name",
+ "Icon name",
+ "The name of the themed icon displayed on the item",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (object_class,
+ PROP_ACTIVE,
+ g_param_spec_boolean ("active",
+ "Active",
+ "If the toggle button should be pressed in or not",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (object_class,
+ PROP_MENU,
+ g_param_spec_object ("menu",
+ "Menu",
+ "The dropdown menu",
+ GTK_TYPE_MENU,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("icon-spacing",
+ "Icon spacing",
+ "Spacing in pixels between the icon and label",
+ 0,
+ G_MAXINT,
+ 3,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+
+static void
+gth_toggle_menu_tool_button_init (GthToggleMenuToolButton *button)
+{
+ button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button, GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, GthToggleMenuToolButtonPrivate);
+ button->priv->menu = NULL;
+ button->priv->contents_invalid = TRUE;
+
+ button->priv->toggle_button = gtk_toggle_button_new ();
+ gtk_button_set_focus_on_click (GTK_BUTTON (button->priv->toggle_button), FALSE);
+ gtk_container_add (GTK_CONTAINER (button), button->priv->toggle_button);
+ gtk_widget_show (button->priv->toggle_button);
+
+ g_signal_connect (button->priv->toggle_button,
+ "toggled",
+ G_CALLBACK (real_button_toggled_cb),
+ button);
+ g_signal_connect (button->priv->toggle_button,
+ "button-press-event",
+ G_CALLBACK (real_button_button_press_event_cb),
+ button);
+
+ button->priv->active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button->priv->toggle_button));
+}
+
+
+static void
+gth_toggle_menu_tool_button_update (GtkActivatable *activatable,
+ GtkAction *action,
+ const gchar *property_name)
+{
+ GthToggleMenuToolButton *button;
+
+ parent_activatable_iface->update (activatable, action, property_name);
+
+ if (! GTK_IS_TOGGLE_ACTION (action))
+ return;
+
+ button = GTH_TOGGLE_MENU_TOOL_BUTTON (activatable);
+
+ if (strcmp (property_name, "active") == 0) {
+ gtk_action_block_activate (action);
+ gth_toggle_menu_tool_button_set_active (button, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ gtk_action_unblock_activate (action);
+ }
+ else if ((strcmp (property_name, "menu") == 0) && GTH_IS_TOGGLE_MENU_ACTION (action)) {
+ gth_toggle_menu_tool_button_set_menu (button, gth_toggle_menu_action_get_menu (GTH_TOGGLE_MENU_ACTION (action)));
+ }
+ else if (gtk_activatable_get_use_action_appearance (activatable)) {
+ if (strcmp (property_name, "label") == 0) {
+ gth_toggle_menu_tool_button_set_label (button, gtk_action_get_label (action));
+ }
+ else if (strcmp (property_name, "stock-id") == 0) {
+ gth_toggle_menu_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
+ }
+ else if (strcmp (property_name, "icon-name") == 0) {
+ gth_toggle_menu_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
+ }
+ }
+}
+
+
+static void
+gth_toggle_menu_tool_button_sync_action_properties (GtkActivatable *activatable,
+ GtkAction *action)
+{
+ GthToggleMenuToolButton *button;
+
+ parent_activatable_iface->sync_action_properties (activatable, action);
+
+ if (! GTK_IS_TOGGLE_ACTION (action))
+ return;
+
+ button = GTH_TOGGLE_MENU_TOOL_BUTTON (activatable);
+
+ gtk_action_block_activate (action);
+ gth_toggle_menu_tool_button_set_active (button, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ gtk_action_unblock_activate (action);
+
+ if (GTH_IS_TOGGLE_MENU_ACTION (action))
+ gth_toggle_menu_tool_button_set_menu (button, gth_toggle_menu_action_get_menu (GTH_TOGGLE_MENU_ACTION (action)));
+
+ if (gtk_activatable_get_use_action_appearance (activatable)) {
+ gth_toggle_menu_tool_button_set_label (button, gtk_action_get_label (action));
+ gth_toggle_menu_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
+ gth_toggle_menu_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
+ }
+}
+
+
+static void
+gth_toggle_menu_tool_button_gtk_activable_interface_init (GtkActivatableIface *iface)
+{
+ parent_activatable_iface = g_type_interface_peek_parent (iface);
+ iface->update = gth_toggle_menu_tool_button_update;
+ iface->sync_action_properties = gth_toggle_menu_tool_button_sync_action_properties;
+}
+
+
+GtkToolItem *
+gth_toggle_menu_tool_button_new (void)
+{
+ return (GtkToolItem *) g_object_new (GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, NULL);
+}
+
+
+GtkToolItem *
+gth_toggle_menu_tool_button_new_from_stock (const gchar *stock_id)
+{
+ g_return_val_if_fail (stock_id != NULL, NULL);
+
+ return (GtkToolItem *) g_object_new (GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON,
+ "stock-id", stock_id,
+ NULL);
+}
+
+
+void
+gth_toggle_menu_tool_button_set_label (GthToggleMenuToolButton *button,
+ const char *label)
+{
+ char *old_label;
+
+ g_return_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button));
+
+ old_label = button->priv->label_text;
+ button->priv->label_text = g_strdup (label);
+
+ if (label != NULL) {
+ char *elided_label;
+ AtkObject *accessible;
+
+ elided_label = _gtk_toolbar_elide_underscores (label);
+ accessible = gtk_widget_get_accessible (GTK_WIDGET (button->priv->toggle_button));
+ atk_object_set_name (accessible, elided_label);
+
+ g_free (elided_label);
+ }
+
+ g_free (old_label);
+
+ g_object_notify (G_OBJECT (button), "label");
+}
+
+
+const char *
+gth_toggle_menu_tool_button_get_label (GthToggleMenuToolButton *button)
+{
+ g_return_val_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button), NULL);
+
+ return button->priv->label_text;
+}
+
+
+void
+gth_toggle_menu_tool_button_set_use_underline (GthToggleMenuToolButton *button,
+ gboolean use_underline)
+{
+ g_return_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button));
+
+ use_underline = use_underline != FALSE;
+
+ if (use_underline != button->priv->use_underline) {
+ button->priv->use_underline = use_underline;
+ g_object_notify (G_OBJECT (button), "use-underline");
+ }
+}
+
+
+gboolean
+gth_toggle_menu_tool_button_get_use_underline (GthToggleMenuToolButton *button)
+{
+ g_return_val_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button), FALSE);
+
+ return button->priv->use_underline;
+}
+
+
+void
+gth_toggle_menu_tool_button_set_stock_id (GthToggleMenuToolButton *button,
+ const char *stock_id)
+{
+ g_return_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button));
+
+ g_free (button->priv->stock_id);
+ button->priv->stock_id = g_strdup (stock_id);
+
+ g_object_notify (G_OBJECT (button), "stock-id");
+}
+
+
+const char *
+gth_toggle_menu_tool_button_get_stock_id (GthToggleMenuToolButton *button)
+{
+ g_return_val_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button), NULL);
+
+ return button->priv->stock_id;
+}
+
+
+void
+gth_toggle_menu_tool_button_set_icon_name (GthToggleMenuToolButton *button,
+ const char *icon_name)
+{
+ g_return_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button));
+
+ g_free (button->priv->icon_name);
+ button->priv->icon_name = g_strdup (icon_name);
+
+ g_object_notify (G_OBJECT (button), "icon-name");
+}
+
+
+const char*
+gth_toggle_menu_tool_button_get_icon_name (GthToggleMenuToolButton *button)
+{
+ g_return_val_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button), NULL);
+
+ return button->priv->icon_name;
+}
+
+
+void
+gth_toggle_menu_tool_button_set_active (GthToggleMenuToolButton *button,
+ gboolean is_active)
+{
+ g_return_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button));
+
+ is_active = is_active != FALSE;
+
+ if (button->priv->active != is_active)
+ gtk_button_clicked (GTK_BUTTON (button->priv->toggle_button));
+}
+
+
+gboolean
+gth_toggle_menu_tool_button_get_active (GthToggleMenuToolButton *button)
+{
+ g_return_val_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button), FALSE);
+
+ return button->priv->active;
+}
+
+
+void
+gth_toggle_menu_tool_button_set_menu (GthToggleMenuToolButton *button,
+ GtkWidget *menu)
+{
+ g_return_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button));
+ g_return_if_fail (GTK_IS_MENU (menu) || menu == NULL);
+
+ if (button->priv->menu != GTK_MENU (menu)) {
+ if ((button->priv->menu != NULL) && gtk_widget_get_visible (GTK_WIDGET (button->priv->menu)))
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (button->priv->menu));
+
+ button->priv->menu = GTK_MENU (menu);
+
+ if (button->priv->menu != NULL) {
+ 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),
+ button);
+ }
+ else
+ gtk_widget_set_sensitive (button->priv->toggle_button, FALSE);
+ }
+
+ g_object_notify (G_OBJECT (button), "menu");
+}
+
+
+GtkWidget *
+gth_toggle_menu_tool_button_get_menu (GthToggleMenuToolButton *button)
+{
+ g_return_val_if_fail (GTH_IS_TOGGLE_MENU_TOOL_BUTTON (button), NULL);
+
+ return GTK_WIDGET (button->priv->menu);
+}
diff --git a/src/gth-toggle-menu-tool-button.h b/src/gth-toggle-menu-tool-button.h
new file mode 100644
index 0000000..bfc28e1
--- /dev/null
+++ b/src/gth-toggle-menu-tool-button.h
@@ -0,0 +1,80 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GTH_TOGGLE_MENU_TOOL_BUTTON_H
+#define GTH_TOGGLE_MENU_TOOL_BUTTON_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON (gth_toggle_menu_tool_button_get_type ())
+#define GTH_TOGGLE_MENU_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, GthToggleMenuToolButton))
+#define GTH_TOGGLE_MENU_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, GthToggleMenuToolButtonClass))
+#define GTH_IS_TOGGLE_MENU_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON))
+#define GTH_IS_TOGGLE_MENU_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON))
+#define GTH_TOGGLE_MENU_TOOL_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, GthToggleMenuToolButtonClass))
+
+typedef struct _GthToggleMenuToolButton GthToggleMenuToolButton;
+typedef struct _GthToggleMenuToolButtonClass GthToggleMenuToolButtonClass;
+typedef struct _GthToggleMenuToolButtonPrivate GthToggleMenuToolButtonPrivate;
+
+struct _GthToggleMenuToolButton
+{
+ GtkToolItem parent;
+ GthToggleMenuToolButtonPrivate *priv;
+};
+
+struct _GthToggleMenuToolButtonClass
+{
+ GtkToolItemClass parent_class;
+
+ /*< signals >*/
+
+ void (*show_menu) (GthToggleMenuToolButton *button);
+};
+
+GType gth_toggle_menu_tool_button_get_type (void) G_GNUC_CONST;
+GtkToolItem * gth_toggle_menu_tool_button_new (void);
+GtkToolItem * gth_toggle_menu_tool_button_new_from_stock (const char *stock_id);
+void gth_toggle_menu_tool_button_set_label (GthToggleMenuToolButton *button,
+ const char *label);
+const char * gth_toggle_menu_tool_button_get_label (GthToggleMenuToolButton *button);
+void gth_toggle_menu_tool_button_set_use_underline (GthToggleMenuToolButton *button,
+ gboolean use_underline);
+gboolean gth_toggle_menu_tool_button_get_use_underline (GthToggleMenuToolButton *button);
+void gth_toggle_menu_tool_button_set_stock_id (GthToggleMenuToolButton *button,
+ const char *stock_id);
+const char * gth_toggle_menu_tool_button_get_stock_id (GthToggleMenuToolButton *button);
+void gth_toggle_menu_tool_button_set_icon_name (GthToggleMenuToolButton *button,
+ const char *icon_name);
+const char * gth_toggle_menu_tool_button_get_icon_name (GthToggleMenuToolButton *button);
+void gth_toggle_menu_tool_button_set_active (GthToggleMenuToolButton *button,
+ gboolean is_active);
+gboolean gth_toggle_menu_tool_button_get_active (GthToggleMenuToolButton *button);
+void gth_toggle_menu_tool_button_set_menu (GthToggleMenuToolButton *button,
+ GtkWidget *menu);
+GtkWidget * gth_toggle_menu_tool_button_get_menu (GthToggleMenuToolButton *button);
+
+G_END_DECLS
+
+#endif /* GTH_TOGGLE_MENU_TOOL_BUTTON_H */
diff --git a/src/ui.h b/src/ui.h
index 6b45cb9..7cdf16c 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -31,23 +31,8 @@
static GtkActionEntry action_entries[] = {
{ "CDMenu", NULL, N_("_Disc") },
- { "EditMenu", NULL, N_("_Edit") },
- { "ViewMenu", NULL, N_("_View") },
- { "HelpMenu", NULL, N_("_Help") },
{ "CDCoverMenu", NULL, N_("C_over") },
- { "About", GTK_STOCK_ABOUT,
- NULL, NULL,
- N_("Information about the program"),
- G_CALLBACK (activate_action_about) },
- { "Contents", GTK_STOCK_HELP,
- NULL, "F1",
- N_("Display the manual"),
- G_CALLBACK (activate_action_manual) },
- { "Shortcuts", NULL,
- N_("_Keyboard shortcuts"), "",
- " ",
- G_CALLBACK (activate_action_shortcuts) },
{ "TogglePlay", GOO_STOCK_PLAY,
N_("_Play"), "space",
N_("Play/Pause"),
@@ -84,11 +69,7 @@ static GtkActionEntry action_entries[] = {
N_("_Eject"), "J",
N_("Eject the disc"),
G_CALLBACK (activate_action_eject) },
- { "Preferences", GTK_STOCK_PREFERENCES,
- NULL, NULL,
- N_("Edit various preferences"),
- G_CALLBACK (activate_action_preferences) },
- { "CopyDisc", NULL,
+ { "CopyDisc", GTK_STOCK_COPY,
N_("_Copy Disc"), "C",
N_("Copy the content of this disc on another disc"),
G_CALLBACK (activate_action_copy_disc) },
@@ -104,6 +85,10 @@ static GtkActionEntry action_entries[] = {
NULL, "<Ctrl>Return",
N_("Edit the disc artist, album and the tracks titles"),
G_CALLBACK (activate_action_properties) },
+ { "Close", GTK_STOCK_CLOSE,
+ NULL, NULL,
+ NULL,
+ G_CALLBACK (activate_action_close) },
{ "Quit", GTK_STOCK_QUIT,
NULL, NULL,
N_("Quit the application"),
@@ -131,34 +116,4 @@ static GtkActionEntry action_entries[] = {
};
static guint n_action_entries = G_N_ELEMENTS (action_entries);
-
-static GtkToggleActionEntry action_toggle_entries[] = {
- { "ViewToolbar", NULL,
- N_("_Toolbar"), NULL,
- N_("View the main toolbar"),
- G_CALLBACK (activate_action_view_toolbar),
- TRUE },
- { "ViewStatusbar", NULL,
- N_("Stat_usbar"), NULL,
- N_("View the statusbar"),
- G_CALLBACK (activate_action_view_statusbar),
- TRUE },
- { "PlayAll", NULL,
- N_("Play _All"), NULL,
- N_("Play all tracks"),
- G_CALLBACK (activate_action_play_all),
- TRUE },
- { "Repeat", NULL,
- N_("_Repeat"), NULL,
- N_("Restart playing when finished"),
- G_CALLBACK (activate_action_repeat),
- FALSE },
- { "Shuffle", NULL,
- N_("S_huffle"), NULL,
- N_("Play tracks in a random order"),
- G_CALLBACK (activate_action_shuffle),
- FALSE },
-};
-static guint n_action_toggle_entries = G_N_ELEMENTS (action_toggle_entries);
-
#endif /* UI_H */
diff --git a/src/ui/menu-toolbars.ui b/src/ui/menu-toolbars.ui
index 5587b91..6c99d71 100644
--- a/src/ui/menu-toolbars.ui
+++ b/src/ui/menu-toolbars.ui
@@ -1,44 +1,4 @@
<ui>
- <menubar name="MenuBar">
- <menu action="CDMenu">
- <menuitem action="Extract"/>
- <menuitem action="CopyDisc"/>
- <menuitem action="Eject"/>
- <separator />
- <menuitem action="TogglePlay"/>
- <menuitem action="Stop"/>
- <menuitem action="Next"/>
- <menuitem action="Prev"/>
- <separator />
- <menuitem action="Properties"/>
- <separator />
- <menuitem action="Quit"/>
- </menu>
- <menu action="EditMenu">
- <menuitem action="PlayAll"/>
- <menuitem action="Repeat"/>
- <menuitem action="Shuffle"/>
- <separator/>
- <menu action="CDCoverMenu">
- <menuitem action="PickCoverFromDisk"/>
- <menuitem action="SearchCoverFromWeb"/>
- <separator/>
- <menuitem action="RemoveCover"/>
- </menu>
- <separator/>
- <menuitem action="Preferences"/>
- </menu>
- <menu action="ViewMenu">
- <menuitem action="ViewToolbar"/>
- <menuitem action="ViewStatusbar"/>
- </menu>
- <menu action="HelpMenu">
- <menuitem action="Contents"/>
- <menuitem action="Shortcuts"/>
- <separator name="sep01"/>
- <menuitem action="About"/>
- </menu>
- </menubar>
<toolbar name="ToolBar">
<toolitem action="TogglePlay"/>
<toolitem action="Play"/>
@@ -46,7 +6,6 @@
<toolitem action="Next"/>
<separator />
<toolitem action="Extract"/>
- <toolitem action="EjectToolBar"/>
</toolbar>
<popup name="ListPopupMenu">
<menuitem action="PlaySelected"/>
@@ -57,8 +16,6 @@
<menuitem action="Next"/>
<menuitem action="Eject"/>
<separator/>
- <menuitem action="ToggleVisibility"/>
- <separator/>
<menuitem action="Quit"/>
</popup>
<popup name="CoverPopupMenu">
@@ -67,4 +24,12 @@
<separator name="sep01"/>
<menuitem action="RemoveCover"/>
</popup>
+ <popup name="ActionsMenu">
+ <menuitem action="CopyDisc"/>
+ <menuitem action="Eject"/>
+ <separator />
+ <menuitem action="Properties"/>
+ <separator />
+ <menuitem action="Close"/>
+ </popup>
</ui>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]