[gnome-font-viewer] Make headerbar as titlebar and add close button



commit 836e7309fd3327c6079f0cd134454a890207cf48
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Tue Aug 13 04:33:32 2013 +0300

    Make headerbar as titlebar and add close button
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705872
    
    Signed-off-by: Yosef Or Boczko <yoseforb gmail com>

 src/font-view.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index e287692..9cbdef0 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -776,8 +776,12 @@ font_view_application_startup (GApplication *application)
     self->main_window = window = gtk_application_window_new (GTK_APPLICATION (application));
     gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
     gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
-    gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE);
-    gtk_window_set_title (GTK_WINDOW (window), _("Font Viewer"));
+
+    self->header = gtk_header_bar_new ();
+    gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->header), TRUE);
+    gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self->header)),
+                                 "titlebar");
+    gtk_window_set_titlebar (GTK_WINDOW (self->main_window), self->header);
 
     g_signal_connect (window, "key-press-event",
                       G_CALLBACK (font_view_window_key_press_event_cb), self);
@@ -785,9 +789,6 @@ font_view_application_startup (GApplication *application)
     self->main_grid = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_container_add (GTK_CONTAINER (self->main_window), self->main_grid);
 
-    self->header = gtk_header_bar_new ();
-    gtk_container_add (GTK_CONTAINER (self->main_grid), self->header);
-
     self->stack = gtk_stack_new ();
     gtk_stack_set_transition_type (GTK_STACK (self->stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
     gtk_container_add (GTK_CONTAINER (self->main_grid), self->stack);


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