[five-or-more/headerbar: 4/5] Use header bar subtitle instead of a statusbar



commit 21797b3e3d99091ec46ffc5e8a3060e819596b7e
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Nov 24 21:38:19 2013 -0600

    Use header bar subtitle instead of a statusbar

 data/five-or-more.ui |   14 --------------
 src/glines.c         |   20 ++++++++------------
 2 files changed, 8 insertions(+), 26 deletions(-)
---
diff --git a/data/five-or-more.ui b/data/five-or-more.ui
index 07a8e18..c379201 100644
--- a/data/five-or-more.ui
+++ b/data/five-or-more.ui
@@ -83,20 +83,6 @@
         <child>
           <placeholder/>
         </child>
-        <child>
-          <object class="GtkStatusbar" id="statusbar">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">2</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">4</property>
-          </packing>
-        </child>
       </object>
     </child>
   </object>
diff --git a/src/glines.c b/src/glines.c
index e10dcec..0b1aea2 100644
--- a/src/glines.c
+++ b/src/glines.c
@@ -95,7 +95,7 @@ static gboolean pref_dialog_done = FALSE;
 static GRand *rgen;
 
 static GtkWidget *draw_area;
-static GtkWidget *app, *statusbar, *pref_dialog, *gridframe;
+static GtkWidget *app, *header_bar, *pref_dialog, *gridframe;
 static GtkWidget *preview_widgets[MAXNPIECES];
 
 static gint window_width = 0, window_height = 0;
@@ -148,13 +148,9 @@ static struct {
 static gchar *warning_message = NULL;
 
 static void
-set_statusbar_message (gchar * message)
+set_status_message (gchar * message)
 {
-  guint context_id;
-  context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar),
-                                             "message");
-  gtk_statusbar_pop (GTK_STATUSBAR (statusbar), context_id);
-  gtk_statusbar_push (GTK_STATUSBAR (statusbar), context_id, message);
+  gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header_bar), message);
 }
 
 static void
@@ -404,7 +400,7 @@ start_game (void)
 {
   char string[20];
 
-  set_statusbar_message (_
+  set_status_message (_
                          ("Match five objects of the same type in a row to score!"));
   refresh_screen ();
   active = -1;
@@ -488,7 +484,7 @@ game_over (void)
 {
   int pos;
 
-  set_statusbar_message (_("Game Over!"));
+  set_status_message (_("Game Over!"));
   pos = games_scores_add_plain_score (highscores, score);
   show_scores (pos);
   return;
@@ -629,7 +625,7 @@ cell_clicked (GtkWidget * widget, int fx, int fy)
 {
   int x, y;
 
-  set_statusbar_message ("");
+  set_status_message (NULL);
   if (field[fx + fy * hfieldsize].color == 0) {
     /* Clicked on an empty field */
 
@@ -645,7 +641,7 @@ cell_clicked (GtkWidget * widget, int fx, int fy)
         set_inmove (1);
       } else {
         /* Can't move there! */
-        set_statusbar_message (_("You can't move there!"));
+        set_status_message (_("You can't move there!"));
         reset_pathsearch ();
         target = -1;
       }
@@ -1632,7 +1628,7 @@ startup_cb (GApplication *application)
   gtk_container_add (GTK_CONTAINER (gridframe), draw_area);
   gtk_box_pack_start (GTK_BOX (vbox), gridframe, TRUE, TRUE, 0);
 
-  statusbar = GTK_WIDGET (gtk_builder_get_object (builder, "statusbar"));
+  header_bar = GTK_WIDGET (gtk_builder_get_object (builder, "header_bar"));
 
   gtk_widget_set_events (draw_area,
                          gtk_widget_get_events (draw_area) |


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