[gnome-initial-setup] assistant: Remove support for arrow buttons



commit 37ac3dab1df72788b3cb241034ad061d3b00a6b0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 9 00:44:55 2013 -0500

    assistant: Remove support for arrow buttons
    
    As the language page is the first thing we see, it's expected that
    the user will have a readable language before they move to the next
    page.
    
    We can always revert if necessary.

 gnome-initial-setup/gis-assistant.c                |   91 ++++++--------------
 gnome-initial-setup/gis-page.c                     |   24 -----
 gnome-initial-setup/gis-page.h                     |    2 -
 .../pages/language/gis-language-page.c             |    1 -
 4 files changed, 26 insertions(+), 92 deletions(-)
---
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
index 719d1e5..4220135 100644
--- a/gnome-initial-setup/gis-assistant.c
+++ b/gnome-initial-setup/gis-assistant.c
@@ -50,12 +50,6 @@ enum {
 
 static guint signals[LAST_SIGNAL];
 
-typedef struct {
-  GtkWidget *action_area;
-  GtkWidget *forward;
-  GtkWidget *back;
-} Buttons;
-
 struct _GisAssistantPrivate
 {
   GtkWidget *frame;
@@ -63,10 +57,6 @@ struct _GisAssistantPrivate
   GtkWidget *back;
   GtkWidget *main_layout;
 
-  Buttons full_buttons;
-  Buttons symbolic_buttons;
-  Buttons *buttons;
-
   GList *pages;
   GisPage *current_page;
 };
@@ -153,33 +143,19 @@ update_navigation_buttons (GisAssistant *assistant)
   GisPage *page = priv->current_page;
   GisAssistantPagePrivate *page_priv;
   gboolean can_go_forward, is_first_page, is_last_page;
-  Buttons *prev_buttons;
 
   if (page == NULL)
     return;
 
-  prev_buttons = priv->buttons;
-  if (gis_page_get_use_arrow_buttons (page)) {
-    priv->buttons = &priv->symbolic_buttons;
-  } else {
-    priv->buttons = &priv->full_buttons;
-  }
-
-  if (prev_buttons != priv->buttons) {
-    if (prev_buttons != NULL)
-      gtk_widget_hide (prev_buttons->action_area);
-    gtk_widget_show (priv->buttons->action_area);
-  }
-
   page_priv = page->assistant_priv;
 
   can_go_forward = gis_page_get_complete (page);
-  gtk_widget_set_sensitive (priv->buttons->forward, can_go_forward);
+  gtk_widget_set_sensitive (priv->forward, can_go_forward);
 
   is_first_page = (page_priv->link->prev == NULL);
   is_last_page = (page_priv->link->next == NULL);
-  gtk_widget_set_visible (priv->buttons->back, !is_first_page && !is_last_page);
-  gtk_widget_set_visible (priv->buttons->forward, !is_last_page);
+  gtk_widget_set_visible (priv->back, !is_first_page && !is_last_page);
+  gtk_widget_set_visible (priv->forward, !is_last_page);
 }
 
 static void
@@ -288,40 +264,19 @@ _gis_assistant_current_page_changed (GisAssistant *assistant,
   }
 }
 
-static void
-construct_buttons (GisAssistant *assistant,
-                   Buttons      *buttons)
-{
-  buttons->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_box_set_homogeneous (GTK_BOX (buttons->action_area), TRUE);
-  gtk_widget_set_halign (buttons->action_area, GTK_ALIGN_END);
-
-  buttons->forward = gtk_button_new ();
-  gtk_button_set_use_underline (GTK_BUTTON (buttons->forward), TRUE);
-  gtk_widget_set_can_default (buttons->forward, TRUE);
-
-  buttons->back = gtk_button_new ();
-  gtk_button_set_use_underline (GTK_BUTTON (buttons->back), TRUE);
-
-  gtk_box_pack_start (GTK_BOX (buttons->action_area), buttons->back, FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (buttons->action_area), buttons->forward, FALSE, FALSE, 0);
-
-  g_signal_connect (buttons->forward, "clicked", G_CALLBACK (go_forward), assistant);
-  g_signal_connect (buttons->back, "clicked", G_CALLBACK (go_backward), assistant);
-}
-
 void
 gis_assistant_locale_changed (GisAssistant *assistant)
 {
   GisAssistantPrivate *priv = assistant->priv;
-  gtk_button_set_label (GTK_BUTTON (priv->full_buttons.forward), _("_Next"));
-  gtk_button_set_label (GTK_BUTTON (priv->full_buttons.back), _("_Back"));
+  gtk_button_set_label (GTK_BUTTON (priv->forward), _("_Next"));
+  gtk_button_set_label (GTK_BUTTON (priv->back), _("_Back"));
 }
 
 static void
 gis_assistant_init (GisAssistant *assistant)
 {
   GisAssistantPrivate *priv = GET_PRIVATE (assistant);
+  GtkWidget *action_area;
   assistant->priv = priv;
 
   priv->main_layout = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
@@ -331,25 +286,31 @@ gis_assistant_init (GisAssistant *assistant)
   gtk_frame_set_shadow_type (GTK_FRAME (priv->frame), GTK_SHADOW_NONE);
   gtk_box_pack_start (GTK_BOX (priv->main_layout), priv->frame, TRUE, TRUE, 0);
 
-  construct_buttons (assistant, &priv->full_buttons);
-  gtk_button_set_image (GTK_BUTTON (priv->full_buttons.forward),
+  action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+  gtk_box_set_homogeneous (GTK_BOX (action_area), TRUE);
+  gtk_widget_set_halign (action_area, GTK_ALIGN_END);
+
+  priv->forward = gtk_button_new ();
+  gtk_button_set_image (GTK_BUTTON (priv->forward),
                         gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON));
-  gtk_button_set_image (GTK_BUTTON (priv->full_buttons.back),
+  gtk_button_set_use_underline (GTK_BUTTON (priv->forward), TRUE);
+  gtk_widget_set_can_default (priv->forward, TRUE);
+
+  priv->back = gtk_button_new ();
+  gtk_button_set_image (GTK_BUTTON (priv->back),
                         gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON));
-  gis_assistant_locale_changed (assistant);
-  gtk_box_pack_start (GTK_BOX (priv->main_layout), priv->full_buttons.action_area, FALSE, TRUE, 0);
+  gtk_button_set_use_underline (GTK_BUTTON (priv->back), TRUE);
 
-  construct_buttons (assistant, &priv->symbolic_buttons);
-  gtk_button_set_image (GTK_BUTTON (priv->symbolic_buttons.forward),
-                        gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU));
-  gtk_button_set_image (GTK_BUTTON (priv->symbolic_buttons.back),
-                        gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU));
-  gtk_box_pack_start (GTK_BOX (priv->main_layout), priv->symbolic_buttons.action_area, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (action_area), priv->back, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (action_area), priv->forward, FALSE, FALSE, 0);
 
