gnome-utils r7906 - in trunk/baobab: . src
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-utils r7906 - in trunk/baobab: . src
- Date: Sat, 3 May 2008 09:22:54 +0100 (BST)
Author: pborelli
Date: Sat May 3 08:22:54 2008
New Revision: 7906
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=7906&view=rev
Log:
2008-05-03 Paolo Borelli <pborelli katamail com>
* src/baobab.c:
* src/baobab-scan.c:
* src/baobab-utils.c:
Some leak fixes and cleanups by Cosimo Cecchi.
Modified:
trunk/baobab/ChangeLog
trunk/baobab/src/baobab-scan.c
trunk/baobab/src/baobab-utils.c
trunk/baobab/src/baobab.c
Modified: trunk/baobab/src/baobab-scan.c
==============================================================================
--- trunk/baobab/src/baobab-scan.c (original)
+++ trunk/baobab/src/baobab-scan.c Sat May 3 08:22:54 2008
@@ -274,6 +274,8 @@
g_free (dir_uri);
g_free (dir_path);
g_free (string_to_display);
+ if (err)
+ g_error_free (err);
return retloop;
}
@@ -299,6 +301,9 @@
char *parse_name = g_file_get_parse_name (location);
g_warning ("couldn't get info for dir %s: %s\n",
parse_name, err->message);
+ g_free (parse_name);
+ g_error_free (err);
+
return;
}
Modified: trunk/baobab/src/baobab-utils.c
==============================================================================
--- trunk/baobab/src/baobab-utils.c (original)
+++ trunk/baobab/src/baobab-utils.c Sat May 3 08:22:54 2008
@@ -277,41 +277,41 @@
gboolean
baobab_check_dir (GFile *file)
{
- char *error_msg = NULL;
- gchar *uri = NULL;
GFileInfo *info;
GError *error = NULL;
gboolean ret = TRUE;
-
- info = g_file_query_info (file, "standard::*",
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL,
&error);
-
- if(!info) {
- message("",error->message,
- GTK_MESSAGE_INFO, baobab.window);
+
+ if (!info) {
+ message("", error->message, GTK_MESSAGE_INFO, baobab.window);
+ g_error_free (error);
+
return FALSE;
- }
+ }
- if ((error != NULL) ||
- (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)) {
- uri = g_file_get_uri(file);
+ if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) {
+ char *error_msg = NULL;
+ gchar *name = NULL;
+
+ name = g_file_get_parse_name (file);
error_msg = g_strdup_printf (_("\"%s\" is not a valid folder"),
- uri);
+ name);
message (error_msg, _("Could not analyze disk usage."),
GTK_MESSAGE_ERROR, baobab.window);
g_free (error_msg);
- if (error) g_error_free (error);
- g_free (uri);
+ g_free (name);
ret = FALSE;
}
- if (info) g_object_unref(info);
-
+ g_object_unref(info);
+
return ret;
}
@@ -416,14 +416,15 @@
void
open_file_with_application (GFile *file)
{
- GAppInfo *application ;
+ GAppInfo *application;
gchar *primary;
GFileInfo *info;
gchar *uri_scheme;
- const char *content, *executable;
+ const char *content;
gboolean local = FALSE;
- info = g_file_query_info (file, "standard::*",
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
@@ -434,8 +435,6 @@
content = g_file_info_get_content_type (info);
application = g_app_info_get_default_for_type (content, TRUE);
- if (application) executable = g_app_info_get_executable (application);
-
if (!application) {
primary = g_strdup_printf (_("Could not open folder \"%s\""),
@@ -473,7 +472,8 @@
GFileInfo *info;
gboolean can_trash = FALSE;
- info = g_file_query_info (file, "standard::*",
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
@@ -500,7 +500,8 @@
char *str = NULL;
char *mess;
- info = g_file_query_info (file, "standard::*",
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
Modified: trunk/baobab/src/baobab.c
==============================================================================
--- trunk/baobab/src/baobab.c (original)
+++ trunk/baobab/src/baobab.c Sat May 3 08:22:54 2008
@@ -349,7 +349,7 @@
GtkTreeIter iter;
GString *hardlinks;
GString *basename;
- GString *elementi;
+ GString *elements;
char *size;
char *alloc_size;
char *basename_cstr;
@@ -379,8 +379,8 @@
g_free (size);
}
- elementi = g_string_new ("");
- g_string_printf (elementi,
+ elements = g_string_new ("");
+ g_string_printf (elements,
ngettext ("% 5d item", "% 5d items",
data->elements), data->elements);
@@ -394,7 +394,7 @@
COL_DIR_SIZE,
baobab.show_allocated ? alloc_size : size,
COL_H_SIZE, data->size,
- COL_ELEMENTS, elementi->str,
+ COL_ELEMENTS, elements->str,
COL_H_ELEMENTS, data->elements,
COL_HARDLINK, hardlinks->str,
COL_H_HARDLINK, data->tempHLsize,
@@ -406,7 +406,7 @@
g_string_free (hardlinks, TRUE);
g_string_free (basename, TRUE);
- g_string_free (elementi, TRUE);
+ g_string_free (elements, TRUE);
g_free (size);
g_free (alloc_size);
}
@@ -662,7 +662,10 @@
baobab_init (void)
{
GSList *uri_list, *l;
-
+ GError *error = NULL;
+ GFile *file;
+ monitor_home = NULL;
+
/* Load Glade */
baobab.main_xml = glade_xml_new (BAOBAB_GLADE_FILE,
"baobab_window", NULL);
@@ -725,18 +728,14 @@
baobab_create_statusbar ();
/* start monitoring */
- GError *error = NULL;
- GFile *file;
- monitor_home = NULL;
-
monitor_vol = g_volume_monitor_get ();
g_signal_connect (monitor_vol, "volume_changed",
G_CALLBACK (volume_changed), NULL);
file = g_file_new_for_path (g_get_home_dir ());
- monitor_home = g_file_monitor_directory (file, 0, NULL, NULL);
+ monitor_home = g_file_monitor_directory (file, 0, NULL, &error);
g_object_unref (file);
-
+
if (!monitor_home) {
message (_("Could not initialize monitoring"),
_("Changes to your home folder will not be monitored."),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]