diff options
Diffstat (limited to 'libslab')
-rw-r--r-- | libslab/Makefile.am | 1 | ||||
-rw-r--r-- | libslab/bookmark-agent.c | 58 | ||||
-rw-r--r-- | libslab/libslab-utils.c | 26 | ||||
-rw-r--r-- | libslab/libslab-utils.h | 1 |
4 files changed, 32 insertions, 54 deletions
diff --git a/libslab/Makefile.am b/libslab/Makefile.am index 97deea54..df720566 100644 --- a/libslab/Makefile.am +++ b/libslab/Makefile.am @@ -2,6 +2,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = mate-slab.pc AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"libslab\" \ -I$(top_srcdir) \ $(LIBSLAB_CFLAGS) \ $(WARN_CFLAGS) diff --git a/libslab/bookmark-agent.c b/libslab/bookmark-agent.c index fac010e1..478fd54a 100644 --- a/libslab/bookmark-agent.c +++ b/libslab/bookmark-agent.c @@ -208,13 +208,12 @@ bookmark_agent_move_item (BookmarkAgent *this, const gchar *uri, const gchar *ur if (! TYPE_IS_RECENT (priv->type)) return; - gtk_recent_manager_move_item ( - gtk_recent_manager_get_default (), uri, uri_new, & error); - - if (error) - libslab_handle_g_error ( - & error, "%s: unable to update %s with renamed file, [%s] -> [%s].", - G_STRFUNC, priv->store_path, uri, uri_new); + gtk_recent_manager_move_item (gtk_recent_manager_get_default (), uri, uri_new, &error); + if (error) { + g_warning ("Unable to update %s with renamed file, [%s] -> [%s]: %s", + priv->store_path, uri, uri_new, error->message); + g_error_free (error); + } } void @@ -232,12 +231,12 @@ bookmark_agent_purge_items (BookmarkAgent *this) uris = g_bookmark_file_get_uris (priv->store, &uris_len); if (TYPE_IS_RECENT (priv->type)) { for (i = 0; i < uris_len; i++) { - gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uris [i], & error); - - if (error) - libslab_handle_g_error ( - & error, "%s: unable to remove [%s] from %s.", - G_STRFUNC, priv->store_path, uris [i]); + gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uris [i], &error); + if (error) { + g_warning ("Unable to remove [%s] from %s: %s", + priv->store_path, uris [i], error->message); + g_error_free (error); + } } } else { for (i = 0; i < uris_len; i++) { @@ -267,13 +266,11 @@ bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri) return; if (TYPE_IS_RECENT (priv->type)) { - gtk_recent_manager_remove_item ( - gtk_recent_manager_get_default (), uri, & error); - - if (error) - libslab_handle_g_error ( - & error, "%s: unable to remove [%s] from %s.", - G_STRFUNC, priv->store_path, uri); + gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uri, &error); + if (error) { + g_warning ("Unable to remove [%s] from %s: %s", priv->store_path, uri, error->message); + g_error_free (error); + } } else { rank = get_rank (this, uri); @@ -847,10 +844,12 @@ load_xbel_store (BookmarkAgent *this) g_bookmark_file_free (priv->store); priv->store = g_bookmark_file_new (); - libslab_handle_g_error ( - & error, "%s: couldn't load bookmark file [%s]\n", - G_STRFUNC, priv->store_path ? priv->store_path : "NULL"); - + if (error) { + g_debug ("Couldn't load bookmark file [%s]: %s", priv->store_path, error->message); + g_error_free (error); + } else { + g_debug ("Couldn't load bookmark file [NULL]"); + } return; } @@ -1032,10 +1031,15 @@ save_xbel_store (BookmarkAgent *this) GError *error = NULL; + if (g_bookmark_file_to_file (priv->store, priv->store_path, &error)) + return; - if (! g_bookmark_file_to_file (priv->store, priv->store_path, & error)) - libslab_handle_g_error ( - & error, "%s: couldn't save bookmark file [%s]\n", G_STRFUNC, priv->store_path); + if (error) { + g_warning ("Couldn't save bookmark file [%s]: %s", priv->store_path, error->message); + g_error_free (error); + } else { + g_warning ("Couldn't save bookmark file [%s]", priv->store_path); + } } static void diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c index 67a47d31..557217f0 100644 --- a/libslab/libslab-utils.c +++ b/libslab/libslab-utils.c @@ -107,29 +107,3 @@ libslab_strcmp (const gchar *a, const gchar *b) return strcmp (a, b); } - -void -libslab_handle_g_error (GError **error, const gchar *msg_format, ...) -{ - gchar *msg; - va_list args; - - - va_start (args, msg_format); - msg = g_strdup_vprintf (msg_format, args); - va_end (args); - - if (*error) { - g_log ( - G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, - "\nGError raised: [%s]\nuser_message: [%s]\n", (*error)->message, msg); - - g_error_free (*error); - - *error = NULL; - } - else - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "\nerror raised: [%s]\n", msg); - - g_free (msg); -} diff --git a/libslab/libslab-utils.h b/libslab/libslab-utils.h index ecb2ff6d..e41e8852 100644 --- a/libslab/libslab-utils.h +++ b/libslab/libslab-utils.h @@ -11,7 +11,6 @@ extern "C" { MateDesktopItem *libslab_mate_desktop_item_new_from_unknown_id (const gchar *id); gint libslab_strcmp (const gchar *a, const gchar *b); -void libslab_handle_g_error (GError **error, const gchar *msg_format, ...); GdkScreen *libslab_get_current_screen (void); |