-  gtk_widget_show_all (GTK_WIDGET (assistant));
+  g_signal_connect (priv->forward, "clicked", G_CALLBACK (go_forward), assistant);
+  g_signal_connect (priv->back, "clicked", G_CALLBACK (go_backward), assistant);
 
-  gtk_widget_hide (priv->full_buttons.action_area);
-  gtk_widget_hide (priv->symbolic_buttons.action_area);
+  gis_assistant_locale_changed (assistant);
+  gtk_box_pack_start (GTK_BOX (priv->main_layout), action_area, FALSE, TRUE, 0);
+
+  gtk_widget_show_all (GTK_WIDGET (assistant));
 }
 
 static void
diff --git a/gnome-initial-setup/gis-page.c b/gnome-initial-setup/gis-page.c
index 2a3c213..fee0b03 100644
--- a/gnome-initial-setup/gis-page.c
+++ b/gnome-initial-setup/gis-page.c
@@ -36,7 +36,6 @@ struct _GisPagePrivate
   char *title;
 
   guint complete : 1;
-  guint use_arrow_buttons : 1;
   guint padding : 6;
 };
 
@@ -46,7 +45,6 @@ enum
   PROP_DRIVER,
   PROP_TITLE,
   PROP_COMPLETE,
-  PROP_USE_ARROW_BUTTONS,
   PROP_LAST,
 };
 
@@ -70,9 +68,6 @@ gis_page_get_property (GObject    *object,
     case PROP_COMPLETE:
       g_value_set_boolean (value, page->priv->complete);
       break;
-    case PROP_USE_ARROW_BUTTONS:
-      g_value_set_boolean (value, page->priv->use_arrow_buttons);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -97,9 +92,6 @@ gis_page_set_property (GObject      *object,
     case PROP_COMPLETE:
       page->priv->complete = g_value_get_boolean (value);
       break;
-    case PROP_USE_ARROW_BUTTONS:
-      page->priv->use_arrow_buttons = g_value_get_boolean (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -192,9 +184,6 @@ gis_page_class_init (GisPageClass *klass)
   obj_props[PROP_COMPLETE] =
     g_param_spec_boolean ("complete", "", "", FALSE,
                           G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-  obj_props[PROP_USE_ARROW_BUTTONS] =
-    g_param_spec_boolean ("use-arrow-buttons", "", "", FALSE,
-                          G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
 
   g_object_class_install_properties (object_class, PROP_LAST, obj_props);
 
@@ -236,16 +225,3 @@ gis_page_set_complete (GisPage *page, gboolean complete)
   page->priv->complete = complete;
   g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_COMPLETE]);
 }
-
-gboolean
-gis_page_get_use_arrow_buttons (GisPage *page)
-{
-  return page->priv->use_arrow_buttons;
-}
-
-void
-gis_page_set_use_arrow_buttons (GisPage *page, gboolean use_arrow_buttons)
-{
-  page->priv->use_arrow_buttons = use_arrow_buttons;
-  g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_USE_ARROW_BUTTONS]);
-}
diff --git a/gnome-initial-setup/gis-page.h b/gnome-initial-setup/gis-page.h
index 211fc46..f92a947 100644
--- a/gnome-initial-setup/gis-page.h
+++ b/gnome-initial-setup/gis-page.h
@@ -65,8 +65,6 @@ char *       gis_page_get_title (GisPage *page);
 void         gis_page_set_title (GisPage *page, char *title);
 gboolean     gis_page_get_complete (GisPage *page);
 void         gis_page_set_complete (GisPage *page, gboolean complete);
-gboolean     gis_page_get_use_arrow_buttons (GisPage *page);
-void         gis_page_set_use_arrow_buttons (GisPage *page, gboolean use_arrow_buttons);
 
 G_END_DECLS
 
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c b/gnome-initial-setup/pages/language/gis-language-page.c
index e04c99d..8e451ee 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -308,7 +308,6 @@ gis_language_page_constructed (GObject *object)
                     G_CALLBACK (child_activated), page);
 
   gis_page_set_complete (GIS_PAGE (page), TRUE);
-  gis_page_set_use_arrow_buttons (GIS_PAGE (page), TRUE);
   gis_page_set_title (GIS_PAGE (page), _("Welcome"));
 
   gtk_widget_show (GTK_WIDGET (page));



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