[cheese] Change titlebar to use GtkHeaderBar
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Change titlebar to use GtkHeaderBar
- Date: Sat, 9 Nov 2013 09:38:36 +0000 (UTC)
commit 42a02433280494dc822d6cfd0dd714497f60b46e
Author: Rashi Aswani <aswanirashi19 gmail com>
Date: Sat Nov 9 05:18:02 2013 +0530
Change titlebar to use GtkHeaderBar
https://wiki.gnome.org/GnomeGoals/HeaderBars
https://bugzilla.gnome.org/show_bug.cgi?id=711714
data/cheese-main-window.ui | 11 ++++++++++-
src/cheese-window.vala | 10 ++++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/data/cheese-main-window.ui b/data/cheese-main-window.ui
index df901cd..b9be263 100644
--- a/data/cheese-main-window.ui
+++ b/data/cheese-main-window.ui
@@ -1,6 +1,15 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="3.6"/>
+ <requires lib="gtk+" version="3.10"/>
+ <object class ="GtkHeaderBar" id="header-bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Take a photo</property>
+ <property name="show-close-button">True</property>
+ <style>
+ <class name="titlebar"/>
+ </style>
+ </object>
<object class="GtkBox" id="mainbox_normal">
<property name="orientation">vertical</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 38d7d74..cd89b56 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -47,6 +47,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
private Gtk.Builder gtk_builder;
private Clutter.Script clutter_builder;
+ private Gtk.HeaderBar header_bar;
private GLib.Settings settings;
private Gtk.Widget thumbnails;
@@ -776,6 +777,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
take_action_button_image.set_from_icon_name ("media-playback-stop-symbolic", Gtk.IconSize.BUTTON);
this.is_recording = true;
this.disable_mode_change ();
+ header_bar.set_title (_("Stop Recording"));
}
else
{
@@ -791,6 +793,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
take_action_button_image.set_from_icon_name ("camera-web-symbolic", Gtk.IconSize.BUTTON);
this.is_recording = false;
this.enable_mode_change ();
+ header_bar.set_title (_("Record a video"));
}
}
@@ -823,6 +826,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
this.disable_mode_change ();
// FIXME: Set the effects action to be inactive.
take_action_button.tooltip_text = _("Stop taking pictures");
+ header_bar.set_title (_("Stop taking pictures"));
burst_take_photo ();
/* Use the countdown duration if it is greater than the burst delay, plus
@@ -846,6 +850,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
is_bursting = false;
this.enable_mode_change ();
take_action_button.tooltip_text = _("Take multiple photos");
+ header_bar.set_title (_("Take multiple photos"));
burst_count = 0;
fileutil.reset_burst ();
GLib.Source.remove (burst_callback_id);
@@ -1208,6 +1213,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
effects_toggle_button = gtk_builder.get_object ("effects_toggle_button") as Gtk.ToggleButton;
leave_fullscreen_button = gtk_builder.get_object ("leave_fullscreen_button") as Gtk.Button;
buttons_area = gtk_builder.get_object ("buttons_area") as Gtk.Widget;
+ header_bar = gtk_builder.get_object ("header-bar") as Gtk.HeaderBar;
/* Array contains all 'buttons', for easier manipulation
* IMPORTANT: IF ANOTHER BUTTON IS ADDED UNDER THE VIEWPORT, ADD IT TO THIS ARRAY */
@@ -1257,6 +1263,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
this.add (main_vbox);
main_vbox.show_all ();
+ this.set_titlebar(header_bar);
/* needed for the sizing tricks in set_wide_mode (allocation is 0
* if the widget is not realized */
@@ -1301,16 +1308,19 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
{
case MediaMode.PHOTO:
take_action_button.tooltip_text = _("Take a photo using a webcam");
+ header_bar.set_title (_("Take a photo"));
break;
case MediaMode.VIDEO:
take_action_button.tooltip_text = _("Record a video using a webcam");
+ header_bar.set_title (_("Record a video"));
timeout_layer.text = "00:00:00";
timeout_layer.show ();
break;
case MediaMode.BURST:
take_action_button.tooltip_text = _("Take multiple photos using a webcam");
+ header_bar.set_title (_("Take multiple photos"));
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]