[gnome-panel/wip/applets/clock] clock: add two widgets to ClockLocationEdit
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/applets/clock] clock: add two widgets to ClockLocationEdit
- Date: Sat, 15 Nov 2014 01:52:14 +0000 (UTC)
commit d232b40ce56e17afd591df4c21cb42be1e9332c5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Nov 14 23:04:20 2014 +0200
clock: add two widgets to ClockLocationEdit
applets/clock/clock-location-edit.c | 85 +++++++++++++++++++++++++++------
applets/clock/clock-location-edit.ui | 10 ++--
2 files changed, 73 insertions(+), 22 deletions(-)
---
diff --git a/applets/clock/clock-location-edit.c b/applets/clock/clock-location-edit.c
index 6b91116..8a566b0 100644
--- a/applets/clock/clock-location-edit.c
+++ b/applets/clock/clock-location-edit.c
@@ -25,19 +25,21 @@
struct _ClockLocationEditPrivate
{
- GSettings *settings;
-
- GtkWidget *ok_button;
- GtkWidget *cancel_button;
-
- GtkWidget *name_box;
- GtkWidget *timezone_box;
-
- GtkWidget *latitude_entry;
- GtkWidget *latitude_combo;
-
- GtkWidget *longitude_entry;
- GtkWidget *longitude_combo;
+ GSettings *settings;
+
+ GtkWidget *ok_button;
+ GtkWidget *cancel_button;
+
+ GtkWidget *location_label;
+ GtkWidget *location_box;
+ GWeatherLocationEntry *location_entry;
+ GtkWidget *timezone_label;
+ GtkWidget *timezone_box;
+ GWeatherTimezoneMenu *timezone_combo;
+ GtkWidget *latitude_entry;
+ GtkWidget *latitude_combo;
+ GtkWidget *longitude_entry;
+ GtkWidget *longitude_combo;
};
G_DEFINE_TYPE_WITH_PRIVATE (ClockLocationEdit,
@@ -54,6 +56,52 @@ enum
static GParamSpec *object_properties[N_PROPERTIES] = { NULL, };
static void
+clock_location_edit_setup_widgets (ClockLocationEdit *edit)
+{
+ GWeatherLocation *world;
+ GtkWidget *location_entry;
+ GtkWidget *timezone_combo;
+
+ world = gweather_location_get_world ();
+ location_entry = gweather_location_entry_new (world);
+ timezone_combo = gweather_timezone_menu_new (world);
+
+ gtk_widget_show (location_entry);
+ gtk_widget_show (timezone_combo);
+
+ gtk_container_add (GTK_CONTAINER (edit->priv->location_box),
+ location_entry);
+ gtk_container_add (GTK_CONTAINER (edit->priv->timezone_box),
+ timezone_combo);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (edit->priv->location_label),
+ location_entry);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (edit->priv->timezone_label),
+ timezone_combo);
+
+ edit->priv->location_entry = GWEATHER_LOCATION_ENTRY (location_entry);
+ edit->priv->timezone_combo = GWEATHER_TIMEZONE_MENU (timezone_combo);
+}
+
+static GObject *
+clock_location_edit_constructor (GType type,
+ guint n_properties,
+ GObjectConstructParam *properties)
+{
+ GObject *object;
+ ClockLocationEdit *edit;
+
+ object = G_OBJECT_CLASS (clock_location_edit_parent_class)->constructor (type,
+ n_properties,
+ properties);
+ edit = CLOCK_LOCATION_EDIT (object);
+
+ clock_location_edit_setup_widgets (edit);
+
+ return object;
+}
+
+static void
clock_location_edit_finalize (GObject *object)
{
ClockLocationEdit *edit;
@@ -122,6 +170,7 @@ clock_location_edit_class_init (ClockLocationEditClass *class)
object_class = G_OBJECT_CLASS (class);
widget_class = GTK_WIDGET_CLASS (class);
+ object_class->constructor = clock_location_edit_constructor;
object_class->finalize = clock_location_edit_finalize;
object_class->set_property = clock_location_edit_set_property;
object_class->get_property = clock_location_edit_get_property;
@@ -150,18 +199,22 @@ clock_location_edit_class_init (ClockLocationEditClass *class)
gtk_widget_class_bind_template_child_private (widget_class,
ClockLocationEdit,
- name_box);
+ location_label);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ ClockLocationEdit,
+ location_box);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ ClockLocationEdit,
+ timezone_label);
gtk_widget_class_bind_template_child_private (widget_class,
ClockLocationEdit,
timezone_box);
-
gtk_widget_class_bind_template_child_private (widget_class,
ClockLocationEdit,
latitude_entry);
gtk_widget_class_bind_template_child_private (widget_class,
ClockLocationEdit,
latitude_combo);
-
gtk_widget_class_bind_template_child_private (widget_class,
ClockLocationEdit,
longitude_entry);
diff --git a/applets/clock/clock-location-edit.ui b/applets/clock/clock-location-edit.ui
index cb37e30..3def413 100644
--- a/applets/clock/clock-location-edit.ui
+++ b/applets/clock/clock-location-edit.ui
@@ -63,7 +63,7 @@
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
- <object class="GtkBox" id="name-box">
+ <object class="GtkBox" id="location-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -108,7 +108,6 @@
<object class="GtkComboBox" id="latitude-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="model">liststore2</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
@@ -155,7 +154,6 @@
<object class="GtkComboBox" id="longitude-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="model">liststore1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
@@ -181,7 +179,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="location-name-label">
+ <object class="GtkLabel" id="location-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -200,7 +198,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">L_atitude:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">edit-location-latitude-entry</property>
+ <property name="mnemonic_widget">latitude-entry</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -214,7 +212,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">L_ongitude:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">edit-location-longitude-entry</property>
+ <property name="mnemonic_widget">longitude-entry</property>
</object>
<packing>
<property name="left_attach">0</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]