gnome-panel r11156 - in trunk/gnome-panel: . libpanel-util



Author: vuntz
Date: Mon Jun 30 16:22:38 2008
New Revision: 11156
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11156&view=rev

Log:
2008-06-30  Vincent Untz  <vuntz gnome org>

	s/string_empty/PANEL_GLIB_STR_EMPTY/

	* libpanel-util/Makefile.am: updated
	* libpanel-util/panel-glib.h: add new file, with only the
	PANEL_GLIB_STR_EMPTY macro right now...
	* panel-util.h: remove string_empty

	* launcher.c: (setup_button):
	* panel-addto.c: (panel_addto_make_text),
	(panel_addto_name_change):
	* panel-menu-items.c: (panel_menu_items_append_from_desktop):
	* panel-properties-dialog.c:
	(panel_properties_dialog_setup_image_chooser),
	(panel_properties_dialog_update_background_image):
	* panel-util.c: (panel_util_get_file_display_for_common_files),
	(panel_util_set_tooltip_text):
	* panel.c: (drop_url): actuall do the
	s/string_empty/PANEL_GLIB_STR_EMPTY/


Added:
   trunk/gnome-panel/libpanel-util/panel-glib.h
Modified:
   trunk/gnome-panel/ChangeLog
   trunk/gnome-panel/launcher.c
   trunk/gnome-panel/libpanel-util/Makefile.am
   trunk/gnome-panel/panel-addto.c
   trunk/gnome-panel/panel-menu-items.c
   trunk/gnome-panel/panel-properties-dialog.c
   trunk/gnome-panel/panel-util.c
   trunk/gnome-panel/panel-util.h
   trunk/gnome-panel/panel.c

Modified: trunk/gnome-panel/launcher.c
==============================================================================
--- trunk/gnome-panel/launcher.c	(original)
+++ trunk/gnome-panel/launcher.c	Mon Jun 30 16:22:38 2008
@@ -24,6 +24,7 @@
 #include <libgnomeui/gnome-url.h>
 #include <gdk/gdkx.h>
 
+#include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
 
 #include "launcher.h"
@@ -618,7 +619,7 @@
 						    "Comment");
 
 	/* Setup tooltip */
-	if ( ! string_empty (comment))
+	if (!PANEL_GLIB_STR_EMPTY (comment))
 		str = g_strdup_printf ("%s\n%s", name, comment);
 	else
 		str = g_strdup (name);

Modified: trunk/gnome-panel/libpanel-util/Makefile.am
==============================================================================
--- trunk/gnome-panel/libpanel-util/Makefile.am	(original)
+++ trunk/gnome-panel/libpanel-util/Makefile.am	Mon Jun 30 16:22:38 2008
@@ -24,6 +24,7 @@
 	panel-cleanup.h			\
 	panel-dbus-service.c		\
 	panel-dbus-service.h		\
+	panel-glib.h			\
 	panel-keyfile.c			\
 	panel-keyfile.h			\
 	panel-power-manager.c		\

Added: trunk/gnome-panel/libpanel-util/panel-glib.h
==============================================================================
--- (empty file)
+++ trunk/gnome-panel/libpanel-util/panel-glib.h	Mon Jun 30 16:22:38 2008
@@ -0,0 +1,34 @@
+/*
+ * panel-glib.h: various small extensions to glib
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *	Vincent Untz <vuntz gnome org>
+ */
+
+#ifndef PANEL_EXT_H
+#define PANEL_EXT_H
+
+G_BEGIN_DECLS
+
+#define PANEL_GLIB_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
+
+G_END_DECLS
+
+#endif /* PANEL_GLIB_H */

Modified: trunk/gnome-panel/panel-addto.c
==============================================================================
--- trunk/gnome-panel/panel-addto.c	(original)
+++ trunk/gnome-panel/panel-addto.c	Mon Jun 30 16:22:38 2008
@@ -29,6 +29,8 @@
 
 #include <gmenu-tree.h>
 
+#include <libpanel-util/panel-glib.h>
+
 #include "launcher.h"
 #include "panel.h"
 #include "drawer.h"
@@ -261,7 +263,7 @@
 
 	real_name = name ? name : _("(empty)");
 
