parent
8c29ca63f9
commit
e755daf539
|
@ -1,4 +1,4 @@
|
|||
libhedera (1.0-13) stable; urgency=low
|
||||
libhedera (1.0-12) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -109,18 +109,12 @@ static GDateTime * vn_date_chooser_get_datetime (VnDateChooser * obj)
|
|||
guint year, month, day, hour = 0, minute = 0;
|
||||
gdouble second = 0.0;
|
||||
|
||||
if (obj->show_date)
|
||||
{
|
||||
gtk_calendar_get_date (obj->calendar, &year, &month, &day);
|
||||
month++;
|
||||
}
|
||||
|
||||
if (obj->show_time)
|
||||
{
|
||||
hour = (guint) gtk_adjustment_get_value (obj->hour);
|
||||
minute = (guint) gtk_adjustment_get_value (obj->minute);
|
||||
second = gtk_adjustment_get_value (obj->second);
|
||||
}
|
||||
|
||||
return g_date_time_new_local (year, month, day, hour, minute, second);
|
||||
}
|
||||
|
@ -257,8 +251,6 @@ static void vn_date_chooser_on_toggled (GtkToggleButton * button, VnDateChooser
|
|||
// Set the date/time on the calendar
|
||||
|
||||
if (obj->datetime)
|
||||
{
|
||||
if (obj->show_date)
|
||||
{
|
||||
gtk_calendar_select_month (obj->calendar
|
||||
,g_date_time_get_month (obj->datetime) - 1
|
||||
|
@ -266,18 +258,13 @@ static void vn_date_chooser_on_toggled (GtkToggleButton * button, VnDateChooser
|
|||
);
|
||||
gtk_calendar_select_day (obj->calendar,
|
||||
g_date_time_get_day_of_month (obj->datetime));
|
||||
}
|
||||
|
||||
if (obj->show_time)
|
||||
{
|
||||
gtk_adjustment_set_value (obj->hour,
|
||||
g_date_time_get_hour (obj->datetime));
|
||||
gtk_adjustment_set_value (obj->minute,
|
||||
g_date_time_get_minute (obj->datetime));
|
||||
gtk_adjustment_set_value (obj->second,
|
||||
g_date_time_get_second (obj->datetime));
|
||||
gtk_widget_set_no_show_all (GTK_WIDGET (obj->time), obj->show_time);
|
||||
}
|
||||
}
|
||||
else
|
||||
gtk_calendar_select_day (obj->calendar, 0);
|
||||
|
@ -286,11 +273,17 @@ static void vn_date_chooser_on_toggled (GtkToggleButton * button, VnDateChooser
|
|||
|
||||
if (!obj->show_date)
|
||||
gtk_widget_hide (GTK_WIDGET (obj->calendar));
|
||||
|
||||
if (!obj->show_time)
|
||||
gtk_widget_hide (GTK_WIDGET (obj->time));
|
||||
gtk_widget_hide (obj->time);
|
||||
|
||||
gtk_widget_set_no_show_all (GTK_WIDGET (obj->calendar), !obj->show_date);
|
||||
gtk_widget_set_no_show_all (GTK_WIDGET (obj->time), !obj->show_time);
|
||||
gtk_widget_set_no_show_all (obj->time, !obj->show_time);
|
||||
|
||||
gtk_widget_get_preferred_width (obj->box, &x, NULL);
|
||||
gtk_widget_get_preferred_height (obj->box, &y, NULL);
|
||||
|
||||
gtk_window_resize (GTK_WINDOW (obj->popup), x, y);
|
||||
|
||||
// Setting the position of the popup
|
||||
|
||||
|
@ -306,7 +299,6 @@ static void vn_date_chooser_on_toggled (GtkToggleButton * button, VnDateChooser
|
|||
gdk_screen_get_monitor_geometry (screen,
|
||||
gdk_screen_get_monitor_at_point (screen, x, y), &monitor);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (obj->calendar));
|
||||
gtk_widget_get_preferred_size (obj->popup, &req, NULL);
|
||||
|
||||
if (y - monitor.y > monitor.height)
|
||||
|
@ -430,16 +422,12 @@ static void vn_date_chooser_init (VnDateChooser * obj)
|
|||
obj->device = NULL;
|
||||
obj->datetime = NULL;
|
||||
|
||||
obj->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
|
||||
gtk_container_add (GTK_CONTAINER (obj), GTK_WIDGET (obj->box));
|
||||
VN_FIELD (obj)->field = obj->box;
|
||||
|
||||
obj->button = gtk_toggle_button_new ();
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (obj->button), _("Change date"));
|
||||
g_signal_connect (obj->button, "toggled",
|
||||
G_CALLBACK (vn_date_chooser_on_toggled), obj);
|
||||
gtk_box_pack_start (GTK_BOX (obj->box),
|
||||
GTK_WIDGET (obj->button), TRUE, TRUE, 0);
|
||||
VN_FIELD (obj)->field = obj->button;
|
||||
gtk_container_add (GTK_CONTAINER (obj), GTK_WIDGET (obj->button));
|
||||
g_object_set (obj->button, "relief", GTK_RELIEF_HALF, NULL);
|
||||
|
||||
obj->label = GTK_LABEL (gtk_label_new (NULL));
|
||||
|
@ -462,8 +450,8 @@ static void vn_date_chooser_init (VnDateChooser * obj)
|
|||
obj->second = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "second"));
|
||||
obj->time = GTK_WIDGET (gtk_builder_get_object (builder, "time"));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (obj->popup),
|
||||
GTK_WIDGET (gtk_builder_get_object (builder, "box")));
|
||||
obj->box = GTK_WIDGET (gtk_builder_get_object (builder, "box"));
|
||||
gtk_container_add (GTK_CONTAINER (obj->popup), obj->box);
|
||||
}
|
||||
|
||||
static void vn_date_chooser_finalize (VnDateChooser * obj)
|
||||
|
|
|
@ -36,9 +36,9 @@ struct _VnDateChooser
|
|||
gchar * format;
|
||||
gboolean show_time;
|
||||
gboolean show_date;
|
||||
GtkWidget * box;
|
||||
GtkLabel * label;
|
||||
GtkWidget * popup;
|
||||
GtkWidget * box;
|
||||
GtkWidget * button;
|
||||
GdkDevice * device;
|
||||
GtkCalendar * calendar;
|
||||
|
|
Reference in New Issue