summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-06-30 16:41:21 +0200
committerZenWalker <[email protected]>2019-07-17 19:39:57 +0200
commit18ea65a0ae7c80fcc7e85a1492b0bc7ba148c736 (patch)
tree20f28f5dd4caf21e0491393127376b2a3752ccf5 /src
parent3fb05765664fd045997a9827c3ba9598a8962a1c (diff)
downloadcaja-18ea65a0ae7c80fcc7e85a1492b0bc7ba148c736.tar.bz2
caja-18ea65a0ae7c80fcc7e85a1492b0bc7ba148c736.tar.xz
src / file-manager: reduce the scope of some variables
Diffstat (limited to 'src')
-rw-r--r--src/file-manager/fm-desktop-icon-view.c9
-rw-r--r--src/file-manager/fm-directory-view.c198
-rw-r--r--src/file-manager/fm-ditem-page.c28
-rw-r--r--src/file-manager/fm-icon-container.c17
-rw-r--r--src/file-manager/fm-icon-view.c63
-rw-r--r--src/file-manager/fm-list-model.c88
-rw-r--r--src/file-manager/fm-list-view.c68
-rw-r--r--src/file-manager/fm-properties-window.c126
-rw-r--r--src/file-manager/fm-tree-model.c36
-rw-r--r--src/file-manager/fm-tree-view.c4
10 files changed, 408 insertions, 229 deletions
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 53153d3b..7ee0394e 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -159,7 +159,6 @@ net_workarea_changed (FMDesktopIconView *icon_view,
int format_returned;
int length_returned;
CajaIconContainer *icon_container;
- GdkScreen *screen;
g_return_if_fail (FM_IS_DESKTOP_ICON_VIEW (icon_view));
@@ -225,6 +224,8 @@ net_workarea_changed (FMDesktopIconView *icon_view,
}
else
{
+ GdkScreen *screen;
+
screen = gdk_window_get_screen (window);
icon_container_set_workarea (
@@ -681,7 +682,6 @@ static gboolean
trash_link_is_selection (FMDirectoryView *view)
{
GList *selection;
- CajaDesktopLink *link;
gboolean result;
result = FALSE;
@@ -691,6 +691,8 @@ trash_link_is_selection (FMDirectoryView *view)
if (eel_g_list_exactly_one_item (selection) &&
CAJA_IS_DESKTOP_ICON_FILE (selection->data))
{
+ CajaDesktopLink *link;
+
link = caja_desktop_icon_file_get_link (CAJA_DESKTOP_ICON_FILE (selection->data));
/* link may be NULL if the link was recently removed (unmounted) */
if (link != NULL &&
@@ -713,7 +715,6 @@ static void
real_update_menus (FMDirectoryView *view)
{
FMDesktopIconView *desktop_view;
- char *label;
gboolean disable_command_line;
gboolean include_empty_trash;
GtkAction *action;
@@ -743,6 +744,8 @@ real_update_menus (FMDirectoryView *view)
G_GNUC_END_IGNORE_DEPRECATIONS;
if (include_empty_trash)
{
+ char *label;
+
label = g_strdup (_("E_mpty Trash"));
g_object_set (action , "label", label, NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index f157f023..e2a1072c 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -488,7 +488,7 @@ static GList *
file_and_directory_list_to_files (GList *fad_list)
{
GList *res, *l;
- FileAndDirectory *fad;
+ FileAndDirectory *fad = NULL;
res = NULL;
for (l = fad_list; l != NULL; l = l->next) {
@@ -503,7 +503,7 @@ static GList *
file_and_directory_list_from_files (CajaDirectory *directory, GList *files)
{
GList *res, *l;
- FileAndDirectory *fad;
+ FileAndDirectory *fad = NULL;
res = NULL;
for (l = files; l != NULL; l = l->next) {
@@ -976,13 +976,13 @@ action_other_application_callback (GtkAction *action,
static void
trash_or_delete_selected_files (FMDirectoryView *view)
{
- GList *selection;
-
/* This might be rapidly called multiple times for the same selection
* when using keybindings. So we remember if the current selection
* was already removed (but the view doesn't know about it yet).
*/
if (!view->details->selection_was_removed) {
+ GList *selection;
+
selection = fm_directory_view_get_selection_for_file_transfer (view);
trash_or_delete_files (fm_directory_view_get_containing_window (view),
selection, TRUE,
@@ -1088,11 +1088,12 @@ action_duplicate_callback (GtkAction *action,
{
FMDirectoryView *view;
GList *selection;
- GArray *selected_item_locations;
view = FM_DIRECTORY_VIEW (callback_data);
selection = fm_directory_view_get_selection_for_file_transfer (view);
if (selection_not_empty_in_menu_callback (view, selection)) {
+ GArray *selected_item_locations;
+
/* FIXME bugzilla.gnome.org 45061:
* should change things here so that we use a get_icon_locations (view, selection).
* Not a problem in this case but in other places the selection may change by
@@ -1113,13 +1114,14 @@ action_create_link_callback (GtkAction *action,
{
FMDirectoryView *view;
GList *selection;
- GArray *selected_item_locations;
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
view = FM_DIRECTORY_VIEW (callback_data);
selection = fm_directory_view_get_selection (view);
if (selection_not_empty_in_menu_callback (view, selection)) {
+ GArray *selected_item_locations;
+
selected_item_locations = fm_directory_view_get_selected_icon_locations (view);
fm_directory_view_create_links_for_files (view, selection, selected_item_locations);
g_array_free (selected_item_locations, TRUE);
@@ -1315,13 +1317,14 @@ static void
action_save_search_callback (GtkAction *action,
gpointer callback_data)
{
- CajaSearchDirectory *search;
FMDirectoryView *directory_view;
directory_view = FM_DIRECTORY_VIEW (callback_data);
if (directory_view->details->model &&
CAJA_IS_SEARCH_DIRECTORY (directory_view->details->model)) {
+ CajaSearchDirectory *search;
+
search = CAJA_SEARCH_DIRECTORY (directory_view->details->model);
caja_search_directory_save_search (search);
@@ -1349,17 +1352,14 @@ action_save_search_as_callback (GtkAction *action,
gpointer callback_data)
{
FMDirectoryView *directory_view;
- CajaSearchDirectory *search;
- GtkWidget *dialog, *grid, *label, *entry, *chooser, *save_button;
-
- const char *entry_text;
- char *filename, *filename_utf8, *dirname, *path, *uri;
- GFile *location;
directory_view = FM_DIRECTORY_VIEW (callback_data);
if (directory_view->details->model &&
CAJA_IS_SEARCH_DIRECTORY (directory_view->details->model)) {
+ CajaSearchDirectory *search;
+ GtkWidget *dialog, *grid, *label, *entry, *chooser, *save_button;
+
search = CAJA_SEARCH_DIRECTORY (directory_view->details->model);
dialog = gtk_dialog_new ();
@@ -1425,6 +1425,10 @@ action_save_search_as_callback (GtkAction *action,
g_get_home_dir ());
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+ const char *entry_text;
+ char *filename, *filename_utf8, *dirname, *path, *uri;
+ GFile *location;
+
entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_str_has_suffix (entry_text, CAJA_SAVED_SEARCH_EXTENSION)) {
filename_utf8 = g_strdup (entry_text);
@@ -1516,7 +1520,6 @@ action_properties_callback (GtkAction *action,
{
FMDirectoryView *view;
GList *selection;
- GList *files;
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -1524,6 +1527,8 @@ action_properties_callback (GtkAction *action,
selection = fm_directory_view_get_selection (view);
if (g_list_length (selection) == 0) {
if (view->details->directory_as_file != NULL) {
+ GList *files;
+
files = g_list_append (NULL, caja_file_ref (view->details->directory_as_file));
fm_properties_window_present (files, GTK_WIDGET (view));
@@ -1916,8 +1921,8 @@ fm_directory_view_get_selection_locations (CajaView *view)
{
GList *files;
GList *locations;
- GFile *location;
GList *l;
+ GFile *location = NULL;
files = fm_directory_view_get_selection (FM_DIRECTORY_VIEW (view));
locations = NULL;
@@ -1949,12 +1954,13 @@ static void
fm_directory_view_set_selection_locations (CajaView *caja_view,
GList *selection_locations)
{
- GList *selection;
FMDirectoryView *view;
view = FM_DIRECTORY_VIEW (caja_view);
if (!view->details->loading) {
+ GList *selection;
+
/* If we aren't still loading, set the selection right now,
* and reveal the new selection.
*/
@@ -2007,8 +2013,6 @@ static void
fm_directory_view_init (FMDirectoryView *view)
{
CajaDirectory *scripts_directory;
- CajaDirectory *templates_directory;
- char *templates_uri;
view->details = g_new0 (FMDirectoryViewDetails, 1);
@@ -2035,6 +2039,9 @@ fm_directory_view_init (FMDirectoryView *view)
caja_directory_unref (scripts_directory);
if (caja_should_use_templates_directory ()) {
+ CajaDirectory *templates_directory;
+ char *templates_uri;
+
templates_uri = caja_get_templates_directory_uri ();
templates_directory = caja_directory_get_by_uri (templates_uri);
g_free (templates_uri);
@@ -2251,7 +2258,7 @@ fm_directory_view_display_selection_info (FMDirectoryView *view)
char *status_string;
char *free_space_str;
char *obj_selected_free_space_str;
- CajaFile *file;
+ CajaFile *file = NULL;
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
@@ -2528,8 +2535,6 @@ static void
done_loading (FMDirectoryView *view,
gboolean all_files_seen)
{
- GList *locations_selected, *selection;
-
if (!view->details->loading) {
return;
}
@@ -2538,6 +2543,8 @@ done_loading (FMDirectoryView *view,
* is no CajaWindowInfo any more.
*/
if (view->details->window != NULL) {
+ GList *locations_selected;
+
if (all_files_seen) {
caja_window_info_report_load_complete (view->details->window, CAJA_VIEW (view));
}
@@ -2547,7 +2554,10 @@ done_loading (FMDirectoryView *view,
reset_update_interval (view);
locations_selected = view->details->pending_locations_selected;
+
if (locations_selected != NULL && all_files_seen) {
+ GList *selection;
+
view->details->pending_locations_selected = NULL;
selection = file_list_from_location_list (locations_selected);
@@ -2929,7 +2939,6 @@ static void
process_old_files (FMDirectoryView *view)
{
GList *files_added, *files_changed, *node;
- FileAndDirectory *pending;
GList *selection, *files;
gboolean send_selection_change;
@@ -2939,6 +2948,8 @@ process_old_files (FMDirectoryView *view)
send_selection_change = FALSE;
if (files_added != NULL || files_changed != NULL) {
+ FileAndDirectory *pending = NULL;
+
g_signal_emit (view, signals[BEGIN_FILE_CHANGES], 0);
for (node = files_added; node != NULL; node = node->next) {
@@ -3863,7 +3874,7 @@ special_link_in_selection (FMDirectoryView *view)
{
gboolean saw_link;
GList *selection, *node;
- CajaFile *file;
+ CajaFile *file = NULL;
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -3896,7 +3907,7 @@ desktop_or_home_dir_in_selection (FMDirectoryView *view)
{
gboolean saw_desktop_or_home_dir;
GList *selection, *node;
- CajaFile *file;
+ CajaFile *file = NULL;
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -4006,8 +4017,6 @@ delayed_rename_file_hack_removed (RenameData *data)
static void
rename_file (FMDirectoryView *view, CajaFile *new_file)
{
- RenameData *data;
-
/* HACK!!!!
This is a work around bug in listview. After the rename is
enabled we will get file changes due to info about the new
@@ -4019,6 +4028,8 @@ rename_file (FMDirectoryView *view, CajaFile *new_file)
file_changed. So, before we delay we select the row.
*/
if (FM_IS_LIST_VIEW (view)) {
+ RenameData *data;
+
fm_directory_view_select_file (view, new_file);
data = g_new (RenameData, 1);
@@ -4427,19 +4438,20 @@ add_submenu (GtkUIManager *ui_manager,
cairo_surface_t *surface,
gboolean add_action)
{
- char *escaped_label;
- char *action_name;
- char *submenu_name;
- char *escaped_submenu_name;
- GtkAction *action;
-
if (parent_path != NULL) {
+ char *escaped_label;
+ char *action_name;
+ char *submenu_name;
+ char *escaped_submenu_name;
+
action_name = escape_action_name (uri, "submenu_");
submenu_name = g_path_get_basename (uri);
escaped_submenu_name = escape_action_path (submenu_name);
escaped_label = eel_str_double_underscores (label);
if (add_action) {
+ GtkAction *action;
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
action = gtk_action_new (action_name,
escaped_label,
@@ -4674,7 +4686,6 @@ add_x_content_apps (FMDirectoryView *view, CajaFile *file, GList **applications)
{
GMount *mount;
char **x_content_types;
- unsigned int n;
g_return_if_fail (applications != NULL);
@@ -4686,6 +4697,8 @@ add_x_content_apps (FMDirectoryView *view, CajaFile *file, GList **applications)
x_content_types = caja_autorun_get_cached_x_content_types_for_mount (mount);
if (x_content_types != NULL) {
+ unsigned int n;
+
for (n = 0; x_content_types[n] != NULL; n++) {
char *x_content_type = x_content_types[n];
GList *app_info_for_x_content_type;
@@ -4985,7 +4998,6 @@ add_extension_action_for_files (FMDirectoryView *view,
char *name, *label, *tip, *icon;
gboolean sensitive, priority;
GtkAction *action;
- cairo_surface_t *surface;
ExtensionActionCallbackData *data;
g_object_get (G_OBJECT (item),
@@ -5003,7 +5015,10 @@ add_extension_action_for_files (FMDirectoryView *view,
G_GNUC_END_IGNORE_DEPRECATIONS;
if (icon != NULL) {
+ cairo_surface_t *surface;
+
surface = get_menu_icon (icon, GTK_WIDGET (view));
+
if (surface != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
surface,
@@ -5161,12 +5176,12 @@ static char **
get_file_names_as_parameter_array (GList *selection,
CajaDirectory *model)
{
- CajaFile *file;
char **parameters;
GList *node;
- GFile *file_location;
GFile *model_location;
int i;
+ CajaFile *file = NULL;
+ GFile *file_location = NULL;
if (model == NULL) {
return NULL;
@@ -5203,7 +5218,6 @@ static char *
get_file_paths_or_uris_as_newline_delimited_string (GList *selection, gboolean get_paths)
{
char *path;
- char *uri;
char *result;
CajaDesktopLink *link;
GString *expanding_string;
@@ -5212,7 +5226,10 @@ get_file_paths_or_uris_as_newline_delimited_string (GList *selection, gboolean g
expanding_string = g_string_new ("");
for (node = selection; node != NULL; node = node->next) {
+ char *uri;
+
uri = NULL;
+
if (CAJA_IS_DESKTOP_ICON_FILE (node->data)) {
link = caja_desktop_icon_file_get_link (CAJA_DESKTOP_ICON_FILE (node->data));
if (link != NULL) {
@@ -5293,10 +5310,11 @@ static FMDirectoryView *
get_directory_view_of_extra_pane (FMDirectoryView *view)
{
CajaWindowSlotInfo *slot;
- CajaView *next_view;
slot = caja_window_info_get_extra_slot (fm_directory_view_get_caja_window (view));
if (slot != NULL) {
+ CajaView *next_view;
+
next_view = caja_window_slot_info_get_current_view (slot);
if (FM_IS_DIRECTORY_VIEW (next_view)) {
@@ -5590,10 +5608,10 @@ update_directory_in_scripts_menu (FMDirectoryView *view, CajaDirectory *director
char *menu_path, *popup_path, *popup_bg_path;
GList *file_list, *filtered, *node;
gboolean any_scripts;
- CajaFile *file;
CajaDirectory *dir;
char *uri;
char *escaped_path;
+ CajaFile *file = NULL;
uri = caja_directory_get_uri (directory);
escaped_path = escape_action_path (uri + scripts_directory_uri_length);
@@ -5654,10 +5672,9 @@ update_scripts_menu (FMDirectoryView *view)
{
gboolean any_scripts;
GList *sorted_copy, *node;
- CajaDirectory *directory;
- char *uri;
GtkUIManager *ui_manager;
GtkAction *action;
+ CajaDirectory *directory = NULL;
/* There is a race condition here. If we don't mark the scripts menu as
valid before we begin our task then we can lose script menu updates that
@@ -5679,6 +5696,8 @@ update_scripts_menu (FMDirectoryView *view)
sorted_copy = caja_directory_list_sort_by_uri
(caja_directory_list_copy (view->details->scripts_directory_list));
for (node = sorted_copy; node != NULL; node = node->next) {
+ char *uri;
+
directory = node->data;
uri = caja_directory_get_uri (directory);
@@ -5786,9 +5805,7 @@ add_template_to_templates_menus (FMDirectoryView *directory_view,
static void
update_templates_directory (FMDirectoryView *view)
{
- CajaDirectory *templates_directory;
GList *node, *next;
- char *templates_uri;
for (node = view->details->templates_directory_list; node != NULL; node = next) {
next = node->next;
@@ -5796,6 +5813,9 @@ update_templates_directory (FMDirectoryView *view)
}
if (caja_should_use_templates_directory ()) {
+ CajaDirectory *templates_directory;
+ char *templates_uri;
+
templates_uri = caja_get_templates_directory_uri ();
templates_directory = caja_directory_get_by_uri (templates_uri);
g_free (templates_uri);
@@ -5849,11 +5869,11 @@ update_directory_in_templates_menu (FMDirectoryView *view,
char *menu_path, *popup_bg_path;
GList *file_list, *filtered, *node;
gboolean any_templates;
- CajaFile *file;
CajaDirectory *dir;
char *escaped_path;
char *uri;
int num;
+ CajaFile *file = NULL;
/* We know this directory belongs to the template dir, so it must exist */
g_assert (templates_directory_uri);
@@ -5916,11 +5936,10 @@ update_templates_menu (FMDirectoryView *view)
{
gboolean any_templates;
GList *sorted_copy, *node;
- CajaDirectory *directory;
GtkUIManager *ui_manager;
- char *uri;
GtkAction *action;
char *templates_directory_uri;
+ CajaDirectory *directory = NULL;
if (caja_should_use_templates_directory ()) {
templates_directory_uri = caja_get_templates_directory_uri ();
@@ -5948,6 +5967,8 @@ update_templates_menu (FMDirectoryView *view)
sorted_copy = caja_directory_list_sort_by_uri
(caja_directory_list_copy (view->details->templates_directory_list));
for (node = sorted_copy; node != NULL; node = node->next) {
+ char *uri;
+
directory = node->data;
uri = caja_directory_get_uri (directory);
@@ -6025,7 +6046,7 @@ copy_or_cut_files (FMDirectoryView *view,
gboolean cut)
{
int count;
- char *status_string, *name;
+ char *status_string;
CajaClipboardInfo info;
GtkTargetList *target_list;
GtkTargetEntry *targets;
@@ -6052,6 +6073,8 @@ copy_or_cut_files (FMDirectoryView *view,
count = g_list_length (clipboard_contents);
if (count == 1) {
+ char *name;
+
name = caja_file_get_display_name (clipboard_contents->data);
if (cut) {
status_string = g_strdup_printf (_("\"%s\" will be moved "
@@ -6301,13 +6324,14 @@ paste_into_clipboard_received_callback (GtkClipboard *clipboard,
{
PasteIntoData *data;
FMDirectoryView *view;
- char *directory_uri;
data = (PasteIntoData *) callback_data;
view = FM_DIRECTORY_VIEW (data->view);
if (view->details->window != NULL) {
+ char *directory_uri;
+
directory_uri = caja_file_get_activation_uri (data->target);
paste_clipboard_data (view, selection_data, directory_uri);
@@ -6401,7 +6425,6 @@ static void
real_action_rename (FMDirectoryView *view,
gboolean select_all)
{
- CajaFile *file;
GList *selection;
g_assert (FM_IS_DIRECTORY_VIEW (view));
@@ -6409,7 +6432,10 @@ real_action_rename (FMDirectoryView *view,
selection = fm_directory_view_get_selection (view);
if (selection_not_empty_in_menu_callback (view, selection)) {
+ CajaFile *file;
+
file = CAJA_FILE (selection->data);
+
if (!select_all) {
/* directories don't have a file extension, so
* they are always pre-selected as a whole */
@@ -6512,10 +6538,10 @@ static void
action_mount_volume_callback (GtkAction *action,
gpointer data)
{
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
GMountOperation *mount_op;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -6538,9 +6564,9 @@ static void
action_unmount_volume_callback (GtkAction *action,
gpointer data)
{
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -6565,9 +6591,9 @@ action_format_volume_callback (GtkAction *action,
gpointer data)
{
#ifdef TODO_GIO
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -6587,9 +6613,9 @@ static void
action_eject_volume_callback (GtkAction *action,
gpointer data)
{
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -6629,10 +6655,10 @@ static void
action_start_volume_callback (GtkAction *action,
gpointer data)
{
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
GMountOperation *mount_op;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -6654,9 +6680,9 @@ static void
action_stop_volume_callback (GtkAction *action,
gpointer data)
{
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -6679,9 +6705,9 @@ static void
action_detect_media_callback (GtkAction *action,
gpointer data)
{
- CajaFile *file;
GList *selection, *l;
FMDirectoryView *view;
+ CajaFile *file = NULL;
view = FM_DIRECTORY_VIEW (data);
@@ -7037,11 +7063,6 @@ action_connect_to_server_link_callback (GtkAction *action,
CajaIconInfo *icon;
const char *icon_name;
char *name;
- GtkWidget *dialog;
- GtkWidget *label;
- GtkWidget *entry;
- GtkWidget *box;
- char *title;
gint scale;
view = FM_DIRECTORY_VIEW (data);
@@ -7062,6 +7083,12 @@ action_connect_to_server_link_callback (GtkAction *action,
name = caja_file_get_display_name (file);
if (uri != NULL) {
+ GtkWidget *dialog;
+ GtkWidget *label;
+ GtkWidget *entry;
+ GtkWidget *box;
+ char *title;
+
title = g_strdup_printf (_("Connect to Server %s"), name);
dialog = gtk_dialog_new ();
@@ -7677,16 +7704,20 @@ connect_proxy (FMDirectoryView *view,
GtkActionGroup *action_group)
{
const gchar *action_name;
- cairo_surface_t *surface;
- GtkWidget *image;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
action_name = gtk_action_get_name (action);
G_GNUC_END_IGNORE_DEPRECATIONS;
+
if (strcmp (action_name, FM_ACTION_NEW_EMPTY_FILE) == 0 &&
GTK_IS_IMAGE_MENU_ITEM (proxy)) {
+ cairo_surface_t *surface;
+
surface = get_menu_icon ("text-x-generic", GTK_WIDGET (view));
+
if (surface != NULL) {
+ GtkWidget *image;
+
image = gtk_image_new_from_surface (surface);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image);
@@ -7824,7 +7855,6 @@ clipboard_targets_received (GtkClipboard *clipboard,
{
FMDirectoryView *view;
gboolean can_paste;
- int i;
GList *selection;
int count;
GtkAction *action;
@@ -7840,6 +7870,8 @@ clipboard_targets_received (GtkClipboard *clipboard,
}
if (targets) {
+ int i;
+
for (i=0; i < n_targets; i++) {
if (targets[i] == copied_files_atom) {
can_paste = TRUE;
@@ -7904,9 +7936,10 @@ static gboolean
file_list_all_are_folders (GList *file_list)
{
GList *l;
- CajaFile *file, *linked_file;
char *activation_uri;
gboolean is_dir;
+ CajaFile *linked_file;
+ CajaFile *file = NULL;
for (l = file_list; l != NULL; l = l->next) {
file = CAJA_FILE (l->data);
@@ -7963,8 +7996,6 @@ file_should_show_foreach (CajaFile *file,
gboolean *show_poll,
GDriveStartStopType *start_stop_type)
{
- char *uri;
-
*show_mount = FALSE;
*show_unmount = FALSE;
*show_eject = FALSE;
@@ -8010,6 +8041,8 @@ file_should_show_foreach (CajaFile *file,
*start_stop_type = caja_file_get_start_stop_type (file);
if (caja_file_is_caja_link (file)) {
+ char *uri;
+
uri = caja_file_get_activation_uri (file);
if (uri != NULL &&
(eel_istr_has_prefix (uri, "ftp:") ||
@@ -8085,9 +8118,9 @@ file_should_show_self (CajaFile *file,
static gboolean
files_are_all_directories (GList *files)
{
- CajaFile *file;
GList *l;
gboolean all_directories;
+ CajaFile *file = NULL;
all_directories = TRUE;
@@ -8102,9 +8135,9 @@ files_are_all_directories (GList *files)
static gboolean
files_is_none_directory (GList *files)
{
- CajaFile *file;
GList *l;
gboolean no_directory;
+ CajaFile *file = NULL;
no_directory = TRUE;
@@ -8126,7 +8159,7 @@ update_restore_from_trash_action (GtkAction *action,
GHashTable *original_dirs_hash;
GList *original_dirs;
GFile *original_location;
- char *tooltip, *original_name;
+ char *original_name;
original_file = NULL;
original_dir = NULL;
@@ -8150,6 +8183,8 @@ update_restore_from_trash_action (GtkAction *action,
}
if (original_file != NULL || original_dirs != NULL) {
+ char *tooltip;
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_action_set_visible (action, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS;
@@ -8797,8 +8832,8 @@ clipboard_changed_callback (CajaClipboardMonitor *monitor, FMDirectoryView *view
static gboolean
can_delete_all (GList *files)
{
- CajaFile *file;
GList *l;
+ CajaFile *file = NULL;
for (l = files; l != NULL; l = l->next) {
file = l->data;
@@ -9549,12 +9584,12 @@ schedule_update_status (FMDirectoryView *view)
void
fm_directory_view_notify_selection_changed (FMDirectoryView *view)
{
- GList *selection;
- GtkWindow *window;
-
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
if (caja_debug_log_is_domain_enabled (CAJA_DEBUG_LOG_DOMAIN_USER)) {
+ GList *selection;
+ GtkWindow *window;
+
selection = fm_directory_view_get_selection (view);
window = fm_directory_view_get_containing_window (view);
@@ -10595,12 +10630,8 @@ fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view,
int y)
{
GdkPoint point;
- GdkScreen *screen;
- int screen_num;
char *url, *title;
- char *link_name, *link_display_name;
char *container_uri;
- GArray *points;
char **bits;
GList *uri_list = NULL;
GFile *f;
@@ -10685,6 +10716,8 @@ fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view,
}
if (action == GDK_ACTION_LINK) {
+ char *link_name;
+
if (eel_str_is_empty (title)) {
GFile *f;
@@ -10696,6 +10729,10 @@ fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view,
}
if (!eel_str_is_empty (link_name)) {
+ GdkScreen *screen;
+ int screen_num;
+ char *link_display_name;
+
link_display_name = g_strdup_printf (_("Link to %s"), link_name);
/* The filename can't contain slashes, strip em.
@@ -10721,6 +10758,8 @@ fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view,
}
g_free (link_name);
} else {
+ GArray *points;
+
GdkPoint tmp_point = { 0, 0 };
/* pass in a 1-item array of icon positions, relative to x, y */
@@ -10876,7 +10915,6 @@ fm_directory_view_handle_raw_drop (FMDirectoryView *view,
int y)
{
char *container_uri, *filename;
- GFile *direct_save_full;
GdkPoint pos;
if (raw_data == NULL) {
@@ -10897,6 +10935,8 @@ fm_directory_view_handle_raw_drop (FMDirectoryView *view,
filename = NULL;
if (direct_save_uri != NULL) {
+ GFile *direct_save_full;
+
direct_save_full = g_file_new_for_uri (direct_save_uri);
filename = g_file_get_basename (direct_save_full);
}
diff --git a/src/file-manager/fm-ditem-page.c b/src/file-manager/fm-ditem-page.c
index 71967a6b..c1585597 100644
--- a/src/file-manager/fm-ditem-page.c
+++ b/src/file-manager/fm-ditem-page.c
@@ -207,8 +207,7 @@ fm_ditem_page_exec_drag_data_received (GtkWidget *widget, GdkDragContext *contex
char **uris;
gboolean exactly_one;
CajaFile *file;
- GKeyFile *key_file;
- char *uri, *type, *exec;
+ char *uri, *exec;
uris = g_strsplit (gtk_selection_data_get_data (selection_data), "\r\n", 0);
exactly_one = uris[0] != NULL && (uris[1] == NULL || uris[1][0] == '\0');
@@ -227,9 +226,14 @@ fm_ditem_page_exec_drag_data_received (GtkWidget *widget, GdkDragContext *contex
uri = caja_file_get_uri (file);
if (caja_file_is_mime_type (file, "application/x-desktop"))
{
+ GKeyFile *key_file;
+
key_file = _g_key_file_new_from_uri (uri, G_KEY_FILE_NONE, NULL);
+
if (key_file != NULL)
{
+ char *type;
+
type = g_key_file_get_string (key_file, MAIN_GROUP, "Type", NULL);
if (type != NULL && strcmp (type, "Application") == 0)
{
@@ -259,7 +263,6 @@ save_entry (GtkEntry *entry, GKeyFile *key_file, const char *uri)
GError *error;
ItemEntry *item_entry;
const char *val;
- gchar **languages;
item_entry = g_object_get_data (G_OBJECT (entry), "item_entry");
val = gtk_entry_get_text (entry);
@@ -274,6 +277,8 @@ save_entry (GtkEntry *entry, GKeyFile *key_file, const char *uri)
if (item_entry->localized)
{
+ gchar **languages;
+
languages = (gchar **) g_get_language_names ();
g_key_file_set_locale_string (key_file, MAIN_GROUP, item_entry->field, languages[0], val);
}
@@ -323,16 +328,16 @@ build_grid (GtkWidget *container,
GtkSizeGroup *label_size_group,
GList *entries)
{
- GtkWidget *grid;
- GtkWidget *label;
- GtkWidget *entry;
GList *l;
char *val;
+ GtkWidget *grid;
+ GtkWidget *label;
+ GtkWidget *entry = NULL;
- grid = gtk_grid_new ();
- gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
- gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+ grid = gtk_grid_new ();
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
for (l = entries; l; l = l->next)
{
@@ -478,7 +483,6 @@ ditem_read_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- GKeyFile *key_file;
GtkWidget *box;
gsize file_size;
char *file_contents;
@@ -490,6 +494,8 @@ ditem_read_cb (GObject *source_object,
&file_contents, &file_size,
NULL, NULL))
{
+ GKeyFile *key_file;
+
key_file = g_key_file_new ();
g_object_set_data_full (G_OBJECT (box), "keyfile", key_file, (GDestroyNotify)g_key_file_free);
if (g_key_file_load_from_data (key_file, file_contents, file_size, 0, NULL))
diff --git a/src/file-manager/fm-icon-container.c b/src/file-manager/fm-icon-container.c
index 1c252af4..325329f2 100644
--- a/src/file-manager/fm-icon-container.c
+++ b/src/file-manager/fm-icon-container.c
@@ -62,7 +62,6 @@ fm_icon_container_get_icon_images (CajaIconContainer *container,
gboolean *has_window_open)
{
FMIconView *icon_view;
- char **emblems_to_ignore;
CajaFile *file;
gboolean use_embedding;
CajaFileIconFlags flags;
@@ -90,6 +89,8 @@ fm_icon_container_get_icon_images (CajaIconContainer *container,
if (emblem_size > 0)
{
+ char **emblems_to_ignore;
+
emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude
(FM_DIRECTORY_VIEW (icon_view));
*emblem_pixbufs = caja_file_get_emblem_pixbufs (file,
@@ -189,7 +190,6 @@ fm_icon_container_prioritize_thumbnailing (CajaIconContainer *container,
CajaIconData *data)
{
CajaFile *file;
- char *uri;
file = (CajaFile *) data;
@@ -197,6 +197,8 @@ fm_icon_container_prioritize_thumbnailing (CajaIconContainer *container,
if (caja_file_is_thumbnailing (file))
{
+ char *uri;
+
uri = caja_file_get_uri (file);
caja_thumbnail_prioritize (uri);
g_free (uri);
@@ -306,8 +308,6 @@ fm_icon_container_get_icon_text (CajaIconContainer *container,
char **additional_text,
gboolean include_invisible)
{
- char *actual_uri;
- gchar *description;
GQuark *attributes;
char *text_array[4];
int i, j, num_attributes;
@@ -362,10 +362,15 @@ fm_icon_container_get_icon_text (CajaIconContainer *container,
*additional_text = NULL;
if (caja_file_is_local (file))
{
+ char *actual_uri;
+ gchar *description;
+
actual_uri = caja_file_get_uri (file);
description = caja_link_local_get_additional_text (actual_uri);
+
if (description)
*additional_text = g_strdup_printf (" \n%s\n ", description);
+
g_free (description);
g_free (actual_uri);
}
@@ -434,14 +439,16 @@ typedef enum
static SortCategory
get_sort_category (CajaFile *file)
{
- CajaDesktopLink *link;
SortCategory category;
category = SORT_OTHER;
if (CAJA_IS_DESKTOP_ICON_FILE (file))
{
+ CajaDesktopLink *link;
+
link = caja_desktop_icon_file_get_link (CAJA_DESKTOP_ICON_FILE (file));
+
if (link != NULL)
{
switch (caja_desktop_link_get_link_type (link))
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 8f724e2e..8ed42cd5 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -301,7 +301,7 @@ get_stored_icon_position_callback (CajaIconContainer *container,
CajaIconPosition *position,
FMIconView *icon_view)
{
- char *position_string, *scale_string;
+ char *position_string;
gboolean position_good;
char c;
@@ -328,10 +328,13 @@ get_stored_icon_position_callback (CajaIconContainer *container,
/* Disable scaling if not on the desktop */
if (fm_icon_view_supports_scaling (icon_view))
{
+ char *scale_string;
+
/* Get the scale of the icon from the metadata. */
scale_string = caja_file_get_metadata
(file, CAJA_METADATA_KEY_ICON_SCALE, "1");
position->scale = g_ascii_strtod (scale_string, NULL);
+
if (errno != 0)
{
position->scale = 1.0;
@@ -729,7 +732,6 @@ update_layout_menus (FMIconView *view)
{
gboolean is_auto_layout;
GtkAction *action;
- const char *action_name;
CajaFile *file;
if (view->details->icon_action_group == NULL)
@@ -743,6 +745,8 @@ update_layout_menus (FMIconView *view)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (fm_icon_view_supports_auto_layout (view))
{
+ const char *action_name;
+
/* Mark sort criterion. */
action_name = is_auto_layout ? view->details->sort->action : FM_ACTION_MANUAL_LAYOUT;
action = gtk_action_group_get_action (view->details->icon_action_group,
@@ -1271,7 +1275,6 @@ fm_icon_view_begin_loading (FMDirectoryView *view)
FMIconView *icon_view;
GtkWidget *icon_container;
CajaFile *file;
- int level;
char *sort_name;
g_return_if_fail (FM_IS_ICON_VIEW (view));
@@ -1313,6 +1316,8 @@ fm_icon_view_begin_loading (FMDirectoryView *view)
/* Set up the zoom level from the metadata. */
if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (icon_view)))
{
+ int level;
+
if (icon_view->details->compact)
{
level = caja_file_get_integer_metadata
@@ -1805,7 +1810,6 @@ fm_icon_view_merge_menus (FMDirectoryView *view)
FMIconView *icon_view;
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
- GtkAction *action;
const char *ui;
g_assert (FM_IS_ICON_VIEW (view));
@@ -1846,6 +1850,8 @@ fm_icon_view_merge_menus (FMDirectoryView *view)
*/
if (!fm_icon_view_supports_auto_layout (icon_view))
{
+ GtkAction *action;
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
action = gtk_action_group_get_action (action_group,
FM_ACTION_ARRANGE_ITEMS);
@@ -2063,9 +2069,6 @@ icon_container_activate_alternate_callback (CajaIconContainer *container,
GList *file_list,
FMIconView *icon_view)
{
- GdkEvent *event;
- GdkEventButton *button_event;
- GdkEventKey *key_event;
gboolean open_in_tab;
CajaWindowInfo *window_info;
CajaWindowOpenFlags flags;
@@ -2079,18 +2082,25 @@ icon_container_activate_alternate_callback (CajaIconContainer *container,
if (caja_window_info_get_window_type (window_info) == CAJA_WINDOW_NAVIGATION)
{
+ GdkEvent *event;
+
event = gtk_get_current_event ();
+
if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE ||
event->type == GDK_2BUTTON_PRESS ||
event->type == GDK_3BUTTON_PRESS)
{
+ GdkEventButton *button_event;
+
button_event = (GdkEventButton *) event;
open_in_tab = (button_event->state & GDK_SHIFT_MASK) == 0;
}
else if (event->type == GDK_KEY_PRESS ||
event->type == GDK_KEY_RELEASE)
{
+ GdkEventKey *key_event;
+
key_event = (GdkEventKey *) event;
open_in_tab = !((key_event->state & GDK_SHIFT_MASK) != 0 &&
(key_event->state & GDK_CONTROL_MASK) != 0);
@@ -2145,9 +2155,9 @@ get_preview_argv (char *uri)
{
char *command;
char **argv;
- int i;
command = g_find_program_in_path ("totem-audio-preview");
+
if (command)
{
argv = g_new (char *, 3);
@@ -2167,6 +2177,8 @@ get_preview_argv (char *uri)
if (command)
{
+ int i;
+
argv = g_new (char *, 10);
i = 0;
argv[i++] = command;
@@ -2380,7 +2392,6 @@ icon_container_preview_callback (CajaIconContainer *container,
FMIconView *icon_view)
{
int result;
- char *file_name, *message;
result = 0;
@@ -2402,6 +2413,8 @@ icon_container_preview_callback (CajaIconContainer *container,
{
if (start_flag)
{
+ char *file_name, *message;
+
file_name = caja_file_get_display_name (file);
message = g_strdup_printf (_("pointing at \"%s\""), file_name);
g_free (file_name);
@@ -2467,9 +2480,6 @@ fm_icon_view_screen_changed (GtkWidget *widget,
{
FMDirectoryView *view;
GList *files, *l;
- CajaFile *file;
- CajaDirectory *directory;
- CajaIconContainer *icon_container;
if (GTK_WIDGET_CLASS (fm_icon_view_parent_class)->screen_changed)
{
@@ -2479,6 +2489,10 @@ fm_icon_view_screen_changed (GtkWidget *widget,
view = FM_DIRECTORY_VIEW (widget);
if (FM_ICON_VIEW (view)->details->filter_by_screen)
{
+ CajaDirectory *directory;
+ CajaIconContainer *icon_container;
+ CajaFile *file = NULL;
+
icon_container = get_icon_container (FM_ICON_VIEW (view));
directory = fm_directory_view_get_model (view);
@@ -2603,7 +2617,6 @@ icon_position_changed_callback (CajaIconContainer *container,
const CajaIconPosition *position,
FMIconView *icon_view)
{
- char *position_string;
char scale_string[G_ASCII_DTOSTR_BUF_SIZE];
g_assert (FM_IS_ICON_VIEW (icon_view));
@@ -2628,6 +2641,8 @@ icon_position_changed_callback (CajaIconContainer *container,
/* Store the new position of the icon in the metadata. */
if (!fm_icon_view_using_auto_layout (icon_view))
{
+ char *position_string;
+
position_string = g_strdup_printf
("%d,%d", position->x, position->y);
caja_file_set_metadata
@@ -2795,8 +2810,6 @@ static void
default_zoom_level_changed_callback (gpointer callback_data)
{
FMIconView *icon_view;
- CajaFile *file;
- int level;
g_return_if_fail (FM_IS_ICON_VIEW (callback_data));
@@ -2804,6 +2817,9 @@ default_zoom_level_changed_callback (gpointer callback_data)
if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (icon_view)))
{
+ CajaFile *file;
+ int level;
+
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (icon_view));
if (fm_icon_view_is_compact (icon_view))
@@ -2914,12 +2930,13 @@ get_stored_layout_timestamp (CajaIconContainer *container,
time_t *timestamp,
FMIconView *view)
{
- CajaFile *file;
- CajaDirectory *directory;
-
if (icon_data == NULL)
{
+ CajaFile *file;
+ CajaDirectory *directory;
+
directory = fm_directory_view_get_model (FM_DIRECTORY_VIEW (view));
+
if (directory == NULL)
{
return FALSE;
@@ -2945,12 +2962,13 @@ store_layout_timestamp (CajaIconContainer *container,
const time_t *timestamp,
FMIconView *view)
{
- CajaFile *file;
- CajaDirectory *directory;
-
if (icon_data == NULL)
{
+ CajaFile *file;
+ CajaDirectory *directory;
+
directory = fm_directory_view_get_model (FM_DIRECTORY_VIEW (view));
+
if (directory == NULL)
{
return FALSE;
@@ -3114,13 +3132,14 @@ static void
icon_view_scroll_to_file (CajaView *view,
const char *uri)
{
- CajaFile *file;
FMIconView *icon_view;
icon_view = FM_ICON_VIEW (view);
if (uri != NULL)
{
+ CajaFile *file;
+
/* Only if existing, since we don't want to add the file to
the directory if it has been removed since then */
file = caja_file_get_existing_by_uri (uri);
diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c
index 8aa58896..565c5d05 100644
--- a/src/file-manager/fm-list-model.c
+++ b/src/file-manager/fm-list-model.c
@@ -202,7 +202,7 @@ fm_list_model_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath
GSequence *files;
GSequenceIter *ptr;
FileEntry *file_entry;
- int i, d;
+ int d;
model = (FMListModel *)tree_model;
ptr = NULL;
@@ -210,6 +210,8 @@ fm_list_model_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath
files = model->details->files;
for (d = 0; d < gtk_tree_path_get_depth (path); d++)
{
+ int i;
+
i = gtk_tree_path_get_indices (path)[d];
if (files == NULL || i >= g_sequence_get_length (files))
@@ -286,19 +288,11 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
FMListModel *model;
FileEntry *file_entry;
CajaFile *file;
- char *str;
- GdkPixbuf *icon, *rendered_icon;
- GIcon *gicon, *emblemed_icon, *emblem_icon;
- CajaIconInfo *icon_info;
- GEmblem *emblem;
+ GdkPixbuf *rendered_icon;
+ GIcon *emblemed_icon;
GList *emblem_icons, *l;
- int icon_size, icon_scale;
CajaZoomLevel zoom_level;
- CajaFile *parent_file;
- char *emblems_to_ignore[3];
- int i;
CajaFileIconFlags flags;
- cairo_surface_t *surface;
model = (FMListModel *)tree_model;
@@ -331,6 +325,16 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
if (file != NULL)
{
+ GdkPixbuf *icon;
+ GIcon *gicon;
+ CajaIconInfo *icon_info;
+ GEmblem *emblem;
+ int icon_size, icon_scale;
+ CajaFile *parent_file;
+ char *emblems_to_ignore[3];
+ int i;
+ cairo_surface_t *surface;
+
zoom_level = fm_list_model_get_zoom_level_from_column_id (column);
icon_size = caja_get_icon_size_for_zoom_level (zoom_level);
icon_scale = fm_list_model_get_icon_scale (model);
@@ -340,13 +344,15 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON_AS_EMBLEM;
if (model->details->drag_view != NULL)
{
- GtkTreePath *path_a, *path_b;
+ GtkTreePath *path_a;
gtk_tree_view_get_drag_dest_row (model->details->drag_view,
&path_a,
NULL);
if (path_a != NULL)
{
+ GtkTreePath *path_b;
+
path_b = gtk_tree_model_get_path (tree_model, iter);
if (gtk_tree_path_compare (path_a, path_b) == 0)
@@ -378,6 +384,8 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
emblems_to_ignore);
if (emblem_icons != NULL) {
+ GIcon *emblem_icon;
+
emblem_icon = emblem_icons->data;
emblem = g_emblem_new (emblem_icon);
emblemed_icon = g_emblemed_icon_new (gicon, emblem);
@@ -441,6 +449,8 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
NULL);
if (file != NULL)
{
+ char *str;
+
str = caja_file_get_string_attribute_with_default_q (file,
attribute);
g_value_take_string (value, str);
@@ -603,7 +613,6 @@ static GSequenceIter *
lookup_file (FMListModel *model, CajaFile *file,
CajaDirectory *directory)
{
- FileEntry *file_entry;
GSequenceIter *ptr, *parent_ptr;
parent_ptr = NULL;
@@ -615,6 +624,8 @@ lookup_file (FMListModel *model, CajaFile *file,
if (parent_ptr)
{
+ FileEntry *file_entry;
+
file_entry = g_sequence_get (parent_ptr);
ptr = g_hash_table_lookup (file_entry->reverse_map, file);
}
@@ -781,8 +792,8 @@ fm_list_model_sort_file_entries (FMListModel *model, GSequence *files, GtkTreePa
int *new_order;
int length;
int i;
- FileEntry *file_entry;
gboolean has_iter;
+ FileEntry *file_entry = NULL;
length = g_sequence_get_length (files);
@@ -798,6 +809,7 @@ fm_list_model_sort_file_entries (FMListModel *model, GSequence *files, GtkTreePa
GSequenceIter *ptr = g_sequence_get_iter_at_pos (files, i);
file_entry = g_sequence_get (ptr);
+
if (file_entry->files != NULL)
{
gtk_tree_path_append_index (path, i);
@@ -916,12 +928,12 @@ each_path_get_data_binder (CajaDragEachSelectedItemDataGet data_get,
{
DragDataGetInfo *info;
GList *l;
- CajaFile *file;
- GtkTreeRowReference *row;
- GtkTreePath *path;
char *uri;
GdkRectangle cell_area;
GtkTreeViewColumn *column;
+ CajaFile *file = NULL;
+ GtkTreeRowReference *row = NULL;
+ GtkTreePath *path = NULL;
info = context;
@@ -935,6 +947,7 @@ each_path_get_data_binder (CajaDragEachSelectedItemDataGet data_get,
path = gtk_tree_row_reference_get_path (row);
file = fm_list_model_file_for_path (info->model, path);
+
if (file)
{
gtk_tree_view_get_cell_area
@@ -1129,12 +1142,10 @@ fm_list_model_file_changed (FMListModel *model, CajaFile *file,
{
FileEntry *parent_file_entry;
GtkTreeIter iter;
- GtkTreePath *path, *parent_path;
+ GtkTreePath *path;
GSequenceIter *ptr;
- int pos_before, pos_after, length, i, old;
- int *new_order;
+ int pos_before, pos_after;
gboolean has_iter;
- GSequence *files;
ptr = lookup_file (model, file, directory);
if (!ptr)
@@ -1151,6 +1162,11 @@ fm_list_model_file_changed (FMListModel *model, CajaFile *file,
if (pos_before != pos_after)
{
+ GtkTreePath *parent_path;
+ int length, i, old;
+ int *new_order;
+ GSequence *files;
+
/* The file moved, we need to send rows_reordered */
parent_file_entry = ((FileEntry *)g_sequence_get (ptr))->parent;
@@ -1214,8 +1230,8 @@ fm_list_model_get_length (FMListModel *model)
static void
fm_list_model_remove (FMListModel *model, GtkTreeIter *iter)
{
- GSequenceIter *ptr, *child_ptr;
- FileEntry *file_entry, *child_file_entry, *parent_file_entry;
+ GSequenceIter *ptr;
+ FileEntry *file_entry, *parent_file_entry;
GtkTreePath *path;
GtkTreeIter parent_iter;
@@ -1224,10 +1240,14 @@ fm_list_model_remove (FMListModel *model, GtkTreeIter *iter)
if (file_entry->files != NULL)
{
+ GSequenceIter *child_ptr = NULL;
+ FileEntry *child_file_entry = NULL;
+
while (g_sequence_get_length (file_entry->files) > 0)
{
child_ptr = g_sequence_get_begin_iter (file_entry->files);
child_file_entry = g_sequence_get (child_ptr);
+
if (child_file_entry->file != NULL)
{
fm_list_model_remove_file (model,
@@ -1317,13 +1337,14 @@ static void
fm_list_model_clear_directory (FMListModel *model, GSequence *files)
{
GtkTreeIter iter;
- FileEntry *file_entry;
+ FileEntry *file_entry = NULL;
while (g_sequence_get_length (files) > 0)
{
iter.user_data = g_sequence_get_begin_iter (files);
file_entry = g_sequence_get (iter.user_data);
+
if (file_entry->files != NULL)
{
fm_list_model_clear_directory (model, file_entry->files);
@@ -1405,8 +1426,7 @@ fm_list_model_load_subdirectory (FMListModel *model, GtkTreePath *path, CajaDire
void
fm_list_model_unload_subdirectory (FMListModel *model, GtkTreeIter *iter)
{
- GSequenceIter *child_ptr;
- FileEntry *file_entry, *child_file_entry;
+ FileEntry *file_entry;
GtkTreeIter child_iter;
file_entry = g_sequence_get (iter->user_data);
@@ -1421,8 +1441,12 @@ fm_list_model_unload_subdirectory (FMListModel *model, GtkTreeIter *iter)
/* Remove all children */
while (g_sequence_get_length (file_entry->files) > 0)
{
+ GSequenceIter *child_ptr;
+ FileEntry *child_file_entry;
+
child_ptr = g_sequence_get_begin_iter (file_entry->files);
child_file_entry = g_sequence_get (child_ptr);
+
if (child_file_entry->file == NULL)
{
/* Don't delete the dummy node */
@@ -1613,12 +1637,13 @@ static void
fm_list_model_dispose (GObject *object)
{
FMListModel *model;
- int i;
model = FM_LIST_MODEL (object);
if (model->details->columns)
{
+ int i;
+
for (i = 0; i < model->details->columns->len; i++)
{
g_object_unref (model->details->columns->pdata[i]);
@@ -1746,8 +1771,7 @@ void
fm_list_model_subdirectory_done_loading (FMListModel *model, CajaDirectory *directory)
{
GtkTreeIter iter;
- GtkTreePath *path;
- FileEntry *file_entry, *dummy_entry;
+ FileEntry *file_entry;
GSequenceIter *parent_ptr, *dummy_ptr;
GSequence *files;
@@ -1771,10 +1795,14 @@ fm_list_model_subdirectory_done_loading (FMListModel *model, CajaDirectory *dire
if (!caja_directory_is_not_empty (directory) &&
g_sequence_get_length (files) == 1)
{
+ FileEntry *dummy_entry;
+
dummy_ptr = g_sequence_get_iter_at_pos (file_entry->files, 0);
dummy_entry = g_sequence_get (dummy_ptr);
if (dummy_entry->file == NULL)
{
+ GtkTreePath *path;
+
/* was the dummy file */
file_entry->loaded = 1;
@@ -1795,7 +1823,7 @@ refresh_row (gpointer data,
CajaFile *file;
FMListModel *model;
GList *iters, *l;
- GtkTreePath *path;
+ GtkTreePath *path = NULL;
model = user_data;
file = data;
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index bcbb0e93..86c79f68 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -466,7 +466,6 @@ stop_drag_check (FMListView *view)
static cairo_surface_t *
get_drag_surface (FMListView *view)
{
- GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
cairo_surface_t *ret;
@@ -479,6 +478,8 @@ get_drag_surface (FMListView *view)
view->details->drag_y,
&path, NULL, NULL, NULL))
{
+ GtkTreeModel *model;
+
model = gtk_tree_view_get_model (view->details->tree_view);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
@@ -994,18 +995,22 @@ unload_file_timeout (gpointer data)
{
struct UnloadDelayData *unload_data = data;
GtkTreeIter iter;
- FMListModel *model;
- GtkTreePath *path;
if (unload_data->view != NULL)
{
+ FMListModel *model;
+
model = unload_data->view->details->model;
+
if (fm_list_model_get_tree_iter_from_file (model,
unload_data->file,
unload_data->directory,
&iter))
{
+ GtkTreePath *path;
+
path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+
if (!gtk_tree_view_row_expanded (unload_data->view->details->tree_view,
path))
{
@@ -1220,12 +1225,14 @@ fm_list_view_reveal_selection (FMDirectoryView *view)
FMListView *list_view;
CajaFile *file;
GtkTreeIter iter;
- GtkTreePath *path;
list_view = FM_LIST_VIEW (view);
file = selection->data;
+
if (fm_list_model_get_first_iter_for_file (list_view->details->model, file, &iter))
{
+ GtkTreePath *path;
+
path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_view->details->model), &iter);
gtk_tree_view_scroll_to_cell (list_view->details->tree_view, path, NULL, FALSE, 0.0, 0.0);
@@ -1241,17 +1248,19 @@ static gboolean
sort_criterion_changes_due_to_user (GtkTreeView *tree_view)
{
GList *columns, *p;
- GtkTreeViewColumn *column;
- GSignalInvocationHint *ihint;
gboolean ret;
+ GtkTreeViewColumn *column = NULL;
+ GSignalInvocationHint *ihint = NULL;
ret = FALSE;
columns = gtk_tree_view_get_columns (tree_view);
+
for (p = columns; p != NULL; p = p->next)
{
column = p->data;
ihint = g_signal_get_invocation_hint (column);
+
if (ihint != NULL)
{
ret = TRUE;
@@ -1590,7 +1599,6 @@ filename_cell_data_func (GtkTreeViewColumn *column,
FMListView *view)
{
char *text;
- GtkTreePath *path;
PangoUnderline underline;
gtk_tree_model_get (model, iter,
@@ -1599,6 +1607,8 @@ filename_cell_data_func (GtkTreeViewColumn *column,
if (click_policy_auto_value == CAJA_CLICK_POLICY_SINGLE)
{
+ GtkTreePath *path;
+
path = gtk_tree_model_get_path (model, iter);
if (view->details->hover_path == NULL ||
@@ -1744,7 +1754,7 @@ create_and_set_up_tree_view (FMListView *view)
for (l = caja_columns; l != NULL; l = l->next)
{
CajaColumn *caja_column;
- int column_num, font_size;
+ int column_num;
char *name;
char *label;
float xalign;
@@ -1763,6 +1773,8 @@ create_and_set_up_tree_view (FMListView *view)
* has the icon in it.*/
if (!strcmp (name, "name"))
{
+ int font_size;
+
/* Create the file name column */
cell = gtk_cell_renderer_pixbuf_new ();
view->details->pixbuf_cell = (GtkCellRendererPixbuf *)cell;
@@ -2018,11 +2030,11 @@ get_default_zoom_level (void)
static void
set_zoom_level_from_metadata_and_preferences (FMListView *list_view)
{
- CajaFile *file;
- int level;
-
if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (list_view)))
{
+ CajaFile *file;
+ int level;
+
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (list_view));
level = caja_file_get_integer_metadata (file,
CAJA_METADATA_KEY_LIST_VIEW_ZOOM_LEVEL,
@@ -2112,7 +2124,6 @@ fm_list_view_file_changed (FMDirectoryView *view, CajaFile *file, CajaDirectory
{
FMListView *listview;
GtkTreeIter iter;
- GtkTreePath *file_path;
listview = FM_LIST_VIEW (view);
@@ -2128,6 +2139,8 @@ fm_list_view_file_changed (FMDirectoryView *view, CajaFile *file, CajaDirectory
*/
if (fm_list_model_get_tree_iter_from_file (listview->details->model, file, directory, &iter))
{
+ GtkTreePath *file_path;
+
file_path = gtk_tree_model_get_path (GTK_TREE_MODEL (listview->details->model), &iter);
gtk_tree_view_scroll_to_cell (listview->details->tree_view,
file_path, NULL,
@@ -2265,13 +2278,11 @@ static void
fm_list_view_remove_file (FMDirectoryView *view, CajaFile *file, CajaDirectory *directory)
{
GtkTreePath *path;
- GtkTreePath *file_path;
GtkTreeIter iter;
GtkTreeIter temp_iter;
GtkTreeRowReference* row_reference;
FMListView *list_view;
GtkTreeModel* tree_model;
- GtkTreeSelection *selection;
path = NULL;
row_reference = NULL;
@@ -2280,6 +2291,9 @@ fm_list_view_remove_file (FMDirectoryView *view, CajaFile *file, CajaDirectory *
if (fm_list_model_get_tree_iter_from_file (list_view->details->model, file, directory, &iter))
{
+ GtkTreePath *file_path;
+ GtkTreeSelection *selection;
+
selection = gtk_tree_view_get_selection (list_view->details->tree_view);
file_path = gtk_tree_model_get_path (tree_model, &iter);
@@ -2336,7 +2350,7 @@ fm_list_view_set_selection (FMDirectoryView *view, GList *selection)
GtkTreeSelection *tree_selection;
GList *node;
GList *iters, *l;
- CajaFile *file;
+ CajaFile *file = NULL;
list_view = FM_LIST_VIEW (view);
tree_selection = gtk_tree_view_get_selection (list_view->details->tree_view);
@@ -2344,6 +2358,7 @@ fm_list_view_set_selection (FMDirectoryView *view, GList *selection)
g_signal_handlers_block_by_func (tree_selection, list_selection_changed_callback, view);
gtk_tree_selection_unselect_all (tree_selection);
+
for (node = selection; node != NULL; node = node->next)
{
file = node->data;
@@ -2368,7 +2383,7 @@ fm_list_view_invert_selection (FMDirectoryView *view)
GtkTreeSelection *tree_selection;
GList *node;
GList *iters, *l;
- CajaFile *file;
+ CajaFile *file = NULL;
GList *selection = NULL;
list_view = FM_LIST_VIEW (view);
@@ -2725,17 +2740,19 @@ fm_list_view_scale_font_size (FMListView *view,
GList *l;
static gboolean first_time = TRUE;
static double pango_scale[7];
- int medium;
- int i;
g_return_if_fail (new_level >= CAJA_ZOOM_LEVEL_SMALLEST &&
new_level <= CAJA_ZOOM_LEVEL_LARGEST);
if (first_time)
{
+ int medium;
+ int i;
+
first_time = FALSE;
medium = CAJA_ZOOM_LEVEL_SMALLER;
pango_scale[medium] = PANGO_SCALE_MEDIUM;
+
for (i = medium; i > CAJA_ZOOM_LEVEL_SMALLEST; i--)
{
pango_scale[i - 1] = (1 / 1.2) * pango_scale[i];
@@ -2943,11 +2960,9 @@ fm_list_view_start_renaming_file (FMDirectoryView *view,
static void
fm_list_view_click_policy_changed (FMDirectoryView *directory_view)
{
- GdkWindow *win;
GdkDisplay *display;
FMListView *view;
GtkTreeIter iter;
- GtkTreeView *tree;
view = FM_LIST_VIEW (directory_view);
display = gtk_widget_get_display (GTK_WIDGET (view));
@@ -2955,6 +2970,8 @@ fm_list_view_click_policy_changed (FMDirectoryView *directory_view)
/* ensure that we unset the hand cursor and refresh underlined rows */
if (click_policy_auto_value == CAJA_CLICK_POLICY_DOUBLE)
{
+ GtkTreeView *tree;
+
if (view->details->hover_path != NULL)
{
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (view->details->model),
@@ -2969,8 +2986,11 @@ fm_list_view_click_policy_changed (FMDirectoryView *directory_view)
}
tree = view->details->tree_view;
+
if (gtk_widget_get_realized (GTK_WIDGET (tree)))
{
+ GdkWindow *win;
+
win = gtk_widget_get_window (GTK_WIDGET (tree));
gdk_window_set_cursor (win, NULL);
@@ -3223,13 +3243,14 @@ static void
list_view_scroll_to_file (CajaView *view,
const char *uri)
{
- CajaFile *file;
-
if (uri != NULL)
{
+ CajaFile *file;
+
/* Only if existing, since we don't want to add the file to
the directory if it has been removed since then */
file = caja_file_get_existing_by_uri (uri);
+
if (file != NULL)
{
fm_list_view_scroll_to_file (FM_LIST_VIEW (view), file);
@@ -3279,7 +3300,6 @@ real_set_is_active (FMDirectoryView *view,
gboolean is_active)
{
GtkWidget *tree_view;
- GtkStyleContext *style;
GdkRGBA color;
GdkRGBA *c;
@@ -3291,6 +3311,8 @@ real_set_is_active (FMDirectoryView *view,
}
else
{
+ GtkStyleContext *style;
+
style = gtk_widget_get_style_context (tree_view);
gtk_style_context_get (style, GTK_STATE_FLAG_INSENSITIVE,
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 19954678..24674bea 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -290,17 +290,19 @@ static CajaFile *
get_target_file_for_original_file (CajaFile *file)
{
CajaFile *target_file;
- GFile *location;
- char *uri_to_display;
- CajaDesktopLink *link;
target_file = NULL;
if (CAJA_IS_DESKTOP_ICON_FILE (file)) {
+ CajaDesktopLink *link;
+
link = caja_desktop_icon_file_get_link (CAJA_DESKTOP_ICON_FILE (file));
if (link != NULL) {
+ GFile *location;
+
/* map to linked URI for these types of links */
location = caja_desktop_link_get_activation_location (link);
+
if (location) {
target_file = caja_file_get (location);
g_object_unref (location);
@@ -309,7 +311,10 @@ get_target_file_for_original_file (CajaFile *file)
g_object_unref (link);
}
} else {
+ char *uri_to_display;
+
uri_to_display = caja_file_get_activation_uri (file);
+
if (uri_to_display != NULL) {
target_file = caja_file_get_by_uri (uri_to_display);
g_free (uri_to_display);
@@ -761,7 +766,6 @@ name_field_done_editing (CajaEntry *name_field, FMPropertiesWindow *window)
{
CajaFile *file;
char *new_name;
- const char *original_name;
g_return_if_fail (CAJA_IS_ENTRY (name_field));
@@ -785,6 +789,8 @@ name_field_done_editing (CajaEntry *name_field, FMPropertiesWindow *window)
if (strlen (new_name) == 0) {
name_field_restore_original_name (CAJA_ENTRY (name_field));
} else {
+ const char *original_name;
+
original_name = (const char *) g_object_get_data (G_OBJECT (window->details->name_field),
"original_name");
/* Don't rename if not changed since we read the display name.
@@ -991,17 +997,20 @@ emblem_button_update (FMPropertiesWindow *window,
static void
update_properties_window_title (FMPropertiesWindow *window)
{
- char *name, *title;
- CajaFile *file;
+ char *title;
g_return_if_fail (GTK_IS_WINDOW (window));
title = g_strdup_printf (_("Properties"));
if (!is_multi_file_window (window)) {
+ CajaFile *file;
+
file = get_original_file (window);
if (file != NULL) {
+ char *name;
+
g_free (title);
name = caja_file_get_display_name (file);
title = g_strdup_printf (_("%s Properties"), name);
@@ -1019,7 +1028,7 @@ clear_extension_pages (FMPropertiesWindow *window)
{
int i;
int num_pages;
- GtkWidget *page;
+ GtkWidget *page = NULL;
num_pages = gtk_notebook_get_n_pages
(GTK_NOTEBOOK (window->details->notebook));
@@ -1127,7 +1136,7 @@ properties_window_update (FMPropertiesWindow *window,
GList *l;
GList *mime_list;
GList *tmp;
- CajaFile *changed_file;
+ CajaFile *changed_file = NULL;
gboolean dirty_original = FALSE;
gboolean dirty_target = FALSE;
@@ -1316,7 +1325,6 @@ value_field_update_internal (GtkLabel *label,
const char *attribute_name;
char *attribute_value;
char *inconsistent_string;
- char *mime_type, *tmp;
g_assert (GTK_IS_LABEL (label));
@@ -1326,10 +1334,14 @@ value_field_update_internal (GtkLabel *label,
attribute_name,
inconsistent_string);
if (!strcmp (attribute_name, "type") && strcmp (attribute_value, inconsistent_string)) {
+ char *mime_type;
+
mime_type = file_list_get_string_attribute (file_list,
"mime_type",
inconsistent_string);
if (strcmp (mime_type, inconsistent_string)) {
+ char *tmp;
+
tmp = attribute_value;
attribute_value = g_strdup_printf (C_("MIME type description (MIME type)", "%s (%s)"), attribute_value, mime_type);
g_free (tmp);
@@ -1610,7 +1622,6 @@ unschedule_or_cancel_group_change (FMPropertiesWindow *window)
static void
changed_group_callback (GtkComboBox *combo_box, CajaFile *file)
{
- FMPropertiesWindow *window;
char *group;
char *cur_group;
@@ -1621,6 +1632,8 @@ changed_group_callback (GtkComboBox *combo_box, CajaFile *file)
cur_group = caja_file_get_group_name (file);
if (group != NULL && strcmp (group, cur_group) != 0) {
+ FMPropertiesWindow *window;
+
/* Try to change file group. If this fails, complain to user. */
window = FM_PROPERTIES_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (combo_box), GTK_TYPE_WINDOW));
@@ -1679,13 +1692,14 @@ static char *
combo_box_get_active_entry (GtkComboBox *combo_box,
unsigned int column)
{
- GtkTreeModel *model;
GtkTreeIter iter;
char *val;
g_assert (GTK_IS_COMBO_BOX (combo_box));
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter)) {
+ GtkTreeModel *model;
+
model = gtk_combo_box_get_model (combo_box);
g_assert (GTK_IS_TREE_MODEL (model));
@@ -1708,7 +1722,6 @@ tree_model_get_entry_index (GtkTreeModel *model,
const char *entry)
{
GtkTreeIter iter;
- int index;
gboolean empty_model;
g_assert (GTK_IS_TREE_MODEL (model));
@@ -1716,6 +1729,8 @@ tree_model_get_entry_index (GtkTreeModel *model,
empty_model = !gtk_tree_model_get_iter_first (model, &iter);
if (!empty_model && entry != NULL) {
+ int index;
+
index = 0;
do {
@@ -1745,9 +1760,7 @@ synch_groups_combo_box (GtkComboBox *combo_box, CajaFile *file)
GList *node;
GtkTreeModel *model;
GtkListStore *store;
- const char *group_name;
char *current_group_name;
- int group_index;
int current_group_index;
g_assert (GTK_IS_COMBO_BOX (combo_box));
@@ -1764,6 +1777,8 @@ synch_groups_combo_box (GtkComboBox *combo_box, CajaFile *file)
g_assert (GTK_IS_LIST_STORE (model));
if (!tree_model_entries_equal (model, 0, groups)) {
+ int group_index;
+
/* Clear the contents of ComboBox in a wacky way because there
* is no function to clear all items and also no function to obtain
* the number of items in a combobox.
@@ -1771,6 +1786,8 @@ synch_groups_combo_box (GtkComboBox *combo_box, CajaFile *file)
gtk_list_store_clear (store);
for (node = groups, group_index = 0; node != NULL; node = node->next, ++group_index) {
+ const char *group_name;
+
group_name = (const char *)node->data;
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), group_name);
}
@@ -2020,7 +2037,6 @@ unschedule_or_cancel_owner_change (FMPropertiesWindow *window)
static void
changed_owner_callback (GtkComboBox *combo_box, CajaFile* file)
{
- FMPropertiesWindow *window;
char *owner_text;
char **name_array;
char *new_owner;
@@ -2038,6 +2054,8 @@ changed_owner_callback (GtkComboBox *combo_box, CajaFile* file)
cur_owner = caja_file_get_owner_name (file);
if (strcmp (new_owner, cur_owner) != 0) {
+ FMPropertiesWindow *window;
+
/* Try to change file owner. If this fails, complain to user. */
window = FM_PROPERTIES_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (combo_box), GTK_TYPE_WINDOW));
@@ -2058,10 +2076,8 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file)
GtkTreeIter iter;
char *user_name;
char *owner_name;
- int user_index;
int owner_index;
char **name_array;
- char *combo_text;
g_assert (GTK_IS_COMBO_BOX (combo_box));
g_assert (CAJA_IS_FILE (file));
@@ -2077,6 +2093,8 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file)
g_assert (GTK_IS_LIST_STORE (model));
if (!tree_model_entries_equal (model, 1, users)) {
+ int user_index;
+
/* Clear the contents of ComboBox in a wacky way because there
* is no function to clear all items and also no function to obtain
* the number of items in a combobox.
@@ -2084,6 +2102,8 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file)
gtk_list_store_clear (store);
for (node = users, user_index = 0; node != NULL; node = node->next, ++user_index) {
+ char *combo_text;
+
user_name = (char *)node->data;
name_array = g_strsplit (user_name, "\n", 2);
@@ -2208,11 +2228,11 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
goffset total_size;
goffset total_size_on_disk;
gboolean used_two_lines;
- CajaFile *file;
GList *l;
guint file_unreadable;
goffset file_size;
goffset file_size_on_disk;
+ CajaFile *file = NULL;
g_assert (FM_IS_PROPERTIES_WINDOW (window));
@@ -2369,7 +2389,7 @@ attach_directory_contents_value_field (FMPropertiesWindow *window,
{
GtkLabel *value_field;
GList *l;
- CajaFile *file;
+ CajaFile *file = NULL;
value_field = attach_value_label (grid, sibling, "");
@@ -3041,7 +3061,6 @@ create_pie_widget (FMPropertiesWindow *window)
gchar *capacity;
gchar *used;
gchar *free;
- const char *fs_type;
gchar *uri;
gchar *concat;
GFile *location;
@@ -3122,7 +3141,10 @@ create_pie_widget (FMPropertiesWindow *window)
info = g_file_query_filesystem_info (location, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
NULL, NULL);
if (info) {
+ const char *fs_type;
+
fs_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
+
if (fs_type != NULL) {
concat = g_strconcat (_("Filesystem type:"), " ", fs_type, NULL);
gtk_label_set_text (GTK_LABEL (fstype_label), concat);
@@ -3207,7 +3229,6 @@ create_basic_page (FMPropertiesWindow *window)
{
GtkGrid *grid;
GtkWidget *icon_pixmap_widget;
- GtkWidget *volume_usage;
GtkWidget *hbox, *vbox;
hbox = create_page_with_hbox (window->details->notebook, _("Basic"));
@@ -3330,6 +3351,8 @@ create_basic_page (FMPropertiesWindow *window)
}
if (should_show_volume_usage (window)) {
+ GtkWidget *volume_usage;
+
volume_usage = create_volume_usage_widget (window);
gtk_container_add_with_properties (GTK_CONTAINER (grid), volume_usage,
"width", 2,
@@ -3420,7 +3443,6 @@ static void
create_emblems_page (FMPropertiesWindow *window)
{
GtkWidget *emblems_table, *button, *scroller;
- char *emblem_name;
GdkPixbuf *pixbuf;
char *label;
GList *icons, *l;
@@ -3447,6 +3469,8 @@ create_emblems_page (FMPropertiesWindow *window)
l = icons;
while (l != NULL) {
+ char *emblem_name;
+
emblem_name = l->data;
l = l->next;
@@ -4365,13 +4389,13 @@ create_simple_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
GtkLabel *owner_label;
GtkLabel *execute_label;
GtkWidget *value;
- GtkComboBox *group_combo_box;
- GtkComboBox *owner_combo_box;
has_file = files_has_file (window);
has_directory = files_has_directory (window);
if (!is_multi_file_window (window) && caja_file_can_set_owner (get_target_file (window))) {
+ GtkComboBox *owner_combo_box;
+
owner_label = attach_title_field (page_grid, _("_Owner:"));
/* Combo box in this case. */
owner_combo_box = attach_owner_combo_box (page_grid,
@@ -4402,6 +4426,8 @@ create_simple_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
append_blank_slim_row (page_grid);
if (!is_multi_file_window (window) && caja_file_can_set_group (get_target_file (window))) {
+ GtkComboBox *group_combo_box;
+
group_label = attach_title_field (page_grid, _("_Group:"));
/* Combo box in this case. */
@@ -4557,11 +4583,10 @@ create_advanced_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
{
GtkLabel *group_label;
GtkLabel *owner_label;
- GtkComboBox *group_combo_box;
- GtkComboBox *owner_combo_box;
gboolean has_directory, has_file;
if (!is_multi_file_window (window) && caja_file_can_set_owner (get_target_file (window))) {
+ GtkComboBox *owner_combo_box;
owner_label = attach_title_field (page_grid, _("_Owner:"));
/* Combo box in this case. */
@@ -4585,6 +4610,8 @@ create_advanced_permissions (FMPropertiesWindow *window, GtkGrid *page_grid)
}
if (!is_multi_file_window (window) && caja_file_can_set_group (get_target_file (window))) {
+ GtkComboBox *group_combo_box;
+
group_label = attach_title_field (page_grid, _("_Group:"));
/* Combo box in this case. */
@@ -4649,13 +4676,14 @@ apply_recursive_clicked (GtkWidget *recursive_button,
guint32 file_permission, file_permission_mask;
guint32 dir_permission, dir_permission_mask;
guint32 vfs_mask, vfs_new_perm, p;
- GtkWidget *button, *combo;
gboolean active, is_folder, is_special, use_original;
GList *l;
GtkTreeModel *model;
GtkTreeIter iter;
PermissionType type;
int new_perm, mask;
+ GtkWidget *button = NULL;
+ GtkWidget *combo = NULL;
file_permission = 0;
file_permission_mask = 0;
@@ -4728,12 +4756,13 @@ apply_recursive_clicked (GtkWidget *recursive_button,
for (l = window->details->target_files; l != NULL; l = l->next) {
CajaFile *file;
- char *uri;
file = CAJA_FILE (l->data);
if (caja_file_is_directory (file) &&
caja_file_can_set_permissions (file)) {
+ char *uri;
+
uri = caja_file_get_uri (file);
start_long_operation (window);
g_object_ref (window);
@@ -4752,9 +4781,7 @@ apply_recursive_clicked (GtkWidget *recursive_button,
static void
create_permissions_page (FMPropertiesWindow *window)
{
- GtkWidget *vbox, *button, *hbox;
- GtkGrid *page_grid;
- char *file_name, *prompt_text;
+ GtkWidget *vbox;
GList *file_list;
vbox = create_page_with_vbox (window->details->notebook,
@@ -4765,6 +4792,8 @@ create_permissions_page (FMPropertiesWindow *window)
window->details->initial_permissions = NULL;
if (all_can_get_permissions (file_list) && all_can_get_permissions (window->details->target_files)) {
+ GtkGrid *page_grid;
+
window->details->initial_permissions = get_initial_permissions (window->details->target_files);
window->details->has_recursive_apply = files_has_changable_permissions_directory (window);
@@ -4801,6 +4830,8 @@ create_permissions_page (FMPropertiesWindow *window)
FALSE);
if (window->details->has_recursive_apply) {
+ GtkWidget *button, *hbox;
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (hbox);
gtk_container_add_with_properties (GTK_CONTAINER (page_grid), hbox,
@@ -4815,7 +4846,11 @@ create_permissions_page (FMPropertiesWindow *window)
window);
}
} else {
+ char *prompt_text;
+
if (!is_multi_file_window (window)) {
+ char *file_name;
+
file_name = caja_file_get_display_name (get_target_file (window));
prompt_text = g_strdup_printf (_("The permissions of \"%s\" could not be determined."), file_name);
g_free (file_name);
@@ -5055,15 +5090,18 @@ create_open_with_page (FMPropertiesWindow *window)
{
GtkWidget *vbox;
char *mime_type;
- char *uri;
mime_type = caja_file_get_mime_type (get_target_file (window));
if (!is_multi_file_window (window)) {
+ char *uri;
+
uri = caja_file_get_uri (get_target_file (window));
+
if (uri == NULL) {
return;
}
+
vbox = caja_mime_application_chooser_new (uri, mime_type);
g_free (uri);
@@ -5567,10 +5605,7 @@ make_relative_uri_from_full (const char *uri,
static void
set_icon (const char* icon_uri, FMPropertiesWindow *properties_window)
{
- CajaFile *file;
- char *file_uri;
char *icon_path;
- char *real_icon_uri;
g_assert (icon_uri != NULL);
g_assert (FM_IS_PROPERTIES_WINDOW (properties_window));
@@ -5579,8 +5614,11 @@ set_icon (const char* icon_uri, FMPropertiesWindow *properties_window)
/* we don't allow remote URIs */
if (icon_path != NULL) {
GList *l;
+ CajaFile *file = NULL;
for (l = properties_window->details->original_files; l != NULL; l = l->next) {
+ char *file_uri;
+
file = CAJA_FILE (l->data);
file_uri = caja_file_get_uri (file);
@@ -5592,7 +5630,10 @@ set_icon (const char* icon_uri, FMPropertiesWindow *properties_window)
CAJA_FILE_ATTRIBUTE_LINK_INFO);
}
} else {
+ char *real_icon_uri;
+
real_icon_uri = make_relative_uri_from_full (icon_uri, file_uri);
+
if (real_icon_uri == NULL) {
real_icon_uri = g_strdup (icon_uri);
}
@@ -5614,10 +5655,8 @@ static void
update_preview_callback (GtkFileChooser *icon_chooser,
FMPropertiesWindow *window)
{
- GtkWidget *preview_widget;
GdkPixbuf *pixbuf, *scaled_pixbuf;
char *filename;
- double scale;
pixbuf = NULL;
@@ -5627,10 +5666,14 @@ update_preview_callback (GtkFileChooser *icon_chooser,
}
if (pixbuf != NULL) {
+ GtkWidget *preview_widget;
+
preview_widget = gtk_file_chooser_get_preview_widget (icon_chooser);
gtk_file_chooser_set_preview_widget_active (icon_chooser, TRUE);
if (gdk_pixbuf_get_width (pixbuf) > PREVIEW_IMAGE_WIDTH) {
+ double scale;
+
scale = (double)gdk_pixbuf_get_height (pixbuf) /
gdk_pixbuf_get_width (pixbuf);
@@ -5683,11 +5726,9 @@ static void
select_image_button_callback (GtkWidget *widget,
FMPropertiesWindow *window)
{
- GtkWidget *dialog, *preview;
- GtkFileFilter *filter;
+ GtkWidget *dialog;
GList *l;
CajaFile *file;
- char *uri;
char *image_path;
gboolean revert_is_sensitive;
@@ -5696,6 +5737,9 @@ select_image_button_callback (GtkWidget *widget,
dialog = window->details->icon_chooser;
if (dialog == NULL) {
+ GtkWidget *preview;
+ GtkFileFilter *filter;
+
dialog = eel_file_chooser_dialog_new (_("Select Custom Icon"), GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_OPEN,
"document-revert", GTK_RESPONSE_NO,
@@ -5730,6 +5774,8 @@ select_image_button_callback (GtkWidget *widget,
file = CAJA_FILE (window->details->original_files->data);
if (caja_file_is_directory (file)) {
+ char *uri;
+
uri = caja_file_get_uri (file);
image_path = g_filename_from_uri (uri, NULL, NULL);
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index e95a6079..7d789edf 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -284,7 +284,6 @@ get_menu_icon_for_file (TreeNode *node,
CajaFileIconFlags flags)
{
CajaIconInfo *info;
- GIcon *gicon, *emblem_icon, *emblemed_icon;
GEmblem *emblem;
cairo_surface_t *surface, *retval;
gboolean highlight;
@@ -293,6 +292,8 @@ get_menu_icon_for_file (TreeNode *node,
GList *emblem_icons, *l;
char *emblems_to_ignore[3];
int i;
+ GIcon *gicon, *emblemed_icon;
+ GIcon *emblem_icon = NULL;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
@@ -685,10 +686,11 @@ static void
report_dummy_row_deleted (FMTreeModel *model, TreeNode *parent)
{
GtkTreeIter iter;
- GtkTreePath *path;
if (parent->inserted)
{
+ GtkTreePath *path;
+
make_iter_for_node (parent, &iter, model->details->stamp);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
gtk_tree_path_append_index (path, 0);
@@ -1309,7 +1311,6 @@ fm_tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
TreeNode *node, *parent, *cnode;
GtkTreePath *path;
GtkTreeIter parent_iter;
- int i;
g_return_val_if_fail (FM_IS_TREE_MODEL (model), NULL);
tree_model = FM_TREE_MODEL (model);
@@ -1319,6 +1320,7 @@ fm_tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
if (node == NULL)
{
parent = iter->user_data2;
+
if (parent == NULL)
{
return gtk_tree_path_new ();
@@ -1327,8 +1329,11 @@ fm_tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
else
{
parent = node->parent;
+
if (parent == NULL)
{
+ int i;
+
i = 0;
for (cnode = tree_model->details->root_node; cnode != node; cnode = cnode->next)
{
@@ -1355,7 +1360,7 @@ fm_tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
static void
fm_tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter, int column, GValue *value)
{
- TreeNode *node, *parent;
+ TreeNode *node;
g_return_if_fail (FM_IS_TREE_MODEL (model));
g_return_if_fail (iter_is_valid (FM_TREE_MODEL (model), iter));
@@ -1368,6 +1373,8 @@ fm_tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter, int column, GVa
g_value_init (value, G_TYPE_STRING);
if (node == NULL)
{
+ TreeNode *parent;
+
parent = iter->user_data2;
g_value_set_static_string (value, parent->done_loading
? _("(Empty)") : _("Loading..."));
@@ -1631,9 +1638,6 @@ static void
fm_tree_model_ref_node (GtkTreeModel *model, GtkTreeIter *iter)
{
TreeNode *node, *parent;
-#ifdef LOG_REF_COUNTS
- char *uri;
-#endif
g_return_if_fail (FM_IS_TREE_MODEL (model));
g_return_if_fail (iter_is_valid (FM_TREE_MODEL (model), iter));
@@ -1664,6 +1668,8 @@ fm_tree_model_ref_node (GtkTreeModel *model, GtkTreeIter *iter)
schedule_monitoring_update (FM_TREE_MODEL (model));
}
#ifdef LOG_REF_COUNTS
+ char *uri;
+
uri = get_node_uri (iter);
g_message ("ref of %s, count is now %d",
uri, parent->all_children_ref_count);
@@ -1676,9 +1682,6 @@ static void
fm_tree_model_unref_node (GtkTreeModel *model, GtkTreeIter *iter)
{
TreeNode *node, *parent;
-#ifdef LOG_REF_COUNTS
- char *uri;
-#endif
g_return_if_fail (FM_IS_TREE_MODEL (model));
g_return_if_fail (iter_is_valid (FM_TREE_MODEL (model), iter));
@@ -1701,6 +1704,8 @@ fm_tree_model_unref_node (GtkTreeModel *model, GtkTreeIter *iter)
{
g_assert (parent->all_children_ref_count > 0);
#ifdef LOG_REF_COUNTS
+ char *uri;
+
uri = get_node_uri (iter);
g_message ("unref of %s, count is now %d",
uri, parent->all_children_ref_count - 1);
@@ -1775,8 +1780,6 @@ void
fm_tree_model_remove_root_uri (FMTreeModel *model, const char *uri)
{
TreeNode *node;
- GtkTreePath *path;
- FMTreeModelRoot *root;
CajaFile *file;
file = caja_file_get_by_uri (uri);
@@ -1791,6 +1794,9 @@ fm_tree_model_remove_root_uri (FMTreeModel *model, const char *uri)
if (node)
{
+ GtkTreePath *path;
+ FMTreeModelRoot *root;
+
/* remove the node */
if (node->mount)
@@ -2006,10 +2012,10 @@ void
fm_tree_model_set_highlight_for_files (FMTreeModel *model,
GList *files)
{
- GList *old_files;
-
if (model->details->highlighted_files != NULL)
{
+ GList *old_files;
+
old_files = model->details->highlighted_files;
model->details->highlighted_files = NULL;
@@ -2045,7 +2051,7 @@ fm_tree_model_finalize (GObject *object)
{
FMTreeModel *model;
TreeNode *root_node, *next_root;
- FMTreeModelRoot *root;
+ FMTreeModelRoot *root = NULL;
model = FM_TREE_MODEL (object);
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 6f8f776c..edc5b138 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -236,7 +236,7 @@ static gboolean
show_selection_idle_callback (gpointer callback_data)
{
FMTreeView *view;
- CajaFile *file, *old_file;
+ CajaFile *file;
GtkTreeIter iter;
GtkTreePath *path, *sort_path;
@@ -252,6 +252,8 @@ show_selection_idle_callback (gpointer callback_data)
if (!caja_file_is_directory (file))
{
+ CajaFile *old_file;
+
old_file = file;
file = caja_file_get_parent (file);
caja_file_unref (old_file);