kopia lustrzana https://gitlab.com/Zwarf/picplanner
add date and time selector
rodzic
652bac9e0e
commit
92f4cf2014
|
@ -64,7 +64,7 @@ picplanner_application_activate (GApplication *app)
|
|||
window = g_object_new (PICPLANNER_TYPE_WINDOW,
|
||||
"application", app,
|
||||
"default-width", 600,
|
||||
"default-height", 300,
|
||||
"default-height", 800,
|
||||
NULL);
|
||||
|
||||
/* Ask the window manager/compositor to present the window. */
|
||||
|
|
|
@ -5,6 +5,7 @@ struct _PicplannerOverview
|
|||
{
|
||||
GtkBox parent_instance;
|
||||
GtkWidget parent;
|
||||
GtkWidget spin_button_hour;
|
||||
|
||||
};
|
||||
|
||||
|
@ -12,7 +13,7 @@ G_DEFINE_TYPE (PicplannerOverview, picplanner_overview, GTK_TYPE_BOX)
|
|||
|
||||
static void
|
||||
coordinate_entry_changed (GtkWidget *self,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
(void) self;
|
||||
(void) user_data;
|
||||
|
@ -20,6 +21,25 @@ coordinate_entry_changed (GtkWidget *self,
|
|||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
time_changed (GtkSpinButton *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
(void) user_data;
|
||||
GtkAdjustment *adjustment;
|
||||
char *button_text;
|
||||
int value;
|
||||
adjustment = gtk_spin_button_get_adjustment (self);
|
||||
value = (int)gtk_adjustment_get_value (adjustment);
|
||||
button_text = g_strdup_printf ("%02d", value);
|
||||
gtk_editable_set_text (GTK_EDITABLE (self), button_text);
|
||||
g_print("%s\n", button_text);
|
||||
g_free (button_text);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
picplanner_overview_init (PicplannerOverview *self)
|
||||
{
|
||||
|
@ -33,6 +53,7 @@ picplanner_overview_class_init (PicplannerOverviewClass *class)
|
|||
"/de/zwarf/picplanner/ui/overview-view.ui");
|
||||
|
||||
gtk_widget_class_bind_template_callback (class, coordinate_entry_changed);
|
||||
gtk_widget_class_bind_template_callback (class, time_changed);
|
||||
}
|
||||
|
||||
PicplannerOverview *
|
||||
|
|
|
@ -1,5 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
|
||||
<object class="GtkAdjustment" id="d_adjustment">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">31</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="h_adjustment">
|
||||
<property name="upper">23</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="m_adjustment">
|
||||
<property name="upper">59</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="y_adjustment">
|
||||
<property name="lower">2000</property>
|
||||
<property name="upper">2100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkPopover" id="calendar_popover">
|
||||
<child>
|
||||
<object class="GtkCalendar">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
<template class="PicplannerOverview" parent="GtkBox">
|
||||
<property name="hexpand">True</property>
|
||||
<property name="halign">fill</property>
|
||||
|
@ -25,6 +57,7 @@
|
|||
<object class="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="halign">center</property>
|
||||
|
||||
<child>
|
||||
|
@ -57,10 +90,60 @@
|
|||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="halign">center</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="calendar_button">
|
||||
<property name="label">Date</property>
|
||||
<property name="popover">calendar_popover</property>
|
||||
<property name="margin-end">15</property>
|
||||
<property name="vexpand">false</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="spin_button_hour">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">h_adjustment</property>
|
||||
<property name="numeric">false</property>
|
||||
<property name="wrap">true</property>
|
||||
<property name="value">8</property>
|
||||
<signal name="output" handler="time_changed"/>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin_start">5</property>
|
||||
<property name="margin_end">5</property>
|
||||
<property name="label">∶</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="entry_min">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">m_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="wrap">True</property>
|
||||
<signal name="output" handler="time_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue