Browse Source

Move the panel_return macros to the private header.

Not code that is suitable for plugin developers. Also
drop the I_() macro and use g_intern_static_string directly.
upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
15450ddd34
  1. 1
      common/panel-builder.c
  2. 27
      common/panel-private.h
  3. 1
      common/panel-xfconf.c
  4. 2
      libxfce4panel/xfce-arrow-button.c
  5. 41
      libxfce4panel/xfce-panel-macros.h
  6. 7
      libxfce4panel/xfce-panel-plugin-provider.c
  7. 26
      libxfce4panel/xfce-panel-plugin.c
  8. 1
      panel/main.c
  9. 1
      panel/panel-dbus-client.c
  10. 3
      panel/panel-dbus-service.c
  11. 2
      panel/panel-dialogs.c
  12. 4
      panel/panel-itembar.c
  13. 5
      panel/panel-module-factory.c
  14. 5
      panel/panel-plugin-external.c
  15. 3
      panel/panel-preferences-dialog.c
  16. 4
      plugins/actions/actions.c
  17. 1
      plugins/clock/clock.h
  18. 1
      plugins/pager/pager.c
  19. 1
      plugins/separator/separator.c
  20. 1
      plugins/showdesktop/showdesktop.c
  21. 12
      plugins/systray/systray-manager.c
  22. 1
      plugins/systray/systray-socket.c
  23. 1
      plugins/tasklist/tasklist.c
  24. 1
      wrapper/wrapper-module.c

1
common/panel-builder.c

@ -20,6 +20,7 @@
#include <config.h>
#endif
#include <common/panel-private.h>
#include <common/panel-builder.h>

27
common/panel-private.h

@ -19,6 +19,33 @@
#ifndef __PANEL_PRIVATE_H__
#define __PANEL_PRIVATE_H__
/* support macros for debugging (improved macro for better position indication) */
#ifndef NDEBUG
#define panel_assert(expr) g_assert (expr)
#define panel_assert_not_reached() g_assert_not_reached ()
#define panel_return_if_fail(expr) G_STMT_START { \
if (G_UNLIKELY (!(expr))) \
{ \
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
"%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
#expr); \
return; \
}; }G_STMT_END
#define panel_return_val_if_fail(expr,val) G_STMT_START { \
if (G_UNLIKELY (!(expr))) \
{ \
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
"%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
#expr); \
return (val); \
}; }G_STMT_END
#else
#define panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
#define panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
#define panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
#define panel_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
#endif
/* handling flags */
#define PANEL_SET_FLAG(flags,flag) G_STMT_START{ ((flags) |= (flag)); }G_STMT_END
#define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END

1
common/panel-xfconf.c

@ -20,6 +20,7 @@
#include <config.h>
#endif
#include <common/panel-private.h>
#include <common/panel-xfconf.h>
#include <libxfce4panel/xfce-panel-macros.h>

2
libxfce4panel/xfce-arrow-button.c

@ -125,7 +125,7 @@ xfce_arrow_button_class_init (XfceArrowButtonClass * klass)
* This value also determines the direction of the popup menu.
**/
arrow_button_signals[ARROW_TYPE_CHANGED] =
g_signal_new (I_("arrow-type-changed"),
g_signal_new (g_intern_static_string ("arrow-type-changed"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfceArrowButtonClass, arrow_type_changed),

41
libxfce4panel/xfce-panel-macros.h

@ -27,50 +27,13 @@
G_BEGIN_DECLS
/* support macros for debugging (improved macro for better position indication) */
#ifndef NDEBUG
#define panel_assert(expr) g_assert (expr)
#define panel_assert_not_reached() g_assert_not_reached ()
#define panel_return_if_fail(expr) G_STMT_START { \
if (G_UNLIKELY (!(expr))) \
{ \
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
"%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
#expr); \
return; \
}; }G_STMT_END
#define panel_return_val_if_fail(expr,val) G_STMT_START { \
if (G_UNLIKELY (!(expr))) \
{ \
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
"%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
#expr); \
return (val); \
}; }G_STMT_END
#else
#define panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
#define panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
#define panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
#define panel_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
#endif
/* canonical representation for static strings */
#ifndef I_
#define I_(string) (g_intern_static_string ((string)))
#endif
/* xfconf channel for plugins */
#define XFCE_PANEL_PLUGIN_CHANNEL_NAME ("xfce4-panel")
/* macro for opening an XfconfChannel for plugin */
/* macro for opening an XfconfChannel for plugins */
#define xfce_panel_plugin_xfconf_channel_new(plugin) \
xfconf_channel_new_with_property_base (XFCE_PANEL_PLUGIN_CHANNEL_NAME, \
xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin)));
/* this is defined in glib 2.13.0 */
#ifndef G_PARAM_STATIC_STRINGS
#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
#endif
xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin)))
G_END_DECLS

7
libxfce4panel/xfce-panel-plugin-provider.c

