[gnome-control-center] wacom: Add navigation button to navigate between styli
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wacom: Add navigation button to navigate between styli
- Date: Mon, 28 Nov 2011 18:27:13 +0000 (UTC)
commit ce8186dba11df9847534ccfb2ad352f5831e77fc
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 28 18:23:28 2011 +0000
wacom: Add navigation button to navigate between styli
Looks a bit rough, but functionality is present.
panels/wacom/cc-wacom-page.c | 21 +++++++++++++++++++++
panels/wacom/cc-wacom-page.h | 4 ++++
panels/wacom/cc-wacom-panel.c | 1 +
panels/wacom/gnome-wacom-properties.ui | 4 ++--
panels/wacom/test-wacom.c | 3 ++-
5 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 6b3e279..aee9904 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -23,6 +23,7 @@
#include <config.h>
#include "cc-wacom-page.h"
+#include "cc-wacom-nav-button.h"
#include <gtk/gtk.h>
#include <string.h>
@@ -42,6 +43,7 @@ struct _CcWacomPagePrivate
{
GsdWacomDevice *stylus, *eraser;
GtkBuilder *builder;
+ GtkWidget *nav;
GSettings *wacom_settings;
GSettings *stylus_settings;
GSettings *eraser_settings;
@@ -412,6 +414,8 @@ cc_wacom_page_init (CcWacomPage *self)
g_signal_connect (G_OBJECT (sw), "notify::active",
G_CALLBACK (left_handed_toggled_cb), self);
+ priv->nav = cc_wacom_nav_button_new ();
+ gtk_grid_attach (GTK_GRID (box), priv->nav, 0, 0, 1, 1);
}
static GSettings *
@@ -507,3 +511,20 @@ cc_wacom_page_new (GsdWacomDevice *stylus,
return GTK_WIDGET (page);
}
+
+void
+cc_wacom_page_set_navigation (CcWacomPage *page,
+ GtkNotebook *notebook,
+ gboolean ignore_first_page)
+{
+ CcWacomPagePrivate *priv;
+
+ g_return_if_fail (CC_IS_WACOM_PAGE (page));
+
+ priv = page->priv;
+
+ g_object_set (G_OBJECT (priv->nav),
+ "notebook", notebook,
+ "ignore-first", ignore_first_page,
+ NULL);
+}
diff --git a/panels/wacom/cc-wacom-page.h b/panels/wacom/cc-wacom-page.h
index 3d7b748..b374b52 100644
--- a/panels/wacom/cc-wacom-page.h
+++ b/panels/wacom/cc-wacom-page.h
@@ -71,6 +71,10 @@ GType cc_wacom_page_get_type (void) G_GNUC_CONST;
GtkWidget * cc_wacom_page_new (GsdWacomDevice *stylus,
GsdWacomDevice *eraser);
+void cc_wacom_page_set_navigation (CcWacomPage *page,
+ GtkNotebook *notebook,
+ gboolean ignore_first_page);
+
G_END_DECLS
#endif /* _CC_WACOM_PAGE_H */
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index d1df598..70c61fe 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -215,6 +215,7 @@ update_current_page (CcWacomPanel *self)
if (g_hash_table_lookup (priv->pages, tablet->name) == NULL) {
GtkWidget *page;
page = cc_wacom_page_new (tablet->stylus, tablet->eraser);
+ cc_wacom_page_set_navigation (CC_WACOM_PAGE (page), GTK_NOTEBOOK (priv->notebook), TRUE);
gtk_widget_show (page);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page, NULL);
g_hash_table_insert (priv->pages, g_strdup (tablet->name), page);
diff --git a/panels/wacom/gnome-wacom-properties.ui b/panels/wacom/gnome-wacom-properties.ui
index f4613c6..4906c46 100644
--- a/panels/wacom/gnome-wacom-properties.ui
+++ b/panels/wacom/gnome-wacom-properties.ui
@@ -232,9 +232,9 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
<property name="width">1</property>
- <property name="height">3</property>
+ <property name="height">2</property>
</packing>
</child>
<child>
diff --git a/panels/wacom/test-wacom.c b/panels/wacom/test-wacom.c
index fe76308..a0287ba 100644
--- a/panels/wacom/test-wacom.c
+++ b/panels/wacom/test-wacom.c
@@ -26,6 +26,7 @@ add_page (GList *devices,
g_list_free (devices);
widget = cc_wacom_page_new (stylus, eraser);
+ cc_wacom_page_set_navigation (CC_WACOM_PAGE (widget), GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, NULL);
}
@@ -38,7 +39,7 @@ int main (int argc, char **argv)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
notebook = gtk_notebook_new ();
-// gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
gtk_widget_set_vexpand (notebook, TRUE);
gtk_container_set_border_width (GTK_CONTAINER (notebook), 24);
gtk_container_add (GTK_CONTAINER (window), notebook);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]