[gnome-bluetooth] Add discoverable menu item to the applet
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Add discoverable menu item to the applet
- Date: Tue, 27 Oct 2009 21:51:32 +0000 (UTC)
commit 3f8bd536a9a139bc6439ef6012f22d79114f1bec
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 27 21:50:30 2009 +0000
Add discoverable menu item to the applet
https://bugzilla.gnome.org/show_bug.cgi?id=573955
applet/main.c | 32 ++++++++++++++++++++++++++++++++
applet/popup-menu.ui | 11 +++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index 9bee2b0..fe159e1 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -71,6 +71,7 @@ void settings_callback(GObject *widget, gpointer user_data);
void quit_callback(GObject *widget, gpointer user_data);
void browse_callback(GObject *widget, gpointer user_data);
void bluetooth_status_callback (GObject *widget, gpointer user_data);
+void bluetooth_discoverable_callback (GtkToggleAction *toggleaction, gpointer user_data);
void wizard_callback(GObject *widget, gpointer user_data);
void sendto_callback(GObject *widget, gpointer user_data);
@@ -231,6 +232,15 @@ void bluetooth_status_callback (GObject *widget, gpointer user_data)
g_object_set_data (object, "bt-active", GINT_TO_POINTER (active));
}
+void
+bluetooth_discoverable_callback (GtkToggleAction *toggleaction, gpointer user_data)
+{
+ gboolean discoverable;
+
+ discoverable = gtk_toggle_action_get_active (toggleaction);
+ bluetooth_client_set_discoverable (client, discoverable);
+}
+
static gboolean program_available(const char *program)
{
gchar *path;
@@ -405,6 +415,27 @@ update_icon_visibility (void)
}
static void
+update_discoverability (GtkTreeIter *iter)
+{
+ gboolean discoverable;
+ GObject *object;
+
+ object = gtk_builder_get_object (xml, "discoverable");
+
+ if (iter == NULL) {
+ gtk_action_set_visible (GTK_ACTION (object), FALSE);
+ return;
+ }
+
+ gtk_tree_model_get (devices_model, iter,
+ BLUETOOTH_COLUMN_DISCOVERABLE, &discoverable,
+ -1);
+
+ gtk_action_set_visible (GTK_ACTION (object), TRUE);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (object), discoverable);
+}
+
+static void
set_device_status_label (const char *address, int connected)
{
char *action_name, *action_path;
@@ -909,6 +940,7 @@ static void device_changed (GtkTreeModel *model,
cont = gtk_tree_model_iter_next (model, &iter);
}
+ update_discoverability (default_iter);
update_icon_visibility ();
update_menu_items ();
update_device_list (default_iter);
diff --git a/applet/popup-menu.ui b/applet/popup-menu.ui
index 1ced8a1..f167c1a 100644
--- a/applet/popup-menu.ui
+++ b/applet/popup-menu.ui
@@ -25,6 +25,13 @@
<child>
<object class="GtkActionGroup" id="adapter-action-group">
<child>
+ <object class="GtkToggleAction" id="discoverable">
+ <property name="label" translatable="yes">Visible</property>
+ <property name="active">false</property>
+ <signal name="toggled" handler="bluetooth_discoverable_callback"/>
+ </object>
+ </child>
+ <child>
<object class="GtkAction" id="send-file">
<property name="label" translatable="yes">Send files to device...</property>
<property name="icon-name">document-send</property>
@@ -78,6 +85,10 @@
<separator name="killswitch-separator"/>
+ <menuitem name="discoverable" action="discoverable"/>
+
+ <separator name="discoverable-separator"/>
+
<menuitem name="send-file" action="send-file"/>
<menuitem name="browse-device" action="browse-device"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]