Browse Source

Get rid of custom IS_STRING macro.

upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
b996e6ba48
  1. 3
      common/panel-private.h
  2. 4
      libxfce4panel/xfce-panel-image.c
  3. 2
      panel/panel-application.c
  4. 5
      panel/panel-dbus-client.c
  5. 2
      panel/panel-item-dialog.c
  6. 4
      panel/panel-module.c
  7. 6
      plugins/clock/clock.c
  8. 11
      plugins/systray/systray-box.c
  9. 6
      plugins/systray/systray.c
  10. 6
      plugins/windowmenu/windowmenu.c

3
common/panel-private.h

@ -51,9 +51,6 @@
#define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END
#define PANEL_HAS_FLAG(flags,flag) (((flags) & (flag)) != 0)
/* check if the string is not empty */
#define IS_STRING(string) ((string) != NULL && *(string) != '\0')
/* relative path to the plugin directory */
#define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel"

4
libxfce4panel/xfce-panel-image.c

@ -496,7 +496,7 @@ xfce_panel_image_new_from_pixbuf (GdkPixbuf *pixbuf)
GtkWidget *
xfce_panel_image_new_from_source (const gchar *source)
{
g_return_val_if_fail (IS_STRING (source), NULL);
g_return_val_if_fail (source != NULL && *source != '\0', NULL);
return g_object_new (XFCE_TYPE_PANEL_IMAGE,
"source", source, NULL);
@ -527,7 +527,7 @@ xfce_panel_image_set_from_source (XfcePanelImage *image,
const gchar *source)
{
g_return_if_fail (XFCE_IS_PANEL_IMAGE (image));
g_return_if_fail (IS_STRING (source));
g_return_if_fail (source != NULL && *source != '\0');
xfce_panel_image_clear (image);

2
panel/panel-application.c

@ -411,7 +411,7 @@ panel_application_plugin_delete_config (PanelApplication *application,
gchar *filename, *path;
panel_return_if_fail (PANEL_IS_APPLICATION (application));
panel_return_if_fail (IS_STRING (name));
panel_return_if_fail (!exo_str_is_empty (name));
panel_return_if_fail (unique_id != -1);
/* remove the xfconf property */

5
panel/panel-dbus-client.c

@ -24,6 +24,7 @@
#include <stdlib.h>
#endif
#include <exo/exo.h>
#include <dbus/dbus-glib.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
@ -218,8 +219,8 @@ panel_dbus_client_plugin_event (const gchar *plugin_event,
n_tokens = g_strv_length (tokens);
if (!(n_tokens == 2 || n_tokens == N_TOKENS)
|| !IS_STRING (tokens[PLUGIN_NAME])
|| !IS_STRING (tokens[NAME])
|| exo_str_is_empty (tokens[PLUGIN_NAME])
|| exo_str_is_empty (tokens[NAME])
|| *tokens[NAME] == SIGNAL_PREFIX)
{
g_set_error_literal (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,

2
panel/panel-item-dialog.c

@ -610,7 +610,7 @@ panel_item_dialog_visible_func (GtkTreeModel *model,
/* search string from dialog */
text = gtk_entry_get_text (entry);
if (G_UNLIKELY (!IS_STRING (text)))
if (G_UNLIKELY (exo_str_is_empty (text)))
return TRUE;
gtk_tree_model_get (model, iter, COLUMN_MODULE, &module, -1);

4
panel/panel-module.c

@ -289,8 +289,8 @@ panel_module_new_from_desktop_file (const gchar *filename,
gchar *path;
const gchar *module_exec;
panel_return_val_if_fail (IS_STRING (filename), NULL);
panel_return_val_if_fail (IS_STRING (name), NULL);
panel_return_val_if_fail (!exo_str_is_empty (filename), NULL);
panel_return_val_if_fail (!exo_str_is_empty (name), NULL);
rc = xfce_rc_simple_open (filename, TRUE);
if (G_UNLIKELY (rc == NULL))

6
plugins/clock/clock.c

@ -587,7 +587,7 @@ clock_plugin_configure_plugin_chooser_fill (GtkComboBox *combo,
g_free (preview);
if (has_active == FALSE
&& IS_STRING (active_format)
&& !exo_str_is_empty (active_format)
&& strcmp (active_format, formats[i]) == 0)
{
gtk_combo_box_set_active_iter (combo, &iter);
@ -937,7 +937,7 @@ clock_plugin_strdup_strftime (const gchar *format,
gchar buffer[1024];
/* leave when format is null */
if (G_UNLIKELY (!IS_STRING (format)))
if (G_UNLIKELY (exo_str_is_empty (format)))
return NULL;
/* convert to locale, because that's what strftime uses */
@ -966,7 +966,7 @@ clock_plugin_interval_from_format (const gchar *format)
{
const gchar *p;
if (G_UNLIKELY (!IS_STRING (format)))
if (G_UNLIKELY (exo_str_is_empty (format)))
return CLOCK_INTERVAL_MINUTE;
for (p = format; *p != '\0'; ++p)

11
plugins/systray/systray-box.c

@ -24,6 +24,7 @@
#include <string.h>
#endif
#include <exo/exo.h>
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
@ -640,12 +641,12 @@ systray_box_compare_function (gconstpointer a,
return (child_a->auto_hide ? -1 : 1);
/* put icons without name after the hidden icons */
if (!IS_STRING (child_a->name) || !IS_STRING (child_b->name))
if (exo_str_is_empty (child_a->name) || exo_str_is_empty (child_b->name))
{
if (IS_STRING (child_a->name) == IS_STRING (child_b->name))
if (!exo_str_is_empty (child_a->name) == !exo_str_is_empty (child_b->name))
return 0;
else
return !IS_STRING (child_a->name) ? -1 : 1;
return exo_str_is_empty (child_a->name) ? -1 : 1;
}
/* sort by name */
@ -764,7 +765,7 @@ systray_box_name_add (SystrayBox *box,
gboolean hidden)
{
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
panel_return_if_fail (IS_STRING (name));
panel_return_if_fail (!exo_str_is_empty (name));
/* insert the application */
g_hash_table_insert (box->names, g_strdup (name),
@ -783,7 +784,7 @@ systray_box_name_set_hidden (SystrayBox *box,
gint n_hidden_childeren;
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
panel_return_if_fail (IS_STRING (name));
panel_return_if_fail (!exo_str_is_empty (name));
/* replace the old name */
g_hash_table_replace (box->names, g_strdup (name),

6
plugins/systray/systray.c

@ -541,7 +541,7 @@ systray_plugin_dialog_camel_case (const gchar *text)
gunichar c;
GString *result;
panel_return_val_if_fail (IS_STRING (text), NULL);
panel_return_val_if_fail (!exo_str_is_empty (text), NULL);
/* allocate a new string for the result */
result = g_string_sized_new (32);
@ -582,7 +582,7 @@ systray_plugin_dialog_icon (GtkIconTheme *icon_theme,
gchar *first_occ;
const gchar *p;
panel_return_val_if_fail (IS_STRING (icon_name), NULL);
panel_return_val_if_fail (!exo_str_is_empty (icon_name), NULL);
panel_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), NULL);
/* try to load the icon from the theme */
@ -637,7 +637,7 @@ systray_plugin_dialog_add_application_names (SystrayPlugin *plugin,
name = li->data;
/* skip invalid names */
if (!IS_STRING (name))
if (exo_str_is_empty (name))
continue;
/* init */

6
plugins/windowmenu/windowmenu.c

@ -975,7 +975,7 @@ window_menu_plugin_menu_window_item_new (WnckWindow *window,
/* try to get an utf-8 valid name */
name = wnck_window_get_name (window);
if (IS_STRING (name) && !g_utf8_validate (name, -1, NULL))
if (!exo_str_is_empty (name) && !g_utf8_validate (name, -1, NULL))
name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
if (exo_str_is_empty (name))
@ -1307,12 +1307,12 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin)
{
/* try to get an utf-8 valid name */
name = wnck_workspace_get_name (workspace);
if (IS_STRING (name) && !g_utf8_validate (name, -1, NULL))
if (!exo_str_is_empty (name) && !g_utf8_validate (name, -1, NULL))
name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
}
/* create label */
if (IS_STRING (name))
if (!exo_str_is_empty (name))
label = g_strdup_printf (_("Remove Workspace \"%s\""), name);
else
label = g_strdup_printf (_("Remove Workspace %d"), n_workspaces);

Loading…
Cancel
Save