}
if (size < (gint64)1048576)
{
- return g_strdup_printf(_("%.1f K"), (gfloat)size / 1024.0);
+ return g_strdup_printf(_("%.1f K"), (double)size / 1024.0);
}
if (size < (gint64)1073741824)
{
- return g_strdup_printf(_("%.1f MB"), (gfloat)size / 1048576.0);
+ return g_strdup_printf(_("%.1f MB"), (double)size / 1048576.0);
}
- /* to avoid overflowing the float, do division in two steps */
- size /= 1048576.0;
- return g_strdup_printf(_("%.1f GB"), (gfloat)size / 1024.0);
+ /* to avoid overflowing the double, do division in two steps */
+ size /= 1048576;
+ return g_strdup_printf(_("%.1f GB"), (double)size / 1024.0);
}
/* note: returned string is valid until next call to text_from_time() */
#define ZOOM_LABEL_WIDTH 64
+#define PAN_PREF_GROUP "pan_view_options"
+#define PAN_PREF_HIDE_WARNING "hide_performance_warning"
+
+
typedef enum {
LAYOUT_TIMELINE = 0,
LAYOUT_FOLDERS_LINEAR,
return TRUE;
}
-void pan_window_new(const gchar *path)
+static void pan_window_new_real(const gchar *path)
{
PanWindow *pw;
GtkWidget *vbox;
pan_window_list = g_list_append(pan_window_list, pw);
}
+/*
+ *-----------------------------------------------------------------------------
+ * peformance warnings
+ *-----------------------------------------------------------------------------
+ */
+
+static void pan_warning_ok_cb(GenericDialog *gd, gpointer data)
+{
+ gchar *path = data;
+
+ generic_dialog_close(gd);
+
+ pan_window_new_real(path);
+ g_free(path);
+}
+
+static void pan_warning_hide_cb(GtkWidget *button, gpointer data)
+{
+ gint hide_dlg;
+
+ hide_dlg = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+ pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, hide_dlg);
+}
+
+static gint pan_warning(const gchar *path)
+{
+ GenericDialog *gd;
+ GtkWidget *box;
+ GtkWidget *group;
+ GtkWidget *button;
+ GtkWidget *ct_button;
+ gint hide_dlg;
+
+ if (enable_thumb_caching &&
+ thumbnail_spec_standard) return FALSE;
+
+ if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, &hide_dlg)) hide_dlg = FALSE;
+ if (hide_dlg) return FALSE;
+
+ gd = generic_dialog_new(_("Pan View Performance"), "GQview", "pan_view_warning", NULL, FALSE,
+ NULL, NULL);
+ gd->data = g_strdup(path);
+ generic_dialog_add_button(gd, GTK_STOCK_OK, NULL,
+ pan_warning_ok_cb, TRUE);
+
+ box = generic_dialog_add_message(gd, GTK_STOCK_DIALOG_INFO,
+ _("Pan view performance may be poor."),
+ _("To improve performance of thumbnails in the pan view the"
+ " following options can be enabled. Note that both options"
+ " must be enabled to notice a change in performance."));
+
+ group = pref_box_new(box, FALSE, GTK_ORIENTATION_HORIZONTAL, 0);
+ pref_spacer(group, PREF_PAD_INDENT);
+ group = pref_box_new(group, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
+
+ ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"),
+ enable_thumb_caching, &enable_thumb_caching);
+ button = pref_checkbox_new_int(group, _("Use shared thumbnail cache"),
+ thumbnail_spec_standard, &thumbnail_spec_standard);
+ pref_checkbox_link_sensitivity(ct_button, button);
+
+ pref_line(box, 0);
+
+ pref_checkbox_new(box, _("Do not show this dialog again"), hide_dlg,
+ G_CALLBACK(pan_warning_hide_cb), NULL);
+
+ gtk_widget_show(gd->dialog);
+
+ return TRUE;
+}
+
+
/*
*-----------------------------------------------------------------------------
* public
*-----------------------------------------------------------------------------
*/
+void pan_window_new(const gchar *path)
+{
+ if (pan_warning(path)) return;
+
+ pan_window_new_real(path);
+}
+
/*
*-----------------------------------------------------------------------------
- * view window menu routines and callbacks
+ * menus
*-----------------------------------------------------------------------------
*/
/*
*-----------------------------------------------------------------------------
- * image drag and drop routines
+ * drag and drop
*-----------------------------------------------------------------------------
*/