[Xfce4-commits] <exo:master> Use exo_str_is_empty() in the library.
Nick Schermer
nick at xfce.org
Wed Aug 19 18:16:02 CEST 2009
Updating branch refs/heads/master
to 547d3ea84d9502eeb1e1c8102bdb9812f5cf6ec2 (commit)
from ed360b61b22334a58e3d9e8acfd0ace2b2001dcf (commit)
commit 547d3ea84d9502eeb1e1c8102bdb9812f5cf6ec2
Author: Nick Schermer <nick at xfce.org>
Date: Wed Aug 19 17:27:22 2009 +0200
Use exo_str_is_empty() in the library.
exo-desktop-item-edit/exo-die-editor.c | 12 +++++++-----
exo-helper/exo-helper.c | 6 +++---
exo-mount-notify/main.c | 6 +++---
exo-mount/exo-mount-hal.c | 2 +-
exo-mount/main.c | 6 +++---
exo/exo-thumbnail-preview.c | 3 ++-
exo/exo-toolbars-model.c | 2 +-
python/exo.override | 6 +++---
8 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/exo-desktop-item-edit/exo-die-editor.c b/exo-desktop-item-edit/exo-die-editor.c
index 4773f9a..262caf4 100644
--- a/exo-desktop-item-edit/exo-die-editor.c
+++ b/exo-desktop-item-edit/exo-die-editor.c
@@ -542,7 +542,7 @@ exo_die_editor_icon_clicked (GtkWidget *button,
-1);
/* check if we have an icon to set for the chooser */
- if (G_LIKELY (editor->icon != NULL && *editor->icon != '\0'))
+ if (G_LIKELY (!exo_str_is_empty (editor->icon)))
exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser), editor->icon);
/* run the chooser dialog */
@@ -631,7 +631,7 @@ exo_die_editor_cell_data_func (GtkCellLayout *cell_layout,
/* try to load the icon from the file */
pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
}
- else if (icon != NULL && *icon != '\0')
+ else if (!exo_str_is_empty (icon))
{
/* determine the appropriate icon theme */
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (editor)));
@@ -699,10 +699,12 @@ exo_die_editor_get_complete (ExoDieEditor *editor)
switch (editor->mode)
{
case EXO_DIE_EDITOR_MODE_APPLICATION:
- return (*editor->name != '\0' && *editor->command != '\0');
+ return (!exo_str_is_empty (editor->name)
+ && !exo_str_is_empty (editor->command));
case EXO_DIE_EDITOR_MODE_LINK:
- return (*editor->name != '\0' && *editor->url != '\0');
+ return (!exo_str_is_empty (editor->name)
+ && !exo_str_is_empty (editor->url));
default:
g_assert_not_reached ();
@@ -1040,7 +1042,7 @@ exo_die_editor_set_icon (ExoDieEditor *editor,
/* try to load the icon from the file */
pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
}
- else if (icon != NULL && *icon != '\0')
+ else if (!exo_str_is_empty (icon))
{
/* determine the appropriate icon theme */
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (editor)));
diff --git a/exo-helper/exo-helper.c b/exo-helper/exo-helper.c
index 509d6a1..28ff320 100644
--- a/exo-helper/exo-helper.c
+++ b/exo-helper/exo-helper.c
@@ -184,13 +184,13 @@ exo_helper_new (const gchar *id,
/* determine the name of the helper */
str = xfce_rc_read_entry (rc, "Name", NULL);
- if (G_UNLIKELY (str == NULL || *str == '\0'))
+ if (G_UNLIKELY (exo_str_is_empty (str)))
goto failed;
helper->name = g_strdup (str);
/* determine the icon of the helper */
str = xfce_rc_read_entry_untranslated (rc, "Icon", NULL);
- if (G_LIKELY (str != NULL && *str != '\0'))
+ if (G_LIKELY (!exo_str_is_empty (str)))
helper->icon = g_strdup (str);
/* determine the commands */
@@ -820,7 +820,7 @@ exo_helper_database_set_custom (ExoHelperDatabase *database,
g_return_if_fail (EXO_IS_HELPER_DATABASE (database));
g_return_if_fail (category < EXO_HELPER_N_CATEGORIES);
- g_return_if_fail (command != NULL && *command != '\0');
+ g_return_if_fail (!exo_str_is_empty (command));
/* determine the spec for the custom helper */
category_string = exo_helper_category_to_string (category);
diff --git a/exo-mount-notify/main.c b/exo-mount-notify/main.c
index aac2419..a7d506b 100644
--- a/exo-mount-notify/main.c
+++ b/exo-mount-notify/main.c
@@ -43,7 +43,7 @@
#include <libnotify/notify.h>
#include <glib/gstdio.h>
-
+#include <exo/exo.h>
#include <gtk/gtk.h>
/* make sure all defines are present */
@@ -180,11 +180,11 @@ main (int argc, char **argv)
}
/* icon defaults to "gnome-dev-harddisk" */
- if (G_UNLIKELY (opt_icon == NULL || *opt_icon == '\0'))
+ if (G_UNLIKELY (exo_str_is_empty (opt_icon)))
opt_icon = "gnome-dev-harddisk";
/* make sure that a device name was specified */
- if (G_UNLIKELY (opt_name == NULL || *opt_name == '\0'))
+ if (G_UNLIKELY (exo_str_is_empty (opt_name)))
{
/* the caller must specify a usable device name */
g_printerr ("%s: %s.\n", g_get_prgname (), "Must specify a device name");
diff --git a/exo-mount/exo-mount-hal.c b/exo-mount/exo-mount-hal.c
index 44909b2..ea38e76 100644
--- a/exo-mount/exo-mount-hal.c
+++ b/exo-mount/exo-mount-hal.c
@@ -702,7 +702,7 @@ exo_mount_hal_device_mount (ExoMountHalDevice *device,
}
/* make sure that the mount point is usable (i.e. does not contain G_DIR_SEPARATOR's) */
- mount_point = (mount_point != NULL && *mount_point != '\0')
+ mount_point = !exo_str_is_empty (mount_point)
? exo_str_replace (mount_point, G_DIR_SEPARATOR_S, "_")
: g_strdup ("");
diff --git a/exo-mount/main.c b/exo-mount/main.c
index f08439e..1e837c3 100644
--- a/exo-mount/main.c
+++ b/exo-mount/main.c
@@ -42,7 +42,7 @@
#include <glib/gstdio.h>
#include <exo-hal/exo-hal.h>
-
+#include <exo/exo.h>
#include <exo-mount/exo-mount-fstab.h>
#include <exo-mount/exo-mount-hal.h>
#include <exo-mount/exo-mount-utils.h>
@@ -215,7 +215,7 @@ main (int argc, char **argv)
}
/* check if a name was found */
- if (G_UNLIKELY (name == NULL || *name == '\0'))
+ if (G_UNLIKELY (exo_str_is_empty (name)))
{
/* release the previous name */
g_free (name);
@@ -238,7 +238,7 @@ main (int argc, char **argv)
{
nargv[n++] = g_strdup ("--eject");
}
- if (icon != NULL && *icon != '\0')
+ if (!exo_str_is_empty (icon))
{
nargv[n++] = g_strdup ("--icon");
nargv[n++] = g_strdup (icon);
diff --git a/exo/exo-thumbnail-preview.c b/exo/exo-thumbnail-preview.c
index edd784f..603d8cb 100644
--- a/exo/exo-thumbnail-preview.c
+++ b/exo/exo-thumbnail-preview.c
@@ -42,6 +42,7 @@
#include <exo/exo-thumbnail.h>
#include <exo/exo-utils.h>
#include <exo/exo-alias.h>
+#include <exo/exo-string.h>
@@ -328,7 +329,7 @@ _exo_thumbnail_preview_set_uri (ExoThumbnailPreview *thumbnail_preview,
{
/* determine the basename from the URI */
slash = strrchr (uri, '/');
- if (G_LIKELY (slash != NULL && slash[1] != '\0'))
+ if (G_LIKELY (!exo_str_is_empty (slash)))
displayname = g_filename_display_name (slash + 1);
else
displayname = g_filename_display_name (uri);
diff --git a/exo/exo-toolbars-model.c b/exo/exo-toolbars-model.c
index bd8d237..f5c412f 100644
--- a/exo/exo-toolbars-model.c
+++ b/exo/exo-toolbars-model.c
@@ -158,7 +158,7 @@ _exo_accumulator_STRING (GSignalInvocationHint *hint,
const gchar *retval;
retval = g_value_get_string (handler_return);
g_value_set_string (return_accu, retval);
- return (retval == NULL || *retval == '\0');
+ return exo_str_is_empty (retval);
}
diff --git a/python/exo.override b/python/exo.override
index 33c98c0..7001ac7 100644
--- a/python/exo.override
+++ b/python/exo.override
@@ -102,10 +102,10 @@ _wrap_exo_execute_preferred_application (PyObject *self,
return NULL;
}
- if (working_directory != NULL && *working_directory == '\0')
+ if (exo_str_is_empty (working_directory))
working_directory = NULL;
- if (parameter != NULL && *parameter == '\0')
+ if (exo_str_is_empty (parameter))
parameter = NULL;
/* determine the screen */
@@ -177,7 +177,7 @@ _wrap_exo_execute_terminal_shell (PyObject *self,
return NULL;
}
- if (working_directory != NULL && *working_directory == '\0')
+ if (exo_str_is_empty (working_directory))
working_directory = NULL;
/* determine the screen */
More information about the Xfce4-commits
mailing list