[gnome-bluetooth] properties: Update UI for GNOME 3 style
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] properties: Update UI for GNOME 3 style
- Date: Sat, 19 Feb 2011 22:59:55 +0000 (UTC)
commit fb1c8e19a9e48a3713001457c429cd0a5e3f6b5a
Author: Bastien Nocera <hadess hadess net>
Date: Sat Feb 19 22:58:35 2011 +0000
properties: Update UI for GNOME 3 style
Note that the panel is completely non-functional, and will
need to be implemented.
https://bugzilla.gnome.org/show_bug.cgi?id=640862
properties/Makefile.am | 2 +-
properties/bluetooth.ui | 358 ++++++++++++++++++++
properties/cc-bluetooth-panel.c | 169 +++++-----
properties/cc-bluetooth-panel.h | 11 +-
properties/properties-adapter-off.ui | 238 -------------
properties/properties-adapter.ui | 552 -------------------------------
properties/properties-killed-adapter.ui | 126 -------
properties/properties-no-adapter.ui | 266 ---------------
8 files changed, 442 insertions(+), 1280 deletions(-)
---
diff --git a/properties/Makefile.am b/properties/Makefile.am
index e6e80d8..ef9dec1 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 properties-killed-adapter.ui properties-adapter.ui
+ui_DATA = bluetooth.ui
uidir = $(pkgdatadir)
CLEANFILES = $(desktop_DATA) $(schema_DATA)
diff --git a/properties/bluetooth.ui b/properties/bluetooth.ui
new file mode 100644
index 0000000..5e246e6
--- /dev/null
+++ b/properties/bluetooth.ui
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <object class="GtkWindow" id="widget1">
+ <property name="can_focus">False</property>
+ <property name="title">Bluetooth Preferences</property>
+ <property name="window_position">center</property>
+ <property name="default_width">600</property>
+ <property name="default_height">420</property>
+ <child>
+ <object class="GtkVBox" id="vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="spacing">16</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Active</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">6</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_bluetooth">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label">Visibility of â??Bastien's computerâ??</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">6</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_discoverable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="devices_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport" id="viewport1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">4</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Connection</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Paired</property>
+ </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="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">Yes</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>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Type</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>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">Keyboard</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>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkSwitch" id="switch_discoverable1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">6</property>
+ <property name="margin_bottom">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">Keyboard Settings</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolbar" id="toolbar1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <child>
+ <object class="GtkToolButton" id="button_setup">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="button_delete">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/properties/cc-bluetooth-panel.c b/properties/cc-bluetooth-panel.c
index 55b201f..a6997ab 100644
--- a/properties/cc-bluetooth-panel.c
+++ b/properties/cc-bluetooth-panel.c
@@ -31,110 +31,34 @@
#include "cc-bluetooth-panel.h"
-#include "bluetooth-plugin-manager.h"
-#include "bluetooth-client.h"
-#include "bluetooth-client-private.h"
-#include "general.h"
-#include "adapter.h"
+#include <bluetooth-client.h>
+#include <bluetooth-client-private.h>
+#include <bluetooth-killswitch.h>
+#include <bluetooth-chooser.h>
+#include <bluetooth-chooser-private.h>
+#include <bluetooth-plugin-manager.h>
G_DEFINE_DYNAMIC_TYPE (CcBluetoothPanel, cc_bluetooth_panel, CC_TYPE_PANEL)
-static void cc_bluetooth_panel_finalize (GObject *object);
-
-static void
-receive_callback (GtkWidget *item, GtkWindow *window)
-{
- GtkWidget *dialog;
- const char *command = "gnome-file-share-properties";
-
- if (!g_spawn_command_line_async(command, NULL)) {
- /* translators:
- * This is the name of the preferences dialogue for gnome-user-share */
- dialog = gtk_message_dialog_new (window,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Cannot start \"Personal File Sharing\" Preferences"));
-
- /* translators:
- * This is the name of the preferences dialogue for gnome-user-share */
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("Please verify that the \"Personal File Sharing\" program is correctly installed."));
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- }
-}
-
-static GtkWidget *
-create_window (GtkWidget *notebook,
- CcPanel *panel)
-{
- GtkWidget *vbox;
- GtkWidget *buttonbox;
- GtkWidget *button;
- GtkWidget *image;
- CcShell *shell;
- GtkWidget *toplevel;
- GSettings *settings;
-
- shell = cc_panel_get_shell (CC_PANEL (panel));
- toplevel = cc_shell_get_toplevel (shell);
-
- vbox = gtk_vbox_new(FALSE, 6);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
-
- gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
-
- buttonbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_END);
- gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 0);
-
- image = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO,
- GTK_ICON_SIZE_BUTTON);
- button = gtk_button_new_with_label (_("Sharing Settings..."));
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_container_add(GTK_CONTAINER(buttonbox), button);
- gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox),
- button, TRUE);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(receive_callback), toplevel);
-
- gtk_widget_show_all(vbox);
-
- return vbox;
-}
-
-static GObject *
-cc_bluetooth_panel_constructor (GType gtype,
- guint n_properties,
- GObjectConstructParam *properties)
-{
- GObject *obj;
- GtkWidget *widget;
- GtkWidget *notebook;
-
- obj = G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->constructor (gtype, n_properties, properties);
-
- bluetooth_plugin_manager_init ();
+#define BLUETOOTH_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanelPrivate))
- notebook = gtk_notebook_new();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
- setup_adapter(GTK_NOTEBOOK(notebook));
- widget = create_window(notebook, CC_PANEL (obj));
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
- gtk_container_add (GTK_CONTAINER (obj), widget);
+struct CcBluetoothPanelPrivate {
+ GtkBuilder *builder;
+ GtkWidget *chooser;
+};
- return obj;
-}
+static void cc_bluetooth_panel_finalize (GObject *object);
static void
cc_bluetooth_panel_class_init (CcBluetoothPanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->constructor = cc_bluetooth_panel_constructor;
object_class->finalize = cc_bluetooth_panel_finalize;
+
+ g_type_class_add_private (klass, sizeof (CcBluetoothPanelPrivate));
}
static void
@@ -145,9 +69,17 @@ cc_bluetooth_panel_class_finalize (CcBluetoothPanelClass *klass)
static void
cc_bluetooth_panel_finalize (GObject *object)
{
+ CcBluetoothPanel *self;
+
bluetooth_plugin_manager_cleanup ();
- cleanup_adapter();
+ self = CC_BLUETOOTH_PANEL (object);
+ if (self->priv->builder) {
+ g_object_unref (self->priv->builder);
+ self->priv->builder = NULL;
+ }
+
+// cleanup_adapter();
G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->finalize (object);
}
@@ -155,6 +87,59 @@ cc_bluetooth_panel_finalize (GObject *object)
static void
cc_bluetooth_panel_init (CcBluetoothPanel *self)
{
+ GtkWidget *widget;
+ GError *error = NULL;
+ GtkTreeViewColumn *column;
+ GtkStyleContext *context;
+
+ self->priv = BLUETOOTH_PANEL_PRIVATE (self);
+
+ bluetooth_plugin_manager_init ();
+
+ self->priv->builder = gtk_builder_new ();
+ gtk_builder_add_from_file (self->priv->builder,
+ PKGDATADIR "/bluetooth.ui",
+ &error);
+ if (error != NULL) {
+ g_warning ("Failed to load '%s': %s", PKGDATADIR "/bluetooth.ui", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ widget = WID ("vbox");
+ gtk_widget_reparent (widget, GTK_WIDGET (self));
+
+ /* The known devices */
+ widget = WID ("devices_table");
+
+ /* Note that this will only ever show the devices on the default
+ * adapter, this is on purpose */
+ self->priv->chooser = bluetooth_chooser_new (NULL);
+ gtk_table_attach (GTK_TABLE (widget), self->priv->chooser, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ g_object_set (self->priv->chooser,
+ "show-searching", FALSE,
+ "show-device-type", FALSE,
+ "show-device-category", FALSE,
+ "show-pairing", FALSE,
+ "show-connected", TRUE,
+ "device-category-filter", BLUETOOTH_CATEGORY_PAIRED_OR_TRUSTED,
+ NULL);
+ column = bluetooth_chooser_get_type_column (BLUETOOTH_CHOOSER (self->priv->chooser));
+ gtk_tree_view_column_set_visible (column, FALSE);
+ widget = bluetooth_chooser_get_treeview (BLUETOOTH_CHOOSER (self->priv->chooser));
+ g_object_set (G_OBJECT (widget), "headers-visible", FALSE, NULL);
+
+ /* Join treeview and buttons */
+ widget = bluetooth_chooser_get_scrolled_window (BLUETOOTH_CHOOSER (self->priv->chooser));;
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (widget), 250);
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+ widget = WID ("toolbar1");
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
+ gtk_widget_show_all (GTK_WIDGET (self));
}
void
diff --git a/properties/cc-bluetooth-panel.h b/properties/cc-bluetooth-panel.h
index 78f57a7..a074783 100644
--- a/properties/cc-bluetooth-panel.h
+++ b/properties/cc-bluetooth-panel.h
@@ -36,15 +36,16 @@ G_BEGIN_DECLS
#define CC_IS_BLUETOOTH_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_BLUETOOTH_PANEL))
#define CC_BLUETOOTH_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_BLUETOOTH_PANEL, CcBluetoothPanelClass))
-typedef struct _CcBluetoothPanel CcBluetoothPanel;
-typedef struct _CcBluetoothPanelClass CcBluetoothPanelClass;
-typedef struct _CcBluetoothPanelPrivate CcBluetoothPanelPrivate;
+typedef struct CcBluetoothPanel CcBluetoothPanel;
+typedef struct CcBluetoothPanelClass CcBluetoothPanelClass;
+typedef struct CcBluetoothPanelPrivate CcBluetoothPanelPrivate;
-struct _CcBluetoothPanel {
+struct CcBluetoothPanel {
CcPanel parent;
+ CcBluetoothPanelPrivate *priv;
};
-struct _CcBluetoothPanelClass {
+struct CcBluetoothPanelClass {
CcPanelClass parent_class;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]