From 6cab8b63ebbf27525b53cf75ff18d5811fa2d39a Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Thu, 22 Nov 2012 21:30:10 -0600 Subject: Fix deprecations and warnings --- copy-n-paste/eggsmclient-xsmp.c | 7 +++++++ src/dlg-add-folder.c | 8 +++++++- src/dlg-ask-password.c | 3 ++- src/dlg-prop.c | 8 ++++++++ src/fr-command-ace.c | 5 +++-- src/fr-command-cfile.c | 8 ++++---- src/fr-window.c | 26 ++++++++++++++++++++++---- 7 files changed, 53 insertions(+), 12 deletions(-) diff --git a/copy-n-paste/eggsmclient-xsmp.c b/copy-n-paste/eggsmclient-xsmp.c index c72839c..8c6ba4d 100644 --- a/copy-n-paste/eggsmclient-xsmp.c +++ b/copy-n-paste/eggsmclient-xsmp.c @@ -36,6 +36,9 @@ #include #include +#if GLIB_CHECK_VERSION (2, 24, 0) +#include +#endif #define EGG_TYPE_SM_CLIENT_XSMP (egg_sm_client_xsmp_get_type ()) #define EGG_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP)) @@ -367,7 +370,11 @@ sm_client_xsmp_startup (EggSMClient *client, free (ret_client_id); gdk_threads_enter (); +#if GLIB_CHECK_VERSION (2, 24, 0) + gdk_x11_set_sm_client_id (xsmp->client_id); +#else gdk_set_sm_client_id (xsmp->client_id); +#endif gdk_threads_leave (); g_debug ("Got client ID \"%s\"", xsmp->client_id); diff --git a/src/dlg-add-folder.c b/src/dlg-add-folder.c index 1e80305..cac8c7f 100644 --- a/src/dlg-add-folder.c +++ b/src/dlg-add-folder.c @@ -34,6 +34,12 @@ #include "gtk-utils.h" #include "preferences.h" +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + typedef struct { FrWindow *window; GSettings *settings; @@ -94,7 +100,7 @@ file_sel_response_cb (GtkWidget *widget, GtkFileChooser *file_sel = GTK_FILE_CHOOSER (widget); FrWindow *window = data->window; char *selected_folder; - gboolean update, recursive, follow_links; + gboolean update, UNUSED_VARIABLE recursive, follow_links; const char *include_files; const char *exclude_files; const char *exclude_folders; diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c index 6010bad..c655ba1 100644 --- a/src/dlg-ask-password.c +++ b/src/dlg-ask-password.c @@ -94,7 +94,7 @@ dlg_ask_password__common (FrWindow *window, DialogData *data; GtkWidget *label; char *text; - char *name; + char *name = NULL; data = g_new0 (DialogData, 1); @@ -120,6 +120,7 @@ dlg_ask_password__common (FrWindow *window, name = g_uri_display_basename (fr_window_get_archive_uri (window)); else if (data->pwd_type == FR_PASSWORD_TYPE_PASTE_FROM) name = g_uri_display_basename (fr_window_get_paste_archive_uri (window)); + g_assert (name != NULL); text = g_strdup_printf (_("Enter the password for the archive '%s'."), name); gtk_label_set_label (GTK_LABEL (label), text); g_free (text); diff --git a/src/dlg-prop.c b/src/dlg-prop.c index 5c76660..94af615 100644 --- a/src/dlg-prop.c +++ b/src/dlg-prop.c @@ -145,7 +145,11 @@ dlg_prop (FrWindow *window) label = _gtk_builder_get_widget (data->builder, "p_size_label"); size = get_file_size (fr_window_get_archive_uri (window)); +#if GLIB_CHECK_VERSION (2, 30, 0) + s = g_format_size (size); +#else s = g_format_size_for_display (size); +#endif gtk_label_set_text (GTK_LABEL (label), s); g_free (s); @@ -165,7 +169,11 @@ dlg_prop (FrWindow *window) } label = _gtk_builder_get_widget (data->builder, "p_uncomp_size_label"); +#if GLIB_CHECK_VERSION (2, 30, 0) + s = g_format_size (uncompressed_size); +#else s = g_format_size_for_display (uncompressed_size); +#endif gtk_label_set_text (GTK_LABEL (label), s); g_free (s); diff --git a/src/fr-command-ace.c b/src/fr-command-ace.c index d567feb..ce3a257 100644 --- a/src/fr-command-ace.c +++ b/src/fr-command-ace.c @@ -93,8 +93,8 @@ process_line (char *line, FileData *fdata; FrCommandAce *ace_comm = FR_COMMAND_ACE (data); FrCommand *comm = FR_COMMAND (data); - char **fields; - const char *field_name; + char **fields = NULL; + const char *field_name = NULL; g_return_if_fail (line != NULL); @@ -140,6 +140,7 @@ process_line (char *line, else if (ace_comm->command_type == FR_ACE_COMMAND_NONFREE) field_name = get_last_field (line, 6); + g_assert (field_name != NULL); if (field_name[0] != '/') { fdata->full_path = g_strconcat ("/", field_name, NULL); fdata->original_path = fdata->full_path + 1; diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c index 3537f3d..32f8a3a 100644 --- a/src/fr-command-cfile.c +++ b/src/fr-command-cfile.c @@ -201,10 +201,10 @@ fr_command_cfile_add (FrCommand *comm, gboolean update, gboolean recursive) { - const char *filename; - char *temp_dir; - char *temp_file; - char *compressed_filename; + const char *filename = NULL; + char *temp_dir = NULL; + char *temp_file = NULL; + char *compressed_filename = NULL; if ((file_list == NULL) || (file_list->data == NULL)) return; diff --git a/src/fr-window.c b/src/fr-window.c index cf3cc5c..7ac8a2d 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -53,6 +53,11 @@ #include "typedefs.h" #include "ui.h" +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif #define LAST_OUTPUT_DIALOG_NAME "last-output" #define MAX_HISTORY_LEN 5 @@ -724,7 +729,7 @@ static void fr_window_class_init (FrWindowClass *class) { GObjectClass *gobject_class; - GtkWidgetClass *widget_class; + GtkWidgetClass UNUSED_VARIABLE *widget_class; parent_class = g_type_class_peek_parent (class); @@ -1500,8 +1505,13 @@ fr_window_update_statusbar_list_info (FrWindow *window) g_list_free (selection); } +#if GLIB_CHECK_VERSION (2, 30, 0) + size_txt = g_format_size (tot_size); + sel_size_txt = g_format_size (sel_size); +#else size_txt = g_format_size_for_display (tot_size); sel_size_txt = g_format_size_for_display (sel_size); +#endif if (tot_n == 0) archive_info = g_strdup (""); @@ -1569,7 +1579,11 @@ fr_window_populate_file_list (FrWindow *window, utf8_path = g_filename_display_name (tmp); g_free (tmp); +#if GLIB_CHECK_VERSION (2, 30, 0) + s_size = g_format_size (fdata->dir_size); +#else s_size = g_format_size_for_display (fdata->dir_size); +#endif if (fdata->list_dir) s_time = g_strdup (""); @@ -1598,7 +1612,11 @@ fr_window_populate_file_list (FrWindow *window, utf8_path = g_filename_display_name (fdata->path); +#if GLIB_CHECK_VERSION (2, 30, 0) + s_size = g_format_size (fdata->size); +#else s_size = g_format_size_for_display (fdata->size); +#endif s_time = get_time_string (fdata->modified); desc = g_content_type_get_description (fdata->content_type); @@ -5359,7 +5377,7 @@ fr_window_construct (FrWindow *window) GtkWidget *sidepane_title_label; GtkWidget *close_sidepane_button; GtkTreeSelection *selection; - int i; + int UNUSED_VARIABLE i; int icon_width, icon_height; GtkActionGroup *actions; GtkUIManager *ui; @@ -7517,7 +7535,7 @@ fr_window_rename_selection (FrWindow *window, if (name_is_present (window, parent_dir, new_name, &reason)) { GtkWidget *dlg; - int r; + int UNUSED_VARIABLE r; dlg = _gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL, @@ -7746,7 +7764,7 @@ copy_from_archive_action_performed_cb (FrArchive *archive, gpointer data) { FrWindow *window = data; - gboolean continue_batch = FALSE; + gboolean UNUSED_VARIABLE continue_batch = FALSE; #ifdef DEBUG debug (DEBUG_INFO, "%s [DONE] (FR::Window)\n", action_names[action]); -- cgit v1.2.1