summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-12-13 12:05:34 +0100
committerraveit65 <[email protected]>2022-01-29 14:15:50 +0100
commit3664a2d2a6d2f18aaeadd355f2ae0bbf91b8a9c1 (patch)
treed97ee213fe891cbb579b5f8a3e13a56752a8965a /src
parentd2a04c51cf8ee50a390248192fdfb9a427bec6a3 (diff)
downloadengrampa-3664a2d2a6d2f18aaeadd355f2ae0bbf91b8a9c1.tar.bz2
engrampa-3664a2d2a6d2f18aaeadd355f2ae0bbf91b8a9c1.tar.xz
Fix some -Wfloat-conversion warnings
Diffstat (limited to 'src')
-rw-r--r--src/dlg-batch-add.c7
-rw-r--r--src/dlg-new.c14
-rw-r--r--src/eggtreemultidnd.c14
-rw-r--r--src/fr-window.c10
4 files changed, 25 insertions, 20 deletions
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c
index 2e36726..7d78e65 100644
--- a/src/dlg-batch-add.c
+++ b/src/dlg-batch-add.c
@@ -114,7 +114,7 @@ set_archive_options (DialogData *data)
int size;
value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")));
- size = floor (value * MEGABYTE);
+ size = (int) (value * MEGABYTE);
g_settings_set_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE, size);
fr_window_set_volume_size (data->window, (guint) size);
}
@@ -464,6 +464,7 @@ dlg_batch_add_files (FrWindow *window,
const char *first_filename;
char *parent;
int i;
+ int size;
if (file_list == NULL)
return;
@@ -481,7 +482,9 @@ dlg_batch_add_files (FrWindow *window,
gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander")), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
gtk_toggle_button_set_active (GET_TOGGLE_BUTTON ("a_encrypt_header_checkbutton"), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")), g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
+ size = g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")),
+ ((gdouble) size) / MEGABYTE);
first_filename = (char*) file_list->data;
parent = remove_level_from_path (first_filename);
diff --git a/src/dlg-new.c b/src/dlg-new.c
index 604167c..12fc138 100644
--- a/src/dlg-new.c
+++ b/src/dlg-new.c
@@ -30,10 +30,10 @@
#include "gtk-utils.h"
#include "fr-init.h"
#include "preferences.h"
+#include "typedefs.h"
#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
#define DEFAULT_EXTENSION ".tar.gz"
-#define MEGABYTE (1024.0 * 1024.0)
/* called when the main dialog is closed. */
static void
@@ -256,6 +256,7 @@ dlg_new_archive (FrWindow *window,
DlgNewData *data;
GSettings *settings;
int i;
+ int size;
data = g_new0 (DlgNewData, 1);
builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "new.ui");
@@ -292,7 +293,9 @@ dlg_new_archive (FrWindow *window,
g_object_unref (settings);
settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton), g_settings_get_int (settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
+ size = g_settings_get_int (settings, PREF_BATCH_ADD_VOLUME_SIZE);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton),
+ ((gdouble) size) / MEGABYTE);
g_object_unref (settings);
/* format chooser */
@@ -433,8 +436,7 @@ dlg_new_data_get_encrypt_header (DlgNewData *data)
int
dlg_new_data_get_volume_size (DlgNewData *data)
{
- guint volume_size = 0;
- int idx;
+ int idx;
idx = get_archive_type (data);
if (idx < 0)
@@ -446,9 +448,9 @@ dlg_new_data_get_volume_size (DlgNewData *data)
double value;
value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton));
- volume_size = floor (value * MEGABYTE);
+ return (int) (value * MEGABYTE);
}
- return volume_size;
+ return 0;
}
diff --git a/src/eggtreemultidnd.c b/src/eggtreemultidnd.c
index 720c352..28fda8e 100644
--- a/src/eggtreemultidnd.c
+++ b/src/eggtreemultidnd.c
@@ -285,8 +285,8 @@ egg_tree_multi_drag_motion_event (GtkWidget *widget,
if (gtk_drag_check_threshold (widget,
priv_data->x,
priv_data->y,
- event->x,
- event->y))
+ (gint) event->x,
+ (gint) event->y))
{
GList *path_list = NULL;
GtkTreeSelection *selection;
@@ -316,8 +316,8 @@ egg_tree_multi_drag_motion_event (GtkWidget *widget,
GDK_ACTION_COPY,
priv_data->pressed_button,
(GdkEvent*) event,
- event->x,
- event->y);
+ (gint) event->x,
+ (gint) event->y);
set_context_data (context, path_list);
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
@@ -395,7 +395,7 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
return FALSE;
gtk_tree_view_get_path_at_pos (tree_view,
- event->x, event->y,
+ (gint) event->x, (gint) event->y,
&path, &column,
&cell_x, &cell_y);
@@ -413,8 +413,8 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
if (gtk_tree_selection_path_is_selected (selection, path))
{
priv_data->pressed_button = event->button;
- priv_data->x = event->x;
- priv_data->y = event->y;
+ priv_data->x = (gint) event->x;
+ priv_data->y = (gint) event->y;
priv_data->pending_event = TRUE;
if (!call_parent)
diff --git a/src/fr-window.c b/src/fr-window.c
index 01cec22..6790985 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -3488,7 +3488,7 @@ dir_tree_button_press_cb (GtkWidget *widget,
GtkTreeIter iter;
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->tree_view),
- event->x, event->y,
+ (int) event->x, (int) event->y,
&path, NULL, NULL, NULL)) {
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->tree_store), &iter, path)) {
@@ -3667,7 +3667,7 @@ file_button_press_cb (GtkWidget *widget,
int n_selected;
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->list_view),
- event->x, event->y,
+ (int) event->x, (int) event->y,
&path, NULL, NULL, NULL)) {
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store), &iter, path)) {
@@ -3697,7 +3697,7 @@ file_button_press_cb (GtkWidget *widget,
GtkTreePath *path = NULL;
if (! gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->list_view),
- event->x, event->y,
+ (int) event->x, (int) event->y,
&path, NULL, NULL, NULL)) {
gtk_tree_selection_unselect_all (selection);
}
@@ -3752,7 +3752,7 @@ file_button_release_cb (GtkWidget *widget,
GtkTreePath *path = NULL;
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (window->priv->list_view),
- event->x, event->y,
+ (int) event->x, (int) event->y,
&path, NULL, NULL, NULL)) {
if ((gtk_tree_path_compare (window->priv->path_clicked, path) == 0)
@@ -3800,7 +3800,7 @@ file_motion_notify_callback (GtkWidget *widget,
last_hover_path = window->priv->list_hover_path;
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
- event->x, event->y,
+ (int) event->x, (int) event->y,
&window->priv->list_hover_path,
NULL, NULL, NULL);