[gnome-control-center/wip/garnacho/wayland-tablet: 2/6] wacom: Use updated ui files



commit 31835700c7cfba3115af738335f1678e143a9ad0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 24 19:21:37 2016 +0200

    wacom: Use updated ui files

 panels/wacom/cc-wacom-nav-button.c  |    6 ++----
 panels/wacom/cc-wacom-page.c        |    3 ++-
 panels/wacom/cc-wacom-panel.c       |   14 ++++++++++++++
 panels/wacom/cc-wacom-stylus-page.c |    4 +++-
 4 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-nav-button.c b/panels/wacom/cc-wacom-nav-button.c
index 3cdb99a..eda208e 100644
--- a/panels/wacom/cc-wacom-nav-button.c
+++ b/panels/wacom/cc-wacom-nav-button.c
@@ -72,10 +72,8 @@ cc_wacom_nav_button_update (CcWacomNavButton *nav)
 
        g_assert (num_pages >= 1);
 
-       if (num_pages == 1)
-               gtk_widget_hide (GTK_WIDGET (nav));
-       else
-               gtk_widget_show (GTK_WIDGET (nav));
+       gtk_revealer_set_reveal_child (GTK_REVEALER (gtk_widget_get_parent (nav)),
+                                      num_pages > 1);
 
        current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
        if (current_page < 0)
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 7ddbeb4..dda1a97 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -739,7 +739,8 @@ cc_wacom_page_init (CcWacomPage *self)
        priv->nav = cc_wacom_nav_button_new ();
         gtk_widget_set_halign (priv->nav, GTK_ALIGN_END);
         gtk_widget_set_margin_start (priv->nav, 10);
-       gtk_grid_attach (GTK_GRID (box), priv->nav, 1, 0, 1, 1);
+       gtk_widget_show (priv->nav);
+       gtk_container_add (CWID ("navigation-placeholder"), priv->nav);
 
        priv->cancellable = g_cancellable_new ();
 }
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index 69da8d9..b283077 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -302,6 +302,10 @@ add_stylus (CcWacomPanel *self,
        gtk_widget_show (page);
        gtk_notebook_append_page (GTK_NOTEBOOK (priv->stylus_notebook), page, NULL);
        g_hash_table_insert (priv->stylus_pages, tool, page);
+
+       if (gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->stylus_notebook)) == 0)
+               gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->stylus_notebook), 1);
+
        return TRUE;
 }
 
@@ -710,6 +714,7 @@ cc_wacom_panel_init (CcWacomPanel *self)
        GError *error = NULL;
        char *objects[] = {
                "main-box",
+               "no-stylus-page",
                NULL
        };
 
@@ -722,6 +727,10 @@ cc_wacom_panel_init (CcWacomPanel *self)
                                                "/org/gnome/control-center/wacom/gnome-wacom-properties.ui",
                                                objects,
                                                &error);
+       gtk_builder_add_objects_from_resource (priv->builder,
+                                               "/org/gnome/control-center/wacom/wacom-stylus-page.ui",
+                                               objects,
+                                               &error);
        if (error != NULL)
        {
                g_warning ("Error loading UI file: %s", error->message);
@@ -784,6 +793,11 @@ cc_wacom_panel_init (CcWacomPanel *self)
                              priv->tablet_notebook, "tablet",
                              _("Tablet"));
 
+       /* No styli page */
+       widget = WID ("no-stylus-page");
+       enbiggen_label (GTK_LABEL (WID ("no-stylus-label1")));
+       gtk_notebook_append_page (GTK_NOTEBOOK (priv->stylus_notebook), widget, NULL);
+
        /* No tablets page */
        widget = WID ("main-box");
        enbiggen_label (GTK_LABEL (WID ("advice-label1")));
diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index e876b90..8827b8b 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -303,7 +303,8 @@ cc_wacom_stylus_page_init (CcWacomStylusPage *self)
        priv->nav = cc_wacom_nav_button_new ();
         gtk_widget_set_halign (priv->nav, GTK_ALIGN_END);
         gtk_widget_set_margin_start (priv->nav, 10);
-       gtk_grid_attach (GTK_GRID (box), priv->nav, 1, 0, 1, 1);
+       gtk_widget_show (priv->nav);
+       gtk_container_add (CWID ("navigation-placeholder"), priv->nav);
 }
 
 static void
@@ -493,5 +494,6 @@ cc_wacom_stylus_page_set_navigation (CcWacomStylusPage *page,
 
        g_object_set (G_OBJECT (priv->nav),
                      "notebook", notebook,
+                     "ignore-first", TRUE,
                      NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]