1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Copyright (C) 2008 Philip Withnall <philip@tecnocode.co.uk>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
* The Totem project hereby grant permission for non-gpl compatible GStreamer
20
* plugins to be used and distributed together with GStreamer and Totem. This
21
* permission are above and beyond the permissions granted by the GPL license
22
* Totem is covered by.
24
* Monday 7th February 2005: Christian Schaller: Add excemption clause.
25
* See license_change file for details.
27
* Author: Philip Withnall <philip@tecnocode.co.uk>
33
#include "video-utils.h"
34
#include "totem-time-entry.h"
36
static gboolean output_cb (GtkSpinButton *self, gpointer user_data);
37
static gint input_cb (GtkSpinButton *self, gdouble *new_value, gpointer user_data);
39
G_DEFINE_TYPE (TotemTimeEntry, totem_time_entry, GTK_TYPE_SPIN_BUTTON)
42
totem_time_entry_class_init (TotemTimeEntryClass *klass)
44
/* Nothing to see here; please move along */
48
totem_time_entry_init (TotemTimeEntry *self)
50
/* Connect to signals */
51
g_signal_connect (self, "output", G_CALLBACK (output_cb), NULL);
52
g_signal_connect (self, "input", G_CALLBACK (input_cb), NULL);
56
totem_time_entry_new (GtkAdjustment *adjustment, gdouble climb_rate)
58
return g_object_new (TOTEM_TYPE_TIME_ENTRY,
59
"adjustment", adjustment,
60
"climb-rate", climb_rate,
67
output_cb (GtkSpinButton *self, gpointer user_data)
71
text = totem_time_to_string ((gint64) gtk_spin_button_get_value (self) * 1000);
72
gtk_entry_set_text (GTK_ENTRY (self), text);
79
input_cb (GtkSpinButton *self, gdouble *new_value, gpointer user_data)
83
val = totem_string_to_time (gtk_entry_get_text (GTK_ENTRY (self)));
85
return GTK_INPUT_ERROR;
87
*new_value = val / 1000;