-	if (!string_empty (desc)) {
+	if (!PANEL_GLIB_STR_EMPTY (desc)) {
 		result = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>\n%s",
 						  real_name, desc);
 	} else {
@@ -1060,7 +1062,7 @@
 
 	label = NULL;
 
-	if (!string_empty (name))
+	if (!PANEL_GLIB_STR_EMPTY (name))
 		label = g_strdup_printf (_("Find an _item to add to \"%s\":"),
 					 name);
 

Modified: trunk/gnome-panel/panel-menu-items.c
==============================================================================
--- trunk/gnome-panel/panel-menu-items.c	(original)
+++ trunk/gnome-panel/panel-menu-items.c	Mon Jun 30 16:22:38 2008
@@ -42,6 +42,7 @@
 #include <libgnome/gnome-url.h>
 #include <libgnomeui/gnome-url.h>
 
+#include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
 
 #include "menu.h"
@@ -222,7 +223,7 @@
 	icon    = panel_key_file_get_locale_string (key_file, "Icon");
 	comment = panel_key_file_get_locale_string (key_file, "Comment");
 
-	if (string_empty (force_name))
+	if (PANEL_GLIB_STR_EMPTY (force_name))
 		name = panel_key_file_get_locale_string (key_file, "Name");
 	else
 		name = g_strdup (force_name);

Modified: trunk/gnome-panel/panel-properties-dialog.c
==============================================================================
--- trunk/gnome-panel/panel-properties-dialog.c	(original)
+++ trunk/gnome-panel/panel-properties-dialog.c	Mon Jun 30 16:22:38 2008
@@ -31,6 +31,8 @@
 #include <glib/gi18n.h>
 #include <libgnomeui/gnome-icon-entry.h>
 
+#include <libpanel-util/panel-glib.h>
+
 #include "nothing.h"
 #include "panel-profile.h"
 #include "panel-gconf.h"
@@ -462,7 +464,7 @@
 
 	image = panel_profile_get_background_image (dialog->toplevel);
 
-	if (string_empty (image))
+	if (PANEL_GLIB_STR_EMPTY (image))
 		gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser));
 	else
 		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->image_chooser),
@@ -841,9 +843,10 @@
 	text = gconf_value_get_string (value);
 	old_text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog->image_chooser));
 
-	if (string_empty (text) && old_text)
+	if (PANEL_GLIB_STR_EMPTY (text) && old_text)
 		gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser));
-	else if (!string_empty (text) && (!old_text || strcmp (text, old_text)))
+	else if (!PANEL_GLIB_STR_EMPTY (text) &&
+		 (!old_text || strcmp (text, old_text)))
 		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->image_chooser),
 					       text);
 

Modified: trunk/gnome-panel/panel-util.c
==============================================================================
--- trunk/gnome-panel/panel-util.c	(original)
+++ trunk/gnome-panel/panel-util.c	Mon Jun 30 16:22:38 2008
@@ -28,6 +28,7 @@
 #include <libgnome/gnome-util.h>
 #include <libgnomeui/gnome-help.h>
 
+#include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
 
 #include "applet.h"
@@ -1237,7 +1238,7 @@
 		gconf_name = gconf_client_get_string (panel_gconf_get_client (),
 						      HOME_NAME_KEY,
 						      NULL);
-		if (string_empty (gconf_name)) {
+		if (PANEL_GLIB_STR_EMPTY (gconf_name)) {
 			g_free (gconf_name);
 			return g_strdup (_("Home Folder"));
 		} else {
@@ -1542,7 +1543,7 @@
 					      panel_util_query_tooltip_cb,
 					      NULL);
 
-	if (string_empty (text)) {
+	if (PANEL_GLIB_STR_EMPTY (text)) {
 		g_object_set (widget, "has-tooltip", FALSE, NULL);
 		return;
 	}

Modified: trunk/gnome-panel/panel-util.h
==============================================================================
--- trunk/gnome-panel/panel-util.h	(original)
+++ trunk/gnome-panel/panel-util.h	Mon Jun 30 16:22:38 2008
@@ -8,9 +8,6 @@
 
 typedef void (*UpdateFunction) (gpointer);
 
-/* TRUE if string is NULL or the first character is '\0' */
-#define		string_empty(s)		((s)==NULL||((char *)(s))[0]=='\0')
-
 #define		sure_string(s)		((const char *)((s)!=NULL?(s):""))
 
 void            panel_util_launch_from_key_file (GKeyFile                *keyfile,

Modified: trunk/gnome-panel/panel.c
==============================================================================
--- trunk/gnome-panel/panel.c	(original)
+++ trunk/gnome-panel/panel.c	Mon Jun 30 16:22:38 2008
@@ -19,6 +19,8 @@
 #include <gio/gio.h>
 #include <gdk/gdkkeysyms.h>
 
+#include <libpanel-util/panel-glib.h>
+
 #include "panel.h"
 
 #include "applet.h"
@@ -463,7 +465,8 @@
 		return FALSE;
 
 	netscape_url = g_strsplit (url, "\n", 2);
-	if (!netscape_url || string_empty (netscape_url[NETSCAPE_URL_URL])) {
+	if (!netscape_url ||
+	    PANEL_GLIB_STR_EMPTY (netscape_url[NETSCAPE_URL_URL])) {
 		g_strfreev (netscape_url);
 		return FALSE;
 	}
@@ -471,7 +474,7 @@
 	comment = g_strdup_printf (_("Open URL: %s"),
 				   netscape_url[NETSCAPE_URL_URL]);
 
-	if (string_empty (netscape_url[NETSCAPE_URL_NAME]))
+	if (PANEL_GLIB_STR_EMPTY (netscape_url[NETSCAPE_URL_NAME]))
 		name = netscape_url[NETSCAPE_URL_URL];
 	else
 		name = netscape_url[NETSCAPE_URL_NAME];



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]