[rhythmbox] source-toolbar: hook up the accelerator for the browse action
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] source-toolbar: hook up the accelerator for the browse action
- Date: Wed, 2 May 2012 12:38:38 +0000 (UTC)
commit 5066c0fee039ab7186aba1b915c1eaa63a70b88b
Author: Jonathan Matthew <jonathan d14n org>
Date: Wed May 2 22:37:03 2012 +1000
source-toolbar: hook up the accelerator for the browse action
Since there's no longer a menu item for the browse action, its
accelerator isn't being activated. This seems like a bit of a loss,
so we'll do it ourselves as part of the toolbar updates when the
source selection changes.
widgets/rb-source-toolbar.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/widgets/rb-source-toolbar.c b/widgets/rb-source-toolbar.c
index 92bbf92..8534b84 100644
--- a/widgets/rb-source-toolbar.c
+++ b/widgets/rb-source-toolbar.c
@@ -42,6 +42,7 @@ struct _RBSourceToolbarPrivate
GtkWidget *search_popup;
GtkWidget *toolbar;
GBinding *browse_binding;
+ GtkAction *browse_action;
char *popup_path;
/* search state */
@@ -150,19 +151,22 @@ source_selected_cb (GObject *object, GParamSpec *pspec, RBSourceToolbar *toolbar
g_object_get (toolbar->priv->source, "toolbar-path", &toolbar_path, NULL);
if (toolbar_path != NULL) {
- GtkAction *browse_action;
browse_path = g_strdup_printf ("%s/Browse", toolbar_path);
- browse_action = gtk_ui_manager_get_action (toolbar->priv->ui_manager, browse_path);
+ toolbar->priv->browse_action = gtk_ui_manager_get_action (toolbar->priv->ui_manager,
+ browse_path);
g_free (browse_path);
- if (browse_action != NULL) {
+ if (toolbar->priv->browse_action != NULL) {
toolbar->priv->browse_binding =
g_object_bind_property (toolbar->priv->source, "show-browser",
- browse_action, "active",
+ toolbar->priv->browse_action, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+ gtk_action_connect_accelerator (toolbar->priv->browse_action);
}
g_free (toolbar_path);
+ } else {
+ toolbar->priv->browse_action = NULL;
}
} else {
if (toolbar->priv->toolbar != NULL) {
@@ -191,6 +195,11 @@ source_selected_cb (GObject *object, GParamSpec *pspec, RBSourceToolbar *toolbar
g_object_unref (toolbar->priv->browse_binding);
toolbar->priv->browse_binding = NULL;
}
+
+ if (toolbar->priv->browse_action != NULL) {
+ gtk_action_disconnect_accelerator (toolbar->priv->browse_action);
+ toolbar->priv->browse_action = NULL;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]