/*
- * (SLIK) SimpLIstic sKin functions
- * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: John Ellis
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include "history_list.h"
+#include <langinfo.h>
/*
*-----------------------------------------------------------------------------
G_CALLBACK(pref_spin_int_cb), value_var);
}
-#if 0
-void pref_spin_set_blocking(GtkWidget *spin, gdouble value, gpointer block_data)
-{
- g_signal_handlers_block_matched(G_OBJECT(spin), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, block_data);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), value);
- g_signal_handlers_unblock_matched(G_OBJECT(spin), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, block_data);
-}
-#endif
-
static void pref_link_sensitivity_cb(GtkWidget *watch, GtkStateType prev_state, gpointer data)
{
GtkWidget *widget = data;
return button;
}
-#if 0
-static GtkWidget *pref_table_checkbox(GtkWidget *table, gint column, gint row,
- const gchar *text, gint active,
- GCallback func, gpointer data)
-{
- GtkWidget *button;
-
- button = gtk_check_button_new_with_label(text);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active);
- if (func) g_signal_connect(G_OBJECT(button), "clicked", func, data);
-
- gtk_table_attach(GTK_TABLE(table), button, column, column + 1, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show(button);
-
- return button;
-}
-#endif
-
GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
const gchar *text, const gchar *suffix,
gdouble min, gdouble max, gdouble step, gint digits,
GtkWidget *pref_toolbar_new(GtkWidget *parent_box, GtkToolbarStyle style)
{
GtkWidget *tbar;
-
+
tbar = gtk_toolbar_new();
gtk_toolbar_set_style(GTK_TOOLBAR(tbar), style);
gtk_widget_get_allocation(ds->button, &button_allocation);
gtk_widget_get_allocation(ds->window, &window_allocation);
-
+
x = wx + button_allocation.x + button_allocation.width - window_allocation.width;
y = wy + button_allocation.y + button_allocation.height;
GtkWidget *arrow;
ds = g_new0(DateSelection, 1);
+ gchar *date_format;
+ gint i;
ds->box = gtk_hbox_new(FALSE, 2);
g_signal_connect(G_OBJECT(ds->box), "destroy",
G_CALLBACK(date_selection_destroy_cb), ds);
- /* FIXME: use option menu with text format of month instead of a spin button */
- ds->spin_m = pref_spin_new(ds->box, NULL, NULL, 1, 12, 1, 0, 1, NULL, NULL);
- ds->spin_d = pref_spin_new(ds->box, NULL, NULL, 1, 31, 1, 0, 1, NULL, NULL);
- ds->spin_y = pref_spin_new(ds->box, NULL, NULL, 1900, 9999, 1, 0, 1900, NULL, NULL);
+ date_format = nl_langinfo(D_FMT);
+
+ if (strlen(date_format) == 8)
+ {
+ for (i=1; i<8; i=i+3)
+ {
+ switch (date_format[i])
+ {
+ case 'd':
+ ds->spin_d = pref_spin_new(ds->box, NULL, NULL, 1, 31, 1, 0, 1, NULL, NULL);
+ break;
+ case 'm':
+ ds->spin_m = pref_spin_new(ds->box, NULL, NULL, 1, 12, 1, 0, 1, NULL, NULL);
+ break;
+ case 'y': case 'Y':
+ ds->spin_y = pref_spin_new(ds->box, NULL, NULL, 1900, 9999, 1, 0, 1900, NULL, NULL);
+ break;
+ default:
+ DEBUG_0("Date locale %s is unknown", date_format);
+ break;
+ }
+ }
+ }
+ else
+ {
+ ds->spin_m = pref_spin_new(ds->box, NULL, NULL, 1, 12, 1, 0, 1, NULL, NULL);
+ ds->spin_d = pref_spin_new(ds->box, NULL, NULL, 1, 31, 1, 0, 1, NULL, NULL);
+ ds->spin_y = pref_spin_new(ds->box, NULL, NULL, 1900, 9999, 1, 0, 1900, NULL, NULL);
+ }
+
spin_increase(ds->spin_y, 5);
ds->button = gtk_toggle_button_new();
return handle_size;
}
-static gboolean sizer_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
+static gboolean sizer_motion_cb(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
SizerData *sd = data;
gint x, y;
if (!sd->in_drag) return FALSE;
- x = sd->press_x - bevent->x_root;
- y = sd->press_y - bevent->y_root;
+ x = sd->press_x - event->x_root;
+ y = sd->press_y - event->y_root;
w = sd->press_width;
h = sd->press_height;