gnome-utils r8360 - trunk/logview
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-utils r8360 - trunk/logview
- Date: Wed, 24 Dec 2008 08:49:55 +0000 (UTC)
Author: cosimoc
Date: Wed Dec 24 08:49:55 2008
New Revision: 8360
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=8360&view=rev
Log:
2008-12-24 Cosimo Cecchi <cosimoc gnome org>
* logview-log.c (log_load):
* logview-log.h:
Set a meaningful error message if we can't read from the log file
(#349756).
Modified:
trunk/logview/ChangeLog
trunk/logview/logview-log.c
trunk/logview/logview-log.h
Modified: trunk/logview/logview-log.c
==============================================================================
--- trunk/logview/logview-log.c (original)
+++ trunk/logview/logview-log.c Wed Dec 24 08:49:55 2008
@@ -613,9 +613,10 @@
GFileType type;
GError *err = NULL;
GTimeVal timeval;
- gboolean is_archive;
+ gboolean is_archive, can_read;
info = g_file_query_info (f,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
@@ -629,6 +630,17 @@
goto out;
}
+ can_read = g_file_info_get_attribute_boolean (info,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
+ if (!can_read) {
+ /* TODO: PolicyKit integration */
+ err = g_error_new_literal (LOGVIEW_ERROR_QUARK, LOGVIEW_ERROR_PERMISSION_DENIED,
+ _("You don't have enough permissions to read the file."));
+ g_object_unref (info);
+
+ goto out;
+ }
+
type = g_file_info_get_file_type (info);
content_type = g_file_info_get_content_type (info);
@@ -639,7 +651,6 @@
{
err = g_error_new_literal (LOGVIEW_ERROR_QUARK, LOGVIEW_ERROR_NOT_A_LOG,
_("The file is not a regular file or is not a text file."));
- job->err = err;
g_object_unref (info);
goto out;
Modified: trunk/logview/logview-log.h
==============================================================================
--- trunk/logview/logview-log.h (original)
+++ trunk/logview/logview-log.h Wed Dec 24 08:49:55 2008
@@ -60,6 +60,7 @@
typedef enum {
LOGVIEW_ERROR_FAILED,
+ LOGVIEW_ERROR_PERMISSION_DENIED,
LOGVIEW_ERROR_ZLIB,
LOGVIEW_ERROR_NOT_SUPPORTED,
LOGVIEW_ERROR_NOT_A_LOG
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]