[gnome-bluetooth] Add page for hard blocked killswitches
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Add page for hard blocked killswitches
- Date: Mon, 21 Jun 2010 13:00:47 +0000 (UTC)
commit 186216cda654b27dfa29438bca37699f04ce8848
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jun 21 13:59:26 2010 +0100
Add page for hard blocked killswitches
po/POTFILES.in | 1 +
properties/Makefile.am | 2 +-
properties/adapter.c | 26 +++++--
properties/properties-killed-adapter.ui | 126 +++++++++++++++++++++++++++++++
4 files changed, 147 insertions(+), 8 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8b2414e..30319a8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -18,6 +18,7 @@ properties/general.c
properties/adapter.c
[type: gettext/glade] properties/properties-no-adapter.ui
[type: gettext/glade] properties/properties-adapter-off.ui
+[type: gettext/glade] properties/properties-killed-adapter.ui
properties/bluetooth-properties.desktop.in.in
properties/org.gnome.Bluetooth.gschema.xml.in
wizard/main.c
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 5b835a4..522fb8a 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -23,7 +23,7 @@ desktop_in_files = bluetooth-properties.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
-ui_DATA = properties-no-adapter.ui properties-adapter-off.ui
+ui_DATA = properties-no-adapter.ui properties-adapter-off.ui properties-killed-adapter.ui
uidir = $(pkgdatadir)
convertdir=$(datadir)/GConf/gsettings
diff --git a/properties/adapter.c b/properties/adapter.c
index da0ec9c..69aa6c4 100644
--- a/properties/adapter.c
+++ b/properties/adapter.c
@@ -46,8 +46,9 @@ static GtkTreeModel *adapter_model;
static BluetoothKillswitch *killswitch;
static GtkNotebook *notebook;
-#define KILLSWITCH_PAGE_NUM(n) (gtk_notebook_get_n_pages (n) - 2)
-#define NO_ADAPTERS_PAGE_NUM(n) (-1)
+#define KILLSWITCH_PAGE_NUM(n) (gtk_notebook_get_n_pages (n) - 3)
+#define NO_ADAPTERS_PAGE_NUM(n) (gtk_notebook_get_n_pages (n) - 2)
+#define KILLSWITCHED_PAGE_NUM(n) (-1)
typedef struct adapter_data adapter_data;
struct adapter_data {
@@ -198,10 +199,16 @@ static void
set_current_page (GtkNotebook *notebook)
{
if (gtk_tree_model_iter_n_children (adapter_model, NULL) == 0) {
+ KillswitchState state;
+
+ state = bluetooth_killswitch_get_state (killswitch);
if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE &&
- bluetooth_killswitch_get_state (killswitch) != KILLSWITCH_STATE_HARD_BLOCKED) {
+ state != KILLSWITCH_STATE_HARD_BLOCKED) {
gtk_notebook_set_current_page (notebook,
KILLSWITCH_PAGE_NUM(notebook));
+ } else if (state == KILLSWITCH_STATE_HARD_BLOCKED) {
+ gtk_notebook_set_current_page (notebook,
+ KILLSWITCHED_PAGE_NUM(notebook));
} else {
gtk_notebook_set_current_page (notebook,
NO_ADAPTERS_PAGE_NUM(notebook));
@@ -678,7 +685,7 @@ create_killswitch_page (GtkNotebook *notebook)
}
static void
-create_no_adapter_page (GtkNotebook *notebook)
+create_no_adapter_page (GtkNotebook *notebook, const char *filename)
{
GtkWidget *mainbox;
GtkWidget *vbox;
@@ -686,11 +693,15 @@ create_no_adapter_page (GtkNotebook *notebook)
GtkBuilder *xml;
xml = gtk_builder_new ();
- if (gtk_builder_add_from_file (xml, "properties-no-adapter.ui", NULL) == 0) {
- if (gtk_builder_add_from_file (xml, PKGDATADIR "/properties-no-adapter.ui", NULL) == 0) {
+ if (gtk_builder_add_from_file (xml, filename, NULL) == 0) {
+ char *path;
+ path = g_build_filename (PKGDATADIR, filename, NULL);
+ if (gtk_builder_add_from_file (xml, path, NULL) == 0) {
+ g_free (path);
g_warning ("Failed to load properties-no-adapter.ui");
return;
}
+ g_free (path);
}
vbox = GTK_WIDGET (gtk_builder_get_object (xml, "table1"));
@@ -714,7 +725,8 @@ void setup_adapter(GtkNotebook *_notebook)
/* Create our static pages first */
create_killswitch_page (notebook);
- create_no_adapter_page (notebook);
+ create_no_adapter_page (notebook, "properties-no-adapter.ui");
+ create_no_adapter_page (notebook, "properties-killed-adapter.ui");
client = bluetooth_client_new();
diff --git a/properties/properties-killed-adapter.ui b/properties/properties-killed-adapter.ui
new file mode 100644
index 0000000..e08ec07
--- /dev/null
+++ b/properties/properties-killed-adapter.ui
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="icon_name">gtk-dialog-info</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Bluetooth has been disabled by a switch on your computer.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND</property>
+ </packing>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]