[PATCH 1/3] Rename the SpokeWindow's back button to just button.

Chris Lumens clumens at redhat.com
Wed Sep 12 19:15:30 UTC 2012


This also changes the back-signal to button-signal.  This is prep work for
allowing individual spokes to relabel the button if they so choose.
---
 pyanaconda/ui/gui/spokes/custom.glade         |  2 +-
 pyanaconda/ui/gui/spokes/datetime_spoke.glade |  2 +-
 pyanaconda/ui/gui/spokes/keyboard.glade       |  2 +-
 pyanaconda/ui/gui/spokes/network.glade        |  2 +-
 pyanaconda/ui/gui/spokes/password.glade       |  2 +-
 pyanaconda/ui/gui/spokes/software.glade       |  2 +-
 pyanaconda/ui/gui/spokes/software.py          |  2 +-
 pyanaconda/ui/gui/spokes/source.glade         |  2 +-
 pyanaconda/ui/gui/spokes/storage.glade        |  2 +-
 pyanaconda/ui/gui/spokes/welcome.glade        |  2 +-
 widgets/src/SpokeWindow.c                     | 52 ++++++++++++++-------------
 widgets/src/SpokeWindow.h                     |  6 ++--
 12 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index 2494be3..b43b2c5 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -314,7 +314,7 @@ all of the data on %s?</property>
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
     <property name="window_name">MANUAL PARTITIONING</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <signal name="info-bar-clicked" handler="on_info_bar_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
index cdf1cf5..4731d92 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
@@ -29,7 +29,7 @@
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
     <property name="window_name">DATE &amp; TIME</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
         <property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/keyboard.glade b/pyanaconda/ui/gui/spokes/keyboard.glade
index e0c0888..34834be 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.glade
+++ b/pyanaconda/ui/gui/spokes/keyboard.glade
@@ -186,7 +186,7 @@
     <property name="mnemonics_visible">False</property>
     <property name="focus_visible">False</property>
     <property name="window_name">KEYBOARD LAYOUT</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
         <property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/network.glade b/pyanaconda/ui/gui/spokes/network.glade
index 88b0d7c..602e3b9 100644
--- a/pyanaconda/ui/gui/spokes/network.glade
+++ b/pyanaconda/ui/gui/spokes/network.glade
@@ -104,7 +104,7 @@ updates available for you.</property>
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
     <property name="window_name">NETWORK CONFIGURATION</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
         <property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/password.glade b/pyanaconda/ui/gui/spokes/password.glade
index 38c21a8..23b0c73 100644
--- a/pyanaconda/ui/gui/spokes/password.glade
+++ b/pyanaconda/ui/gui/spokes/password.glade
@@ -7,7 +7,7 @@
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
     <property name="window_name">ROOT PASSWORD</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
         <property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/software.glade b/pyanaconda/ui/gui/spokes/software.glade
index e2200ca..d123d21 100644
--- a/pyanaconda/ui/gui/spokes/software.glade
+++ b/pyanaconda/ui/gui/spokes/software.glade
@@ -27,7 +27,7 @@
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
     <property name="window_name">SOFTWARE SELECTION</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <signal name="info-bar-clicked" handler="on_info_bar_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index e61b961..ae837f4 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -302,4 +302,4 @@ class SoftwareSelectionSpoke(NormalSpoke):
         elif rc == 3:
             # Send the user to the installation source spoke.
             self.skipTo = "SourceSpoke"
-            self.window.emit("back-clicked")
+            self.window.emit("button-clicked")
diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index 5259431..be0faaa 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -850,7 +850,7 @@ TeXlive 2012 repository</col>
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
     <property name="window_name">INSTALLATION SOURCE</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
         <property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 28fe2d3..981f6b4 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -628,7 +628,7 @@
     <property name="startup_id">filler</property>
     <property name="mnemonics_visible">False</property>
     <property name="window_name">INSTALLATION DESTINATION</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <signal name="info-bar-clicked" handler="on_info_bar_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
diff --git a/pyanaconda/ui/gui/spokes/welcome.glade b/pyanaconda/ui/gui/spokes/welcome.glade
index a0c361b..c69ffab 100644
--- a/pyanaconda/ui/gui/spokes/welcome.glade
+++ b/pyanaconda/ui/gui/spokes/welcome.glade
@@ -130,7 +130,7 @@
     <property name="startup_id">filler</property>
     <property name="can_focus">False</property>
     <property name="startup_id">filler</property>
-    <signal name="back-clicked" handler="on_back_clicked" swapped="no"/>
+    <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
         <property name="can_focus">False</property>
diff --git a/widgets/src/SpokeWindow.c b/widgets/src/SpokeWindow.c
index c526418..e39f5a1 100644
--- a/widgets/src/SpokeWindow.c
+++ b/widgets/src/SpokeWindow.c
@@ -33,48 +33,52 @@
  * The window consists of two areas:
  *
  * - A navigation area in the top of the screen, inherited from #AnacondaBaseWindow
- *   and augmented with a back button.
+ *   and augmented with a button in the upper left corner.
  *
  * - An action area in the rest of the screen, taking up a majority of the
  *   space.  This is where widgets will be added and the user will do things.
  */
 
 enum {
-    SIGNAL_BACK_CLICKED,
+    SIGNAL_BUTTON_CLICKED,
     LAST_SIGNAL
 };
 
