[gnome-calendar/time-selector] time-selector: implemented time selection with spin buttons
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/time-selector] time-selector: implemented time selection with spin buttons
- Date: Wed, 17 Dec 2014 11:31:32 +0000 (UTC)
commit 5855d9ac9f262ac711c585f18c0c5eecf5cacaf5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Dec 17 09:24:58 2014 -0200
time-selector: implemented time selection with spin buttons
data/Makefile.am | 1 +
data/calendar.gresource.xml | 1 +
data/ui/edit-dialog.ui | 4 +-
data/ui/time-selector.ui | 69 ++++++++
src/Makefile.am | 4 +-
src/gcal-edit-dialog.c | 56 +++---
src/gcal-time-entry.c | 407 -------------------------------------------
src/gcal-time-entry.h | 68 -------
src/gcal-time-selector.c | 211 ++++++++++++++++++++++
src/gcal-time-selector.h | 68 +++++++
10 files changed, 382 insertions(+), 507 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 3cd9e75..3717c19 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -24,6 +24,7 @@ EXTRA_DIST= \
ui/menus.ui \
ui/nav_bar.ui \
ui/new-event.ui \
+ ui/time-selector.ui \
ui/window.ui \
theme/gtk-styles.css \
$(desktop_in_files) \
diff --git a/data/calendar.gresource.xml b/data/calendar.gresource.xml
index 6a85c7b..0ce5b82 100644
--- a/data/calendar.gresource.xml
+++ b/data/calendar.gresource.xml
@@ -4,6 +4,7 @@
<file alias="edit-dialog.ui" compressed="true" preprocess="xml-stripblanks">ui/edit-dialog.ui</file>
<file alias="menus.ui" compressed="true" preprocess="xml-stripblanks">ui/menus.ui</file>
<file alias="nav_bar.ui" compressed="true" preprocess="xml-stripblanks">ui/nav_bar.ui</file>
+ <file alias="time-selector.ui" compressed="true" preprocess="xml-stripblanks">ui/time-selector.ui</file>
<file alias="window.ui" compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
<file alias="gtk-styles.css" compressed="true">theme/gtk-styles.css</file>
</gresource>
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index 3710bce..9544ec7 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -237,7 +237,7 @@
</packing>
</child>
<child>
- <object class="GcalTimeEntry" id="start_time_entry">
+ <object class="GcalTimeSelector" id="start_time_selector">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
@@ -257,7 +257,7 @@
</packing>
</child>
<child>
- <object class="GcalTimeEntry" id="end_time_entry">
+ <object class="GcalTimeSelector" id="end_time_selector">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
diff --git a/data/ui/time-selector.ui b/data/ui/time-selector.ui
new file mode 100644
index 0000000..1e2ab42
--- /dev/null
+++ b/data/ui/time-selector.ui
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkAdjustment" id="hour_adjustment">
+ <property name="upper">23</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">5</property>
+ </object>
+ <object class="GtkAdjustment" id="minute_adjustment">
+ <property name="upper">59</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkSpinButton" id="hour_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0.5</property>
+ <property name="input_purpose">number</property>
+ <property name="orientation">vertical</property>
+ <property name="adjustment">hour_adjustment</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="minute_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0.5</property>
+ <property name="input_purpose">number</property>
+ <property name="orientation">vertical</property>
+ <property name="adjustment">minute_adjustment</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">:</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="period_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index fc42f0d..ab2bdf2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,8 +45,8 @@ gnome_calendar_SOURCES = \
gcal-event-widget.h \
gcal-edit-dialog.c \
gcal-edit-dialog.h \
- gcal-time-entry.c \
- gcal-time-entry.h \
+ gcal-time-selector.c \
+ gcal-time-selector.h \
gcal-date-entry.c \
gcal-date-entry.h \
gcal-manager.c \
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index e4dc308..f80c7ec 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -18,7 +18,7 @@
*/
#include "gcal-edit-dialog.h"
-#include "gcal-time-entry.h"
+#include "gcal-time-selector.h"
#include "gcal-date-entry.h"
#include "gcal-utils.h"
@@ -50,8 +50,8 @@ typedef struct
GtkWidget *start_date_entry;
GtkWidget *end_date_entry;
GtkWidget *all_day_check;
- GtkWidget *start_time_entry;
- GtkWidget *end_time_entry;
+ GtkWidget *start_time_selector;
+ GtkWidget *end_time_selector;
GtkWidget *location_entry;
GtkWidget *notes_text;
@@ -416,7 +416,7 @@ update_time (GtkEntry *entry,
if (icaltime_compare (*start_date, *end_date) > -1)
{
/* change the non-editing entry */
- if (GTK_WIDGET (entry) == priv->start_time_entry)
+ if (GTK_WIDGET (entry) == priv->start_time_selector)
{
end_date->hour = start_date->hour + 1;
end_date->minute = start_date->minute;
@@ -430,22 +430,22 @@ update_time (GtkEntry *entry,
}
/* update the entries with the new sane values */
- g_signal_handlers_block_by_func (priv->start_time_entry,
+ g_signal_handlers_block_by_func (priv->start_time_selector,
update_time,
user_data);
- g_signal_handlers_block_by_func (priv->end_time_entry,
+ g_signal_handlers_block_by_func (priv->end_time_selector,
update_time,
user_data);
/* updates date as well, since hours can change the current date */
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->start_time_entry),
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->start_time_selector),
start_date->hour,
start_date->minute);
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->start_date_entry),
start_date->day,
start_date->month,
start_date->year);
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->end_time_entry),
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->end_time_selector),
end_date->hour,
end_date->minute);
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->end_date_entry),
@@ -453,10 +453,10 @@ update_time (GtkEntry *entry,
end_date->month,
end_date->year);
- g_signal_handlers_unblock_by_func (priv->start_time_entry,
+ g_signal_handlers_unblock_by_func (priv->start_time_selector,
update_time,
user_data);
- g_signal_handlers_unblock_by_func (priv->end_time_entry,
+ g_signal_handlers_unblock_by_func (priv->end_time_selector,
update_date,
user_data);
}
@@ -502,9 +502,9 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, sources_button);
/* Entries */
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, summary_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, start_time_entry);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, start_time_selector);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, start_date_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, end_time_entry);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, end_time_selector);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, end_date_entry);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, location_entry);
/* Other */
@@ -573,12 +573,12 @@ gcal_edit_dialog_constructed (GObject* object)
/* bind all-day check button & time entries */
g_object_bind_property (priv->all_day_check,
"active",
- priv->start_time_entry,
+ priv->start_time_selector,
"sensitive",
G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN);
g_object_bind_property (priv->all_day_check,
"active",
- priv->end_time_entry,
+ priv->end_time_selector,
"sensitive",
G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN);
@@ -636,12 +636,12 @@ gcal_edit_dialog_constructed (GObject* object)
G_CALLBACK (update_date),
object);
- g_signal_connect (priv->start_time_entry,
+ g_signal_connect (priv->start_time_selector,
"modified",
G_CALLBACK (update_time),
object);
- g_signal_connect (priv->end_time_entry,
+ g_signal_connect (priv->end_time_selector,
"modified",
G_CALLBACK (update_time),
object);
@@ -696,14 +696,14 @@ gcal_edit_dialog_set_writable (GcalEditDialog *dialog,
gtk_editable_set_editable (GTK_EDITABLE (priv->summary_entry), writable);
gtk_editable_set_editable (GTK_EDITABLE (priv->start_date_entry), writable);
- gtk_editable_set_editable (GTK_EDITABLE (priv->start_time_entry), writable);
- gtk_editable_set_editable (GTK_EDITABLE (priv->end_time_entry), writable);
- gtk_editable_set_editable (GTK_EDITABLE (priv->end_time_entry), writable);
+ gtk_editable_set_editable (GTK_EDITABLE (priv->end_date_entry), writable);
gtk_editable_set_editable (GTK_EDITABLE (priv->location_entry), writable);
gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->notes_text), writable);
gtk_widget_set_sensitive (priv->all_day_check, writable);
+ gtk_widget_set_sensitive (priv->end_time_selector, writable);
+ gtk_widget_set_sensitive (priv->start_time_selector, writable);
gtk_button_set_label (GTK_BUTTON (priv->done_button),
writable ? _("Save") : _("Done"));
@@ -737,9 +737,9 @@ gcal_edit_dialog_clear_data (GcalEditDialog *dialog)
/* date and time */
gtk_entry_set_text (GTK_ENTRY (priv->start_date_entry), "");
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->start_time_entry), 0, 0);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->start_time_selector), 0, 0);
gtk_entry_set_text (GTK_ENTRY (priv->end_date_entry), "");
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->end_time_entry), 0, 0);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->end_time_selector), 0, 0);
/* location */
g_signal_handlers_block_by_func (priv->location_entry,
@@ -793,8 +793,8 @@ gcal_edit_dialog_all_day_changed (GtkWidget *widget,
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->all_day_check)))
{
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->start_time_entry), 0, 0);
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->end_time_entry), 0, 0);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->start_time_selector), 0, 0);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->end_time_selector), 0, 0);
}
}
@@ -912,7 +912,7 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
dtstart.value->hour = 0;
dtstart.value->minute = 0;
}
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->start_time_entry), dtstart.value->hour,
dtstart.value->minute);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->start_time_selector), dtstart.value->hour,
dtstart.value->minute);
/* end date */
e_cal_component_get_dtend (priv->component, &dtend);
@@ -923,13 +923,13 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
all_day = (dtstart.value->is_date == 1 && dtend.value->is_date == 1);
if (!all_day)
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->end_time_entry), dtend.value->hour,
dtend.value->minute);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->end_time_selector), dtend.value->hour,
dtend.value->minute);
}
else
{
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->end_date_entry),
dtstart.value->day, dtstart.value->month, dtstart.value->year);
- gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->end_time_entry), dtstart.value->hour,
dtstart.value->minute);
+ gcal_time_selector_set_time (GCAL_TIME_SELECTOR (priv->end_time_selector), dtstart.value->hour,
dtstart.value->minute);
all_day = FALSE;
}
@@ -1079,7 +1079,7 @@ gcal_edit_dialog_get_start_date (GcalEditDialog *dialog)
date->year = value3;
value1 = value2 = 0;
- gcal_time_entry_get_time (GCAL_TIME_ENTRY (priv->start_time_entry),
+ gcal_time_selector_get_time (GCAL_TIME_SELECTOR (priv->start_time_selector),
&value1,
&value2);
date->hour = value1;
@@ -1120,7 +1120,7 @@ gcal_edit_dialog_get_end_date (GcalEditDialog *dialog)
date->year = value3;
value1 = value2 = 0;
- gcal_time_entry_get_time (GCAL_TIME_ENTRY (priv->end_time_entry),
+ gcal_time_selector_get_time (GCAL_TIME_SELECTOR (priv->end_time_selector),
&value1,
&value2);
date->hour = value1;
diff --git a/src/gcal-time-selector.c b/src/gcal-time-selector.c
new file mode 100644
index 0000000..14850b0
--- /dev/null
+++ b/src/gcal-time-selector.c
@@ -0,0 +1,211 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * gcal-time-selector.c
+ * Copyright (C) 2012 Erick Pérez Castellanos <erickpc gnome org>
+ * 2014 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * gnome-calendar is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * gnome-calendar is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gcal-time-selector.h"
+
+#include <glib/gi18n.h>
+
+struct _GcalTimeSelectorPrivate
+{
+ GtkWidget *time_label;
+ GtkWidget *popover;
+ GtkWidget *hour_spin;
+ GtkWidget *minute_spin;
+ GtkWidget *period_check;
+
+ gboolean format_24h;
+};
+
+enum
+{
+ MODIFIED,
+ NUM_SIGNALS
+};
+
+static guint signals[NUM_SIGNALS] = { 0, };
+
+static gboolean on_output (GtkSpinButton *button,
+ gpointer user_data);
+
+static void gcal_time_selector_constructed (GObject *object);
+
+G_DEFINE_TYPE_WITH_PRIVATE (GcalTimeSelector, gcal_time_selector, GTK_TYPE_TOGGLE_BUTTON);
+
+static gboolean
+on_output (GtkSpinButton *button,
+ gpointer user_data)
+{
+ gchar *text;
+ gint value;
+
+ value = (gint) gtk_adjustment_get_value (gtk_spin_button_get_adjustment (button));
+ text = g_strdup_printf ("%02d", value);
+ gtk_entry_set_text (GTK_ENTRY (button), text);
+
+ g_free (text);
+
+ return TRUE;
+}
+
+static void
+gcal_time_selector_class_init (GcalTimeSelectorClass *klass)
+{
+ GtkWidgetClass *widget_class;
+ GObjectClass *object_class;
+
+ widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->constructed = gcal_time_selector_constructed;
+
+ signals[MODIFIED] = g_signal_new ("modified",
+ GCAL_TYPE_TIME_SELECTOR,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GcalTimeSelectorClass,
+ modified),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+}
+
+static void
+gcal_time_selector_init (GcalTimeSelector *self)
+{
+ GcalTimeSelectorPrivate *priv;
+
+ priv = gcal_time_selector_get_instance_private (self);
+
+ priv->time_label = NULL;
+ priv->popover = NULL;
+ priv->hour_spin = NULL;
+ priv->minute_spin = NULL;
+}
+
+static void
+gcal_time_selector_constructed (GObject *object)
+{
+ GcalTimeSelectorPrivate *priv;
+ GtkWidget *grid;
+ GtkBuilder *builder;
+
+ GSettings *settings;
+ gchar *clock_format;
+
+ priv = gcal_time_selector_get_instance_private (GCAL_TIME_SELECTOR (object));
+
+ /* chaining up */
+ G_OBJECT_CLASS (gcal_time_selector_parent_class)->constructed (object);
+
+ gtk_widget_set_hexpand (GTK_WIDGET (object), TRUE);
+
+ /* 24h setting */
+ settings = g_settings_new ("org.gnome.desktop.interface");
+ clock_format = g_settings_get_string (settings, "clock-format");
+ priv->format_24h = (g_strcmp0 (clock_format, "24h") == 0);
+
+ g_free (clock_format);
+ g_object_unref (settings);
+
+ /* time label */
+ priv->time_label = gtk_label_new (NULL);
+ gtk_label_set_label (GTK_LABEL (priv->time_label), "00:00");
+ gtk_widget_show (priv->time_label);
+
+ gtk_container_add (GTK_CONTAINER (object), priv->time_label);
+
+ /* popover */
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (builder, "/org/gnome/calendar/time-selector.ui", NULL);
+
+ grid = (GtkWidget*) gtk_builder_get_object (builder, "grid");
+ priv->popover = gtk_popover_new (GTK_WIDGET (object));
+ priv->hour_spin = (GtkWidget*) gtk_builder_get_object (builder, "hour_spin");
+ priv->minute_spin = (GtkWidget*) gtk_builder_get_object (builder, "minute_spin");
+
+ g_object_unref (builder);
+
+ gtk_container_add (GTK_CONTAINER (priv->popover), grid);
+ g_object_bind_property (priv->popover, "visible", object, "active", G_BINDING_BIDIRECTIONAL);
+
+ /* signals */
+ g_signal_connect (priv->hour_spin, "output", G_CALLBACK (on_output), object);
+ g_signal_connect (priv->minute_spin, "output", G_CALLBACK (on_output), object);
+}
+
+/* Public API */
+GtkWidget*
+gcal_time_selector_new (void)
+{
+ return g_object_new (GCAL_TYPE_TIME_SELECTOR, NULL);
+}
+
+void
+gcal_time_selector_set_time (GcalTimeSelector *selector,
+ gint hours,
+ gint minutes)
+{
+ GcalTimeSelectorPrivate *priv;
+ GtkAdjustment *hour_adj;
+ GtkAdjustment *minute_adj;
+ gchar *new_time;
+
+ g_return_if_fail (GCAL_IS_TIME_SELECTOR (selector));
+ priv = gcal_time_selector_get_instance_private (selector);
+ hour_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->hour_spin));
+ minute_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->minute_spin));
+ g_warn_if_fail (hours < 24);
+ g_warn_if_fail (minutes < 60);
+
+ gtk_adjustment_set_value (hour_adj, hours < 24 ? hours : 0);
+ gtk_adjustment_set_value (minute_adj, minutes < 60 ? minutes : 0);
+
+ if (priv->format_24h)
+ {
+ new_time = g_strdup_printf ("%.2d:%.2d", hours, minutes);
+ }
+ else
+ {
+ new_time = g_strdup_printf ("%.2d:%.2d", hours, minutes);
+ }
+
+ gtk_label_set_label (GTK_LABEL (priv->time_label), new_time);
+
+ g_free (new_time);
+}
+
+void
+gcal_time_selector_get_time (GcalTimeSelector *selector,
+ gint *hours,
+ gint *minutes)
+{
+ GcalTimeSelectorPrivate *priv;
+ GtkAdjustment *hour_adj;
+ GtkAdjustment *minute_adj;
+
+ g_return_if_fail (GCAL_IS_TIME_SELECTOR (selector));
+ priv = gcal_time_selector_get_instance_private (selector);
+ hour_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->hour_spin));
+ minute_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->minute_spin));
+
+ *hours = (gint) gtk_adjustment_get_value (hour_adj);
+ *minutes = (gint) gtk_adjustment_get_value (minute_adj);
+}
diff --git a/src/gcal-time-selector.h b/src/gcal-time-selector.h
new file mode 100644
index 0000000..1aeb453
--- /dev/null
+++ b/src/gcal-time-selector.h
@@ -0,0 +1,68 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * gcal-time-selector.h
+ * Copyright (C) 2012 Erick Pérez Castellanos <erickpc gnome org>
+ *
+ * gnome-calendar is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * gnome-calendar is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GCAL_TIME_SELECTOR_H__
+#define __GCAL_TIME_SELECTOR_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GCAL_TYPE_TIME_SELECTOR (gcal_time_selector_get_type ())
+#define GCAL_TIME_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GCAL_TYPE_TIME_SELECTOR,
GcalTimeSelector))
+#define GCAL_TIME_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GCAL_TYPE_TIME_SELECTOR,
GcalTimeSelectorClass))
+#define GCAL_IS_TIME_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GCAL_TYPE_TIME_SELECTOR))
+#define GCAL_IS_TIME_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GCAL_TYPE_TIME_SELECTOR))
+#define GCAL_TIME_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GCAL_TYPE_TIME_SELECTOR,
GcalTimeSelectorClass))
+
+typedef struct _GcalTimeSelector GcalTimeSelector;
+typedef struct _GcalTimeSelectorClass GcalTimeSelectorClass;
+typedef struct _GcalTimeSelectorPrivate GcalTimeSelectorPrivate;
+
+struct _GcalTimeSelector
+{
+ GtkToggleButton parent;
+ /* add your public declarations here */
+
+ GcalTimeSelectorPrivate *priv;
+};
+
+struct _GcalTimeSelectorClass
+{
+ GtkToggleButtonClass parent_class;
+
+ /* signals */
+ void (*modified) (GcalTimeSelector *selector);
+};
+
+GType gcal_time_selector_get_type (void);
+
+GtkWidget* gcal_time_selector_new (void);
+
+void gcal_time_selector_set_time (GcalTimeSelector *selector,
+ gint hours,
+ gint minutes);
+
+void gcal_time_selector_get_time (GcalTimeSelector *selector,
+ gint *hours,
+ gint *minutes);
+
+G_END_DECLS
+
+#endif /* __GCAL_TIME_SELECTOR_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]