@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include <common/panel-private.h>
#include <libxfce4panel/xfce-panel-macros.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <libxfce4panel/libxfce4panel-alias.h>
@ -51,7 +53,8 @@ xfce_panel_plugin_provider_get_type (void)
if (G_UNLIKELY (type == 0))
{
type = g_type_register_static_simple (G_TYPE_INTERFACE, I_("XfcePanelPluginProvider"),
type = g_type_register_static_simple (G_TYPE_INTERFACE,
g_intern_static_string ("XfcePanelPluginProvider"),
sizeof (XfcePanelPluginProviderIface),
xfce_panel_plugin_provider_class_init,
0, NULL, 0);
@ -67,7 +70,7 @@ xfce_panel_plugin_provider_class_init (gpointer klass,
gpointer klass_data)
{
provider_signals[PROVIDER_SIGNAL] =
g_signal_new (I_("provider-signal"),
g_signal_new (g_intern_static_string ("provider-signal"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginProviderIface, provider_signal),

26
libxfce4panel/xfce-panel-plugin.c

@ -194,7 +194,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* See also: xfce_panel_plugin_menu_show_about().
**/
plugin_signals[ABOUT] =
g_signal_new (I_("about"),
g_signal_new (g_intern_static_string ("about"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, about),
@ -214,7 +214,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* xfce_titled_dialog_new ().
**/
plugin_signals[CONFIGURE_PLUGIN] =
g_signal_new (I_("configure-plugin"),
g_signal_new (g_intern_static_string ("configure-plugin"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, configure_plugin),
@ -232,7 +232,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* See also #XfceHVBox.
**/
plugin_signals[FREE_DATA] =
g_signal_new (I_("free-data"),
g_signal_new (g_intern_static_string ("free-data"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, free_data),
@ -252,7 +252,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* See also: #XfceHVBox.
**/
plugin_signals[ORIENTATION_CHANGED] =
g_signal_new (I_("orientation-changed"),
g_signal_new (g_intern_static_string ("orientation-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, orientation_changed),
@ -278,7 +278,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* Since: 4.8
**/
plugin_signals[REMOVED] =
g_signal_new (I_("removed"),
g_signal_new (g_intern_static_string ("removed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, removed),
@ -298,7 +298,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* See also: xfce_panel_plugin_save_location().
**/
plugin_signals[SAVE] =
g_signal_new (I_("save"),
g_signal_new (g_intern_static_string ("save"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, save),
@ -322,7 +322,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* g_signal_connect (plugin, "size-changed", G_CALLBACK (gtk_true), NULL);
**/
plugin_signals[SIZE_CHANGED] =
g_signal_new (I_("size-changed"),
g_signal_new (g_intern_static_string ("size-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, size_changed),
@ -340,7 +340,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* this signal to change the arrow direction of buttons.
**/
plugin_signals[SCREEN_POSITION_CHANGED] =
g_signal_new (I_("screen-position-changed"),
g_signal_new (g_intern_static_string ("screen-position-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfcePanelPluginClass, screen_position_changed),
@ -715,7 +715,7 @@ xfce_panel_plugin_button_press_event (GtkWidget *widget,
gtk_menu_set_screen (menu, gtk_widget_get_screen (widget));
/* if the menu is block, some items are insensitive */
item = g_object_get_data (G_OBJECT (menu), I_("properties-item"));
item = g_object_get_data (G_OBJECT (menu), g_intern_static_string ("properties-item"));
gtk_widget_set_sensitive (item, plugin->priv->menu_blocked == 0);
/* popup the menu */
@ -881,7 +881,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin)
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PROPERTIES, NULL);
g_signal_connect_swapped (G_OBJECT (item), "activate",
G_CALLBACK (xfce_panel_plugin_show_configure), plugin);
g_object_set_data (G_OBJECT (menu), I_("properties-item"), item);
g_object_set_data (G_OBJECT (menu), g_intern_static_string ("properties-item"), item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
if (PANEL_HAS_FLAG (plugin->priv->flags, PLUGIN_FLAG_SHOW_CONFIGURE))
gtk_widget_show (item);
@ -890,7 +890,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin)
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
g_signal_connect_swapped (G_OBJECT (item), "activate",
G_CALLBACK (xfce_panel_plugin_show_about), plugin);
g_object_set_data (G_OBJECT (menu), I_("about-item"), item);
g_object_set_data (G_OBJECT (menu), g_intern_static_string ("about-item"), item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
if (PANEL_HAS_FLAG (plugin->priv->flags, PLUGIN_FLAG_SHOW_ABOUT))
gtk_widget_show (item);
@ -1511,7 +1511,7 @@ xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin)
{
/* get and show the properties item */
menu = xfce_panel_plugin_menu_get (plugin);
item = g_object_get_data (G_OBJECT (menu), I_("properties-item"));
item = g_object_get_data (G_OBJECT (menu), g_intern_static_string ("properties-item"));
if (G_LIKELY (item))
gtk_widget_show (item);
}
@ -1544,7 +1544,7 @@ xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin)
{
/* get and show the about item */
menu = xfce_panel_plugin_menu_get (plugin);
item = g_object_get_data (G_OBJECT (menu), I_("about-item"));
item = g_object_get_data (G_OBJECT (menu), g_intern_static_string ("about-item"));
if (G_LIKELY (item))
gtk_widget_show (item);
}

1
panel/main.c

@ -41,6 +41,7 @@
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include <panel/panel-application.h>
#include <panel/panel-dbus-service.h>

1
panel/panel-dbus-client.c

@ -22,6 +22,7 @@
#include <dbus/dbus-glib.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
#include <common/panel-dbus.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>

3
panel/panel-dbus-service.c

@ -27,6 +27,7 @@
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <common/panel-private.h>
#include <common/panel-dbus.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
@ -116,7 +117,7 @@ panel_dbus_service_class_init (PanelDBusServiceClass *klass)
* Emitted when an external plugin property should be updated.
**/
dbus_service_signals[PROPERTY_CHANGED] =
g_signal_new (I_("property-changed"),
g_signal_new (g_intern_static_string ("property-changed"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,

2
panel/panel-dialogs.c

@ -26,6 +26,8 @@
#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include <panel/panel-dialogs.h>

4
panel/panel-itembar.c

@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include <exo/exo.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include <panel/panel-itembar.h>
@ -154,7 +156,7 @@ panel_itembar_class_init (PanelItembarClass *klass)
gtkcontainer_class->set_child_property = panel_itembar_set_child_property;
itembar_signals[CHANGED] =
g_signal_new (I_("changed"),
g_signal_new (g_intern_static_string ("changed"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,

5
panel/panel-module-factory.c

@ -30,6 +30,9 @@
#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include <panel/panel-module.h>
@ -95,7 +98,7 @@ panel_module_factory_class_init (PanelModuleFactoryClass *klass)
* Emitted when the unique status of one of the modules changed.
**/
factory_signals[UNIQUE_CHANGED] =
g_signal_new (I_("unique-changed"),
g_signal_new (g_intern_static_string ("unique-changed"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,

5
panel/panel-plugin-external.c

@ -23,8 +23,11 @@
#include <exo/exo.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <common/panel-dbus.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
#include <common/panel-dbus.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>

3
panel/panel-preferences-dialog.c

@ -23,6 +23,9 @@
#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>

4
plugins/actions/actions.c

@ -24,9 +24,11 @@
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
#include <exo/exo.h>
#include <common/panel-private.h>
#include <common/panel-xfconf.h>
#include <common/panel-builder.h>
#include <exo/exo.h>
#include "actions.h"
#include "actions-dialog_ui.h"

1
plugins/clock/clock.h

@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
G_BEGIN_DECLS

1
plugins/pager/pager.c

@ -27,6 +27,7 @@
#include <libxfce4ui/libxfce4ui.h>
#include <common/panel-xfconf.h>
#include <common/panel-builder.h>
#include <common/panel-private.h>
#include <libwnck/libwnck.h>
#include <exo/exo.h>

1
plugins/separator/separator.c

@ -25,6 +25,7 @@
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
#include <common/panel-xfconf.h>
#include <common/panel-builder.h>
#include <exo/exo.h>

1
plugins/showdesktop/showdesktop.c

@ -22,6 +22,7 @@
#endif
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
#include "showdesktop.h"

12
plugins/systray/systray-manager.c

@ -35,6 +35,8 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
@ -155,7 +157,7 @@ systray_manager_class_init (SystrayManagerClass *klass)
gobject_class->finalize = systray_manager_finalize;
systray_manager_signals[ICON_ADDED] =
g_signal_new (I_("icon-added"),
g_signal_new (g_intern_static_string ("icon-added"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
@ -164,7 +166,7 @@ systray_manager_class_init (SystrayManagerClass *klass)
GTK_TYPE_SOCKET);
systray_manager_signals[ICON_REMOVED] =
g_signal_new (I_("icon-removed"),
g_signal_new (g_intern_static_string ("icon-removed"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
@ -173,7 +175,7 @@ systray_manager_class_init (SystrayManagerClass *klass)
GTK_TYPE_SOCKET);
systray_manager_signals[MESSAGE_SENT] =
g_signal_new (I_("message-sent"),
g_signal_new (g_intern_static_string ("message-sent"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
@ -185,7 +187,7 @@ systray_manager_class_init (SystrayManagerClass *klass)
G_TYPE_LONG);
systray_manager_signals[MESSAGE_CANCELLED] =
g_signal_new (I_("message-cancelled"),
g_signal_new (g_intern_static_string ("message-cancelled"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
@ -195,7 +197,7 @@ systray_manager_class_init (SystrayManagerClass *klass)
G_TYPE_LONG);
systray_manager_signals[LOST_SELECTION] =
g_signal_new (I_("lost-selection"),
g_signal_new (g_intern_static_string ("lost-selection"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,

1
plugins/systray/systray-socket.c

@ -35,6 +35,7 @@
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
#include "systray-socket.h"

1
plugins/tasklist/tasklist.c

@ -24,6 +24,7 @@
#include <libxfce4ui/libxfce4ui.h>
#include <common/panel-xfconf.h>
#include <common/panel-builder.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#include "tasklist-widget.h"

1
wrapper/wrapper-module.c

@ -24,6 +24,7 @@
#include <string.h>
#endif
#include <common/panel-private.h>
#include <wrapper/wrapper-module.h>

Loading…
Cancel
Save