+#define DEFAULT_BUTTON_TEXT _("Back")
+
 static guint window_signals[LAST_SIGNAL] = { 0 };
 
 struct _AnacondaSpokeWindowPrivate {
-    GtkWidget  *back_button;
+    GtkWidget  *button;
 };
 
-static void anaconda_spoke_window_back_clicked(GtkButton *button,
-                                               AnacondaSpokeWindow *win);
+static void anaconda_spoke_window_button_clicked(GtkButton *button,
+                                                 AnacondaSpokeWindow *win);
 
 G_DEFINE_TYPE(AnacondaSpokeWindow, anaconda_spoke_window, ANACONDA_TYPE_BASE_WINDOW)
 
 static void anaconda_spoke_window_class_init(AnacondaSpokeWindowClass *klass) {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
-    klass->back_clicked = NULL;
+    klass->button_clicked = NULL;
 
     /**
-     * AnacondaSpokeWindow::back-clicked:
+     * AnacondaSpokeWindow::button-clicked:
      * @window: the window that received the signal
      *
-     * Emitted when the back button has been activated (pressed and released).
+     * Emitted when the button in the upper left corner has been activated
+     * (pressed and released).  This is commonly the button that takes the user
+     * back to the hub, but could do other things.
      *
      * Since: 1.0
      */
-    window_signals[SIGNAL_BACK_CLICKED] = g_signal_new("back-clicked",
-                                                       G_TYPE_FROM_CLASS(object_class),
-                                                       G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
-                                                       G_STRUCT_OFFSET(AnacondaSpokeWindowClass, back_clicked),
-                                                       NULL, NULL,
-                                                       g_cclosure_marshal_VOID__VOID,
-                                                       G_TYPE_NONE, 0);
+    window_signals[SIGNAL_BUTTON_CLICKED] = g_signal_new("button-clicked",
+                                                         G_TYPE_FROM_CLASS(object_class),
+                                                         G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                                                         G_STRUCT_OFFSET(AnacondaSpokeWindowClass, button_clicked),
+                                                         NULL, NULL,
+                                                         g_cclosure_marshal_VOID__VOID,
+                                                         G_TYPE_NONE, 0);
 
     g_type_class_add_private(object_class, sizeof(AnacondaSpokeWindowPrivate));
 }
@@ -103,21 +107,21 @@ static void anaconda_spoke_window_init(AnacondaSpokeWindow *win) {
     gtk_window_set_modal(GTK_WINDOW(win), TRUE);
 
     /* Create the buttons. */
-    win->priv->back_button = gtk_button_new_with_mnemonic(_("_Back"));
-    gtk_widget_set_halign(win->priv->back_button, GTK_ALIGN_START);
+    win->priv->button = gtk_button_new_with_mnemonic(DEFAULT_BUTTON_TEXT);
+    gtk_widget_set_halign(win->priv->button, GTK_ALIGN_START);
 
     /* Hook up some signals for that button.  The signal handlers here will
      * just raise our own custom signals for the whole window.
      */
-    g_signal_connect(win->priv->back_button, "clicked",
-                     G_CALLBACK(anaconda_spoke_window_back_clicked), win);
+    g_signal_connect(win->priv->button, "clicked",
+                     G_CALLBACK(anaconda_spoke_window_button_clicked), win);
 
-    /* And then put the back button into the navigation area. */
+    /* And then put the button into the navigation area. */
     nav_area = anaconda_base_window_get_nav_area(ANACONDA_BASE_WINDOW(win));
-    gtk_grid_attach(GTK_GRID(nav_area), win->priv->back_button, 0, 1, 1, 1);
+    gtk_grid_attach(GTK_GRID(nav_area), win->priv->button, 0, 1, 1, 1);
 }
 
-static void anaconda_spoke_window_back_clicked(GtkButton *button,
-                                               AnacondaSpokeWindow *win) {
-    g_signal_emit(win, window_signals[SIGNAL_BACK_CLICKED], 0);
+static void anaconda_spoke_window_button_clicked(GtkButton *button,
+                                                 AnacondaSpokeWindow *win) {
+    g_signal_emit(win, window_signals[SIGNAL_BUTTON_CLICKED], 0);
 }
diff --git a/widgets/src/SpokeWindow.h b/widgets/src/SpokeWindow.h
index b6e1739..0c388d3 100644
--- a/widgets/src/SpokeWindow.h
+++ b/widgets/src/SpokeWindow.h
@@ -56,13 +56,13 @@ struct _AnacondaSpokeWindow {
  *                the widget class structure in order for the class mechanism
  *                to work correctly.  This allows an AnacondaSpokeWindowClass
  *                pointer to be cast to an #AnacondaBaseWindow pointer.
- * @back_clicked: Function pointer called when the #AnacondaSpokeWindow::back-clicked
- *                signal is emitted.
+ * @button_clicked: Function pointer called when the #AnacondaSpokeWindow::button-clicked
+ *                  signal is emitted.
  */
 struct _AnacondaSpokeWindowClass {
     AnacondaBaseWindowClass parent_class;
 
-    void (* back_clicked)  (AnacondaSpokeWindow *window);
+    void (* button_clicked)  (AnacondaSpokeWindow *window);
 };
 
 GType       anaconda_spoke_window_get_type (void);
-- 
1.7.11.2



More information about the anaconda-patches mailing list