[Xfce4-commits] r25110 - in xfce4-panel/trunk: . libxfce4panel
Nick Schermer
nick at xfce.org
Sun Mar 4 20:40:31 CET 2007
Author: nick
Date: 2007-03-04 19:40:31 +0000 (Sun, 04 Mar 2007)
New Revision: 25110
Added:
xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.c
Modified:
xfce4-panel/trunk/ChangeLog
xfce4-panel/trunk/libxfce4panel/Makefile.am
xfce4-panel/trunk/libxfce4panel/xfce-arrow-button.c
xfce4-panel/trunk/libxfce4panel/xfce-hvbox.c
xfce4-panel/trunk/libxfce4panel/xfce-itembar.c
xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.h
xfce4-panel/trunk/libxfce4panel/xfce-panel-window.c
Log:
* libxfce4panel/xfce-panel-macros.{c,h}: Add a macro for
g_type_register_static_simple which is only available in Glib 2.12.
* libxfce4panel/*.c: Use g_type_register_static_simple where possible to
reduce the number of relocations.
Modified: xfce4-panel/trunk/ChangeLog
===================================================================
--- xfce4-panel/trunk/ChangeLog 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/ChangeLog 2007-03-04 19:40:31 UTC (rev 25110)
@@ -1,3 +1,10 @@
+2007-03-04 20:32 nick
+
+ * libxfce4panel/xfce-panel-macros.{c,h}: Add a macro for
+ g_type_register_static_simple which is only available in Glib 2.12.
+ * libxfce4panel/*.c: Use g_type_register_static_simple where possible to
+ reduce the number of relocations.
+
2007-03-04 16:14 nick
* panel/main.c, panel/panel-app.{c,h}: Fix problem with session management
Modified: xfce4-panel/trunk/libxfce4panel/Makefile.am
===================================================================
--- xfce4-panel/trunk/libxfce4panel/Makefile.am 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/libxfce4panel/Makefile.am 2007-03-04 19:40:31 UTC (rev 25110)
@@ -33,6 +33,7 @@
xfce-panel-plugin-iface.c \
xfce-panel-plugin-iface.h \
xfce-panel-plugin-iface-private.h \
+ xfce-panel-macros.c \
xfce-panel-plugin-messages.c \
xfce-panel-plugin-messages.h
Modified: xfce4-panel/trunk/libxfce4panel/xfce-arrow-button.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-arrow-button.c 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/libxfce4panel/xfce-arrow-button.c 2007-03-04 19:40:31 UTC (rev 25110)
@@ -86,21 +86,13 @@
if (G_UNLIKELY (type == G_TYPE_INVALID))
{
- static const GTypeInfo type_info = {
- sizeof (XfceArrowButtonClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_arrow_button_class_init,
- NULL,
- NULL,
- sizeof (XfceArrowButton),
- 0,
- (GInstanceInitFunc) xfce_arrow_button_init,
- NULL
- };
-
- type =
- g_type_register_static (GTK_TYPE_TOGGLE_BUTTON, I_("XfceArrowButton"), &type_info, 0);
+ type = g_type_register_static_simple (GTK_TYPE_TOGGLE_BUTTON,
+ I_("XfceArrowButton"),
+ sizeof (XfceArrowButtonClass),
+ (GClassInitFunc) xfce_arrow_button_class_init,
+ sizeof (XfceArrowButton),
+ (GInstanceInitFunc) xfce_arrow_button_init,
+ 0);
}
return type;
Modified: xfce4-panel/trunk/libxfce4panel/xfce-hvbox.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-hvbox.c 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/libxfce4panel/xfce-hvbox.c 2007-03-04 19:40:31 UTC (rev 25110)
@@ -46,28 +46,20 @@
GtkType
xfce_hvbox_get_type (void)
{
- static GtkType hvbox_type = G_TYPE_INVALID;
+ static GtkType type = G_TYPE_INVALID;
- if (G_UNLIKELY (hvbox_type == G_TYPE_INVALID))
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
{
- static const GTypeInfo hvbox_info = {
- sizeof (XfceHVBoxClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_hvbox_class_init,
- NULL,
- NULL,
- sizeof (XfceHVBox),
- 0,
- (GInstanceInitFunc) xfce_hvbox_init,
- NULL
- };
-
- hvbox_type =
- g_type_register_static (GTK_TYPE_BOX, I_("XfceHVBox"), &hvbox_info, 0);
+ type = g_type_register_static_simple (GTK_TYPE_BOX,
+ I_("XfceHVBox"),
+ sizeof (XfceHVBoxClass),
+ (GClassInitFunc) xfce_hvbox_class_init,
+ sizeof (XfceHVBox),
+ (GInstanceInitFunc) xfce_hvbox_init,
+ 0);
}
- return hvbox_type;
+ return type;
}
Modified: xfce4-panel/trunk/libxfce4panel/xfce-itembar.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-itembar.c 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/libxfce4panel/xfce-itembar.c 2007-03-04 19:40:31 UTC (rev 25110)
@@ -149,23 +149,15 @@
{
static GtkType type = G_TYPE_INVALID;
- if (G_UNLIKELY (type == G_TYPE_INVALID))
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
{
- static const GTypeInfo type_info = {
- sizeof (XfceItembarClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_itembar_class_init,
- NULL,
- NULL,
- sizeof (XfceItembar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) xfce_itembar_init,
- NULL
- };
-
- type =
- g_type_register_static (GTK_TYPE_CONTAINER, I_("XfceItembar"), &type_info, 0);
+ type = g_type_register_static_simple (GTK_TYPE_CONTAINER,
+ I_("XfceItembar"),
+ sizeof (XfceItembarClass),
+ (GClassInitFunc) xfce_itembar_class_init,
+ sizeof (XfceItembar),
+ (GInstanceInitFunc) xfce_itembar_init,
+ 0);
}
return type;
Added: xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.c (rev 0)
+++ xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.c 2007-03-04 19:40:31 UTC (rev 25110)
@@ -0,0 +1,58 @@
+/* $Id: xfce-panel-macros.h 25077 2007-03-03 19:26:06Z nick $
+ *
+ * Copyright (c) 2006-2007 Nick Schermer <nick at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+
+
+#if (!GLIB_CHECK_VERSION(2,12,0))
+/*
+ * We can remove this code when the panel depends on Glib 2.12
+ */
+GType
+g_type_register_static_simple (GType parent_type,
+ const gchar *type_name,
+ guint class_size,
+ GClassInitFunc class_init,
+ guint instance_size,
+ GInstanceInitFunc instance_init,
+ GTypeFlags flags)
+{
+ GTypeInfo info;
+
+ info.class_size = class_size;
+ info.base_init = NULL;
+ info.base_finalize = NULL;
+ info.class_init = class_init;
+ info.class_finalize = NULL;
+ info.class_data = NULL;
+ info.instance_size = instance_size;
+ info.n_preallocs = 0;
+ info.instance_init = instance_init;
+ info.value_table = NULL;
+
+ return g_type_register_static (parent_type, type_name, &info, flags);
+}
+#endif
+
Modified: xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.h
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.h 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/libxfce4panel/xfce-panel-macros.h 2007-03-04 19:40:31 UTC (rev 25110)
@@ -47,6 +47,17 @@
#define I_(string) (g_quark_to_string (g_quark_from_static_string ((string))))
#endif
+#if (!GLIB_CHECK_VERSION(2,12,0))
+GType
+g_type_register_static_simple (GType parent_type,
+ const gchar *type_name,
+ guint class_size,
+ GClassInitFunc class_init,
+ guint instance_size,
+ GInstanceInitFunc instance_init,
+ GTypeFlags flags);
+#endif
+
G_END_DECLS
#endif /* !__XFCE_PANEL_MACROS_H__ */
Modified: xfce4-panel/trunk/libxfce4panel/xfce-panel-window.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-panel-window.c 2007-03-04 15:23:21 UTC (rev 25109)
+++ xfce4-panel/trunk/libxfce4panel/xfce-panel-window.c 2007-03-04 19:40:31 UTC (rev 25110)
@@ -137,21 +137,13 @@
if (G_UNLIKELY (type == G_TYPE_INVALID))
{
- static const GTypeInfo type_info = {
- sizeof (XfcePanelWindowClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_panel_window_class_init,
- NULL,
- NULL,
- sizeof (XfcePanelWindow),
- 0,
- (GInstanceInitFunc) xfce_panel_window_init,
- NULL
- };
-
- type = g_type_register_static (GTK_TYPE_WINDOW,
- I_("XfcePanelWindow"), &type_info, 0);
+ type = g_type_register_static_simple (GTK_TYPE_WINDOW,
+ I_("XfcePanelWindow"),
+ sizeof (XfcePanelWindowClass),
+ (GClassInitFunc) xfce_panel_window_class_init,
+ sizeof (XfcePanelWindow),
+ (GInstanceInitFunc) xfce_panel_window_init,
+ 0);
}
return type;
@@ -700,12 +692,12 @@
case XFCE_HANDLE_STYLE_BOTH:
handle_size = 2 * (HANDLE_WIDTH + thick);
break;
-
+
case XFCE_HANDLE_STYLE_START:
case XFCE_HANDLE_STYLE_END:
handle_size = HANDLE_WIDTH + thick;
break;
-
+
default:
handle_size = 0;
}
More information about the Xfce4-commits
mailing list