Allow -Wl,-z,defs to work - create a liblxpanel.so.0.0.0
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Tue, 23 Sep 2014 14:21:16 +0000 (17:21 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Wed, 29 Oct 2014 22:31:40 +0000 (00:31 +0200)
17 files changed:
Makefile.am
configure.ac
debian/lxpanel-dev.install
debian/lxpanel.install
debian/rules
lxpanel.pc.in
plugins/Makefile.am
plugins/launchtaskbar.c
po/POTFILES.in
src/Makefile.am
src/configurator.c
src/ev.c
src/ev.h
src/main.c [new file with mode: 0644]
src/panel.c
src/plugin.c
src/private.h

index 586cb09..2d67e5a 100644 (file)
@@ -2,7 +2,7 @@
 
 ACLOCAL_AMFLAGS= -I m4
 
-SUBDIRS = plugins src data po man
+SUBDIRS = src plugins data po man
 
 EXTRA_DIST = \
         autogen.sh \
index 68860fc..52233c4 100644 (file)
@@ -1,5 +1,5 @@
 AC_PREREQ(2.53)
-AC_INIT(lxpanel, 0.7.2, http://lxde.org/)
+AC_INIT(lxpanel, 0.7.99, http://lxde.org/)
 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects no-dist-gzip dist-xz])
 AC_CONFIG_HEADER([config.h])
 AC_CONFIG_MACRO_DIR([m4])
@@ -24,6 +24,7 @@ LT_PREREQ([2.2])
 LT_INIT
 
 # Checks for libraries.
+AC_SEARCH_LIBS([log], [m])
 AC_ARG_ENABLE(gtk3,
 AC_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
 [case "${enableval}" in
@@ -160,14 +161,6 @@ dnl FIXME: filter for undefined symbols in plugins
 # there are no undefined references.  However, we intend not to
 # fix at the moment since we don't have spin-off libraray containing
 # the necessary functions.
-if test ! -z "$LDFLAGS"; then
-    LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
-fi
-
-LXPANEL_MODULE="-avoid-version \
--rpath \$(libdir)/lxpanel/plugins \
--no-undefined "'-export-symbols-regex "^[[^_]].*"'
-AC_SUBST(LXPANEL_MODULE)
 
 AC_ARG_ENABLE([alsa],
     AS_HELP_STRING([--disable-alsa],
index 0b2ea58..d7f0282 100644 (file)
@@ -1,2 +1,3 @@
 usr/include
 usr/lib/*/pkgconfig
+usr/lib/*/lxpanel/liblxpanel.so
index 1c87f8b..ea65e64 100644 (file)
@@ -1,5 +1,6 @@
 usr/bin
-usr/lib/*/lxpanel
+usr/lib/*/lxpanel/liblxpanel.so.*
+usr/lib/*/lxpanel/plugins
 usr/share/man
 etc/xdg/lxpanel
 
index c62c7a9..ddea1e6 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/make -f
 
 DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
@@ -21,6 +22,13 @@ endif
 override_dh_strip:
        dh_strip --dbg-package=lxpanel-dbg
 
+override_dh_auto_install:
+       dh_auto_install
+       rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/lxpanel/*.la
+
+override_dh_install:
+       dh_install --fail-missing
+
 override_dh_makeshlibs:
        # plugins are not shared libs so disable processing for them
        dh_makeshlibs -X/plugins/
index c3b2b3c..db34490 100644 (file)
@@ -1,10 +1,11 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-datadir=@datadir@
+pkglibdir=@libdir@/lxpanel
+includedir=@includedir@/lxpanel
+pluginsdir=${pkglibdir}/plugins
 
 Name: lxpanel
 Description: A lightweight X11 desktop panel
 Requires: glib-2.0 libfm
 Version: @VERSION@
+Libs: -L${pkglibdir} -llxpanel
index 5424fbd..3eeab77 100644 (file)
@@ -8,8 +8,13 @@ AM_CPPFLAGS = \
        $(G_CAST_CHECKS)
 
 AM_LDFLAGS = \
+       -module -avoid-version -shared -export-dynamic \
+       -no-undefined -rpath $(libdir)/lxpanel/plugins \
+       $(top_builddir)/src/liblxpanel.la \
        $(PACKAGE_LIBS)
 
+$(top_builddir)/src/liblxpanel.la:
+       cd $(top_builddir)/src && $(MAKE) liblxpanel.la
 
 ## built-in plugins
 noinst_LIBRARIES = libbuiltin_plugins.a
@@ -72,20 +77,16 @@ batt_la_SOURCES = \
        batt/batt.c \
        batt/batt_sys.c
 batt_la_CFLAGS = -I$(srcdir)/batt
-batt_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # cpu
 cpu_la_SOURCES = cpu/cpu.c
-cpu_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # cpufreq
 cpufreq_la_SOURCES = cpufreq/cpufreq.c
 cpufreq_la_CFLAGS = -DPACKAGE_DATA_DIR=\""$(datadir)/lxpanel"\"
-cpufreq_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # deskno
 deskno_la_SOURCES = deskno/deskno.c
-deskno_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # indicator
 indicator_la_SOURCES = indicator/indicator.c
@@ -93,16 +94,15 @@ indicator_la_CFLAGS = \
        -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
        -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \
        $(APPLET_CFLAGS)
-indicator_la_LDFLAGS = -module @LXPANEL_MODULE@ $(APPLET_LIBS)
+indicator_la_LIBADD = $(APPLET_LIBS)
 
 # kbled
 kbled_la_SOURCES = kbled/kbled.c
 kbled_la_CFLAGS = -DPACKAGE_DATA_DIR=\""$(datadir)/lxpanel"\"
-kbled_la_LDFLAGS = -module @LXPANEL_MODULE@
+kbled_la_LIBADD = $(X11_LIBS)
 
 # monitors
 monitors_la_SOURCES = monitors/monitors.c
-monitors_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # netstat
 netstat_la_SOURCES = \
@@ -115,7 +115,7 @@ netstat_la_SOURCES = \
 netstat_la_CFLAGS = \
        -I$(srcdir)/netstat \
        -DPACKAGE_DATA_DIR=\""$(datadir)/lxpanel"\"
-netstat_la_LDFLAGS = -module @LXPANEL_MODULE@ -liw
+netstat_la_LIBADD = -liw
 
 # netstatus
 netstatus_la_SOURCES = \
@@ -130,23 +130,20 @@ netstatus_la_CFLAGS = \
        -I$(srcdir)/netstatus \
        -DPACKAGE_DATA_DIR=\""$(datadir)/lxpanel"\" \
        -DPACKAGE_UI_DIR=\""$(datadir)/lxpanel/ui"\"
-netstatus_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # thermal
 thermal_la_SOURCES = thermal/thermal.c
-thermal_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # volume (OSS)
 volume_la_SOURCES = \
        volume/volume-impl.c \
        volume/volume.c
 volume_la_CFLAGS = -I$(srcdir)/volume
-volume_la_LDFLAGS = -module @LXPANEL_MODULE@
 
 # volumealsa
 volumealsa_la_SOURCES = volumealsa/volumealsa.c
 volumealsa_la_CFLAGS = -DPACKAGE_DATA_DIR=\""$(datadir)/lxpanel"\"
-volumealsa_la_LDFLAGS = -module @LXPANEL_MODULE@ -lasound
+volumealsa_la_LIBADD = -lasound
 
 # weather
 weather_la_SOURCES = \
@@ -160,7 +157,7 @@ weather_la_SOURCES = \
 weather_la_CFLAGS = \
        -I$(srcdir)/weather \
        $(LIBXML2_CFLAGS)
-weather_la_LDFLAGS = -module @LXPANEL_MODULE@ $(LIBXML2_LIBS)
+weather_la_LIBADD = $(LIBXML2_LIBS)
 
 # xkb
 xkb_la_CFLAGS = \
@@ -171,7 +168,7 @@ xkb_la_CFLAGS = \
 xkb_la_SOURCES = \
        xkb/xkb-plugin.c \
        xkb/xkb.c
-xkb_la_LDFLAGS = -module @LXPANEL_MODULE@
+xkb_la_LIBADD = $(X11_LIBS)
 
 xkeyboardconfigdir=$(datadir)/lxpanel/xkeyboardconfig
 xkeyboardconfig_DATA = \
index fb0dd2a..e2a5406 100644 (file)
@@ -3346,6 +3346,8 @@ static void taskbar_make_menu(LaunchTaskBarPlugin * tb)
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
     g_signal_connect(G_OBJECT(mi), "activate", (GCallback) menu_iconify_window, tb);
 
+    /* FIXME: if WM is Openbox then add "Window special parameters" submenu */
+
     /* If multiple desktops are supported, add menu items to select them. */
     if (tb->number_of_desktops > 1)
     {
@@ -3387,6 +3389,8 @@ static void taskbar_make_menu(LaunchTaskBarPlugin * tb)
         g_signal_connect(mi, "activate", G_CALLBACK(menu_move_to_workspace), tb);
         gtk_menu_shell_append(GTK_MENU_SHELL(workspace_menu), mi);
 
+        /* FIXME: add "Current workspace" item, active if not on a current */
+
         /* Add Move to Workspace menu item as a submenu. */
         mi = gtk_menu_item_new_with_mnemonic(_("_Move to Workspace"));
         gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
index f3622b9..a70b785 100644 (file)
@@ -6,6 +6,7 @@ src/ev.c
 src/panel.c
 src/plugin.c
 src/gtk-run.c
+src/main.c
 data/ui/launchtaskbar.glade
 data/ui/netstatus.glade
 data/ui/panel-pref.glade
index 8aad917..131fca2 100644 (file)
@@ -1,4 +1,5 @@
 ## Process this file with automake to produce Makefile.in
+ABI_VERSION=0:0:0
 
 bin_PROGRAMS = lxpanel lxpanelctl
 
@@ -18,19 +19,23 @@ if ENABLE_MENU_CACHE
 MENU_SOURCES = menu-policy.c
 endif
 
-lxpanel_SOURCES = \
+pkglib_LTLIBRARIES = liblxpanel.la
+
+liblxpanel_la_CFLAGS = $(lxpanel_CFLAGS)
+liblxpanel_la_SOURCES = \
        misc.c \
-       gtk-run.c \
        bg.c \
        configurator.c \
        dbg.c \
        ev.c \
-       icon-grid-old.c \
        icon-grid.c \
        panel.c \
        plugin.c \
-       conf.c \
-       $(MENU_SOURCES)
+       conf.c
+
+liblxpanel_la_LIBADD = \
+       $(PACKAGE_LIBS) \
+       $(X11_LIBS)
 
 lxpanel_includedir = $(includedir)/lxpanel
 lxpanel_include_HEADERS = \
@@ -40,6 +45,12 @@ lxpanel_include_HEADERS = \
        icon-grid.h \
        conf.h
 
+lxpanel_SOURCES = \
+       icon-grid-old.c \
+       gtk-run.c \
+       main.c \
+       $(MENU_SOURCES)
+
 if BUILD_PLUGIN_LOADER
 DYNAMIC_FLAGS = -export-dynamic
 endif
@@ -47,13 +58,13 @@ lxpanel_LDFLAGS = $(DYNAMIC_FLAGS)
 lxpanel_DEPENDENCIES_EXTRA = $(BUILTIN_PLUGINS)
 
 lxpanel_LDADD = \
+               liblxpanel.la \
                $(BUILTIN_PLUGINS) \
                $(PACKAGE_LIBS) \
-               $(X11_LIBS) \
-               $(INTLLIBS)
+               $(X11_LIBS)
 
 lxpanelctl_SOURCES = lxpanelctl.c lxpanelctl.h
-lxpanelctl_LDADD = $(X11_LIBS) $(INTLLIBS)
+lxpanelctl_LDADD = $(X11_LIBS)
 
 EXTRA_DIST = \
        bg.h \
index 8056731..04a2cbd 100644 (file)
@@ -45,19 +45,8 @@ enum{
 
 static void save_global_config();
 
-Command commands[] = {
-    //{ "configure", N_("Preferences"), configure },
-    { "run", N_("Run"), gtk_run },
-    { "restart", N_("Restart"), restart },
-    { "logout", N_("Logout"), logout },
-    { NULL, NULL },
-};
-
 static char* logout_cmd = NULL;
 
-extern GSList* all_panels;
-extern int config;
-
 /* macros to update config */
 #define UPDATE_GLOBAL_INT(panel,name,val) do { \
     config_setting_t *_s = config_setting_add(config_setting_get_elem(config_setting_get_member(config_root_setting(panel->config),""),\
@@ -1248,17 +1237,6 @@ void lxpanel_config_save(LXPanel *p)
     panel_config_save(p->priv);
 }
 
-void restart(void)
-{
-    /* This is defined in panel.c */
-    extern gboolean is_restarting;
-    ENTER;
-    is_restarting = TRUE;
-
-    gtk_main_quit();
-    RET();
-}
-
 void logout(void)
 {
     const char* l_logout_cmd = logout_cmd;
index bf47fe0..57c23bd 100644 (file)
--- a/src/ev.c
+++ b/src/ev.c
@@ -66,6 +66,9 @@ struct _FbEv {
     Pixmap   pixmap;
 };
 
+/* it is created in main.c */
+FbEv *fbev = NULL;
+
 static void fb_ev_class_init (FbEvClass *klass);
 static void fb_ev_init (FbEv *monitor);
 static void fb_ev_finalize (GObject *object);
index 10a6e04..fb65a88 100644 (file)
--- a/src/ev.h
+++ b/src/ev.h
@@ -77,7 +77,7 @@ extern Window *fb_ev_active_window(FbEv *ev);
 extern Window *fb_ev_client_list(FbEv *ev);
 extern Window *fb_ev_client_list_stacking(FbEv *ev);
 
-/* it is defined in the panel.c */
+/* it is created in the main.c */
 extern FbEv *fbev;
 
 #endif /* __FB_EV_H__ */
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..3778d5d
--- /dev/null
@@ -0,0 +1,527 @@
+/**
+ * Copyright (c) 2006-2014 LxDE Developers, see the file AUTHORS for details.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <stdlib.h>
+#include <glib/gstdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <locale.h>
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <libfm/fm-gtk.h>
+
+#define __LXPANEL_INTERNALS__
+
+#include "private.h"
+#include "misc.h"
+#include "bg.h"
+
+#include "lxpanelctl.h"
+#include "dbg.h"
+
+static gchar *cfgfile = NULL;
+static gchar version[] = VERSION;
+static int config = 0;
+
+static gboolean is_restarting = FALSE;
+
+Command commands[] = {
+    //{ "configure", N_("Preferences"), configure },
+    { "run", N_("Run"), gtk_run },
+    { "restart", N_("Restart"), restart },
+    { "logout", N_("Logout"), logout },
+    { NULL, NULL },
+};
+
+void restart(void)
+{
+    ENTER;
+    is_restarting = TRUE;
+
+    gtk_main_quit();
+    RET();
+}
+
+static void process_client_msg ( XClientMessageEvent* ev )
+{
+    int cmd = ev->data.b[0];
+    switch( cmd )
+    {
+#ifndef DISABLE_MENU
+        case LXPANEL_CMD_SYS_MENU:
+        {
+            GSList* l;
+            for( l = all_panels; l; l = l->next )
+            {
+                LXPanel* p = (LXPanel*)l->data;
+                GList *plugins, *pl;
+
+                plugins = gtk_container_get_children(GTK_CONTAINER(p->priv->box));
+                for (pl = plugins; pl; pl = pl->next)
+                {
+                    const LXPanelPluginInit *init = PLUGIN_CLASS(pl->data);
+                    if (init->show_system_menu)
+                        /* queue to show system menu */
+                        init->show_system_menu(pl->data);
+                }
+                g_list_free(plugins);
+            }
+            break;
+        }
+#endif
+        case LXPANEL_CMD_RUN:
+            gtk_run();
+            break;
+        case LXPANEL_CMD_CONFIG:
+            {
+            LXPanel * p = ((all_panels != NULL) ? all_panels->data : NULL);
+            if (p != NULL)
+                panel_configure(p, 0);
+            }
+            break;
+        case LXPANEL_CMD_RESTART:
+            restart();
+            break;
+        case LXPANEL_CMD_EXIT:
+            gtk_main_quit();
+            break;
+    }
+}
+
+static GdkFilterReturn
+panel_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer not_used)
+{
+    Atom at;
+    Window win;
+    XEvent *ev = (XEvent *) xevent;
+
+    ENTER;
+    DBG("win = 0x%x\n", ev->xproperty.window);
+    if (ev->type != PropertyNotify )
+    {
+        /* private client message from lxpanelctl */
+        if( ev->type == ClientMessage && ev->xproperty.atom == a_LXPANEL_CMD )
+        {
+            process_client_msg( (XClientMessageEvent*)ev );
+        }
+        else if( ev->type == DestroyNotify )
+        {
+            fb_ev_emit_destroy( fbev, ((XDestroyWindowEvent*)ev)->window );
+        }
+        RET(GDK_FILTER_CONTINUE);
+    }
+
+    at = ev->xproperty.atom;
+    win = ev->xproperty.window;
+    if (win == GDK_ROOT_WINDOW())
+    {
+        if (at == a_NET_CLIENT_LIST)
+        {
+            fb_ev_emit(fbev, EV_CLIENT_LIST);
+        }
+        else if (at == a_NET_CURRENT_DESKTOP)
+        {
+            GSList* l;
+            for( l = all_panels; l; l = l->next )
+                ((LXPanel*)l->data)->priv->curdesk = get_net_current_desktop();
+            fb_ev_emit(fbev, EV_CURRENT_DESKTOP);
+        }
+        else if (at == a_NET_NUMBER_OF_DESKTOPS)
+        {
+            GSList* l;
+            for( l = all_panels; l; l = l->next )
+                ((LXPanel*)l->data)->priv->desknum = get_net_number_of_desktops();
+            fb_ev_emit(fbev, EV_NUMBER_OF_DESKTOPS);
+        }
+        else if (at == a_NET_DESKTOP_NAMES)
+        {
+            fb_ev_emit(fbev, EV_DESKTOP_NAMES);
+        }
+        else if (at == a_NET_ACTIVE_WINDOW)
+        {
+            fb_ev_emit(fbev, EV_ACTIVE_WINDOW );
+        }
+        else if (at == a_NET_CLIENT_LIST_STACKING)
+        {
+            fb_ev_emit(fbev, EV_CLIENT_LIST_STACKING);
+        }
+        else if (at == a_XROOTPMAP_ID)
+        {
+            GSList* l;
+            for( l = all_panels; l; l = l->next )
+            {
+                LXPanel* p = (LXPanel*)l->data;
+                if (p->priv->transparent) {
+                    fb_bg_notify_changed_bg(p->priv->bg);
+                }
+            }
+        }
+        else if (at == a_NET_WORKAREA)
+        {
+            GSList* l;
+            for( l = all_panels; l; l = l->next )
+            {
+                LXPanel* p = (LXPanel*)l->data;
+                g_free( p->priv->workarea );
+                p->priv->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->priv->wa_len);
+                /* print_wmdata(p); */
+            }
+        }
+        else
+            return GDK_FILTER_CONTINUE;
+
+        return GDK_FILTER_REMOVE;
+    }
+    return GDK_FILTER_CONTINUE;
+}
+
+/* The same for new plugins type - they will be not unloaded by FmModule */
+#define REGISTER_STATIC_MODULE(pc) do { \
+    extern LXPanelPluginInit lxpanel_static_plugin_##pc; \
+    lxpanel_register_plugin_type(#pc, &lxpanel_static_plugin_##pc); } while (0)
+
+/* Initialize the static plugins. */
+static void init_static_plugins(void)
+{
+#ifdef STATIC_SEPARATOR
+    REGISTER_STATIC_MODULE(separator);
+#endif
+
+#ifdef STATIC_LAUNCHTASKBAR
+    REGISTER_STATIC_MODULE(launchtaskbar);
+#endif
+
+#ifdef STATIC_DCLOCK
+    REGISTER_STATIC_MODULE(dclock);
+#endif
+
+#ifdef STATIC_WINCMD
+    REGISTER_STATIC_MODULE(wincmd);
+#endif
+
+#ifdef STATIC_DIRMENU
+    REGISTER_STATIC_MODULE(dirmenu);
+#endif
+
+#ifdef STATIC_PAGER
+    REGISTER_STATIC_MODULE(pager);
+#endif
+
+#ifdef STATIC_TRAY
+    REGISTER_STATIC_MODULE(tray);
+#endif
+
+#ifndef DISABLE_MENU
+#ifdef STATIC_MENU
+    REGISTER_STATIC_MODULE(menu);
+#endif
+#endif
+
+#ifdef STATIC_SPACE
+    REGISTER_STATIC_MODULE(space);
+#endif
+}
+
+static void
+usage()
+{
+    g_print(_("lxpanel %s - lightweight GTK2+ panel for UNIX desktops\n"), version);
+    g_print(_("Command line options:\n"));
+    g_print(_(" --help      -- print this help and exit\n"));
+    g_print(_(" --version   -- print version and exit\n"));
+//    g_print(_(" --log <number> -- set log level 0-5. 0 - none 5 - chatty\n"));
+//    g_print(_(" --configure -- launch configuration utility\n"));
+    g_print(_(" --profile name -- use specified profile\n"));
+    g_print("\n");
+    g_print(_(" -h  -- same as --help\n"));
+    g_print(_(" -p  -- same as --profile\n"));
+    g_print(_(" -v  -- same as --version\n"));
+ //   g_print(_(" -C  -- same as --configure\n"));
+    g_print(_("\nVisit http://lxde.org/ for detail.\n\n"));
+}
+
+/* Lightweight lock related functions - X clipboard hacks */
+
+#define CLIPBOARD_NAME "LXPANEL_SELECTION"
+
+/*
+ * clipboard_get_func - dummy get_func for gtk_clipboard_set_with_data ()
+ */
+static void
+clipboard_get_func(
+    GtkClipboard *clipboard G_GNUC_UNUSED,
+    GtkSelectionData *selection_data G_GNUC_UNUSED,
+    guint info G_GNUC_UNUSED,
+    gpointer user_data_or_owner G_GNUC_UNUSED)
+{
+}
+
+/*
+ * clipboard_clear_func - dummy clear_func for gtk_clipboard_set_with_data ()
+ */
+static void clipboard_clear_func(
+    GtkClipboard *clipboard G_GNUC_UNUSED,
+    gpointer user_data_or_owner G_GNUC_UNUSED)
+{
+}
+
+/*
+ * Lightweight version for checking single instance.
+ * Try and get the CLIPBOARD_NAME clipboard instead of using file manipulation.
+ *
+ * Returns TRUE if successfully retrieved and FALSE otherwise.
+ */
+static gboolean check_main_lock()
+{
+    static const GtkTargetEntry targets[] = { { CLIPBOARD_NAME, 0, 0 } };
+    gboolean retval = FALSE;
+    GtkClipboard *clipboard;
+    Atom atom;
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+
+    atom = gdk_x11_get_xatom_by_name(CLIPBOARD_NAME);
+
+    XGrabServer(xdisplay);
+
+    if (XGetSelectionOwner(xdisplay, atom) != None)
+        goto out;
+
+    clipboard = gtk_clipboard_get(gdk_atom_intern(CLIPBOARD_NAME, FALSE));
+
+    if (gtk_clipboard_set_with_data(clipboard, targets,
+                                    G_N_ELEMENTS (targets),
+                                    clipboard_get_func,
+                                    clipboard_clear_func, NULL))
+        retval = TRUE;
+
+out:
+    XUngrabServer (xdisplay);
+    gdk_flush ();
+
+    return retval;
+}
+#undef CLIPBOARD_NAME
+
+static void _start_panels_from_dir(const char *panel_dir)
+{
+    GDir* dir = g_dir_open( panel_dir, 0, NULL );
+    const gchar* name;
+
+    if( ! dir )
+    {
+        return;
+    }
+
+    while((name = g_dir_read_name(dir)) != NULL)
+    {
+        char* panel_config = g_build_filename( panel_dir, name, NULL );
+        if (strchr(panel_config, '~') == NULL)    /* Skip editor backup files in case user has hand edited in this directory */
+        {
+            LXPanel* panel = panel_new( panel_config, name );
+            if( panel )
+                all_panels = g_slist_prepend( all_panels, panel );
+        }
+        g_free( panel_config );
+    }
+    g_dir_close( dir );
+}
+
+static gboolean start_all_panels( )
+{
+    char *panel_dir;
+    const gchar * const * dir;
+
+    /* try user panels */
+    panel_dir = _user_config_file_name("panels", NULL);
+    _start_panels_from_dir(panel_dir);
+    g_free(panel_dir);
+    if (all_panels != NULL)
+        return TRUE;
+    /* else try XDG fallbacks */
+    dir = g_get_system_config_dirs();
+    if (dir) while (dir[0])
+    {
+        panel_dir = _system_config_file_name(dir[0], "panels");
+        _start_panels_from_dir(panel_dir);
+        g_free(panel_dir);
+        if (all_panels != NULL)
+            return TRUE;
+        dir++;
+    }
+    /* last try at old fallback for compatibility reasons */
+    panel_dir = _old_system_config_file_name("panels");
+    _start_panels_from_dir(panel_dir);
+    g_free(panel_dir);
+    return all_panels != NULL;
+}
+
+void load_global_config();
+void free_global_config();
+
+static void _ensure_user_config_dirs(void)
+{
+    char *dir = g_build_filename(g_get_user_config_dir(), "lxpanel", cprofile,
+                                 "panels", NULL);
+
+    /* make sure the private profile and panels dir exists */
+    g_mkdir_with_parents(dir, 0700);
+    g_free(dir);
+}
+
+int main(int argc, char *argv[], char *env[])
+{
+    int i;
+    const char* desktop_name;
+    char *file;
+
+    setlocale(LC_CTYPE, "");
+
+    g_thread_init(NULL);
+/*    gdk_threads_init();
+    gdk_threads_enter(); */
+
+    gtk_init(&argc, &argv);
+
+#ifdef ENABLE_NLS
+    bindtextdomain ( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR );
+    bind_textdomain_codeset ( GETTEXT_PACKAGE, "UTF-8" );
+    textdomain ( GETTEXT_PACKAGE );
+#endif
+
+    XSetLocaleModifiers("");
+    XSetErrorHandler((XErrorHandler) panel_handle_x_error);
+
+    resolve_atoms();
+
+    desktop_name = g_getenv("XDG_CURRENT_DESKTOP");
+    is_in_lxde = desktop_name && (0 == strcmp(desktop_name, "LXDE"));
+
+    for (i = 1; i < argc; i++) {
+        if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
+            usage();
+            exit(0);
+        } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
+            printf("lxpanel %s\n", version);
+            exit(0);
+        } else if (!strcmp(argv[i], "--log")) {
+            i++;
+            if (i == argc) {
+                g_critical( "lxpanel: missing log level");
+                usage();
+                exit(1);
+            } else {
+                /* deprecated */
+            }
+        } else if (!strcmp(argv[i], "--configure") || !strcmp(argv[i], "-C")) {
+            config = 1;
+        } else if (!strcmp(argv[i], "--profile") || !strcmp(argv[i], "-p")) {
+            i++;
+            if (i == argc) {
+                g_critical( "lxpanel: missing profile name");
+                usage();
+                exit(1);
+            } else {
+                cprofile = g_strdup(argv[i]);
+            }
+        } else {
+            printf("lxpanel: unknown option - %s\n", argv[i]);
+            usage();
+            exit(1);
+        }
+    }
+
+    /* Add a gtkrc file to be parsed too. */
+    file = _user_config_file_name("gtkrc", NULL);
+    gtk_rc_parse(file);
+    g_free(file);
+
+    /* Check for duplicated lxpanel instances */
+    if (!check_main_lock() && !config) {
+        printf("There is already an instance of LXPanel.  Now to exit\n");
+        exit(1);
+    }
+
+    _ensure_user_config_dirs();
+
+    /* Add our own icons to the search path of icon theme */
+    gtk_icon_theme_append_search_path( gtk_icon_theme_get_default(), PACKAGE_DATA_DIR "/images" );
+
+    fbev = fb_ev_new();
+    win_grp = gtk_window_group_new();
+
+    is_restarting = FALSE;
+
+    /* init LibFM */
+    fm_gtk_init(NULL);
+
+    /* prepare modules data */
+    _prepare_modules();
+    init_static_plugins();
+
+    load_global_config();
+
+    /* NOTE: StructureNotifyMask is required by XRandR
+     * See init_randr_support() in gdkscreen-x11.c of gtk+ for detail.
+     */
+    gdk_window_set_events(gdk_get_default_root_window(), GDK_STRUCTURE_MASK |
+            GDK_SUBSTRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK);
+    gdk_window_add_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, NULL);
+
+    if( G_UNLIKELY( ! start_all_panels() ) )
+        g_warning( "Config files are not found.\n" );
+/*
+ * FIXME: configure??
+    if (config)
+        configure();
+*/
+    gtk_main();
+
+    XSelectInput (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW(), NoEventMask);
+    gdk_window_remove_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, NULL);
+
+    /* destroy all panels */
+    g_slist_foreach( all_panels, (GFunc) gtk_widget_destroy, NULL );
+    g_slist_free( all_panels );
+    all_panels = NULL;
+    g_free( cfgfile );
+
+    free_global_config();
+
+    _unload_modules();
+    fm_gtk_finalize();
+
+    /* gdk_threads_leave(); */
+
+    g_object_unref(win_grp);
+    g_object_unref(fbev);
+
+    if (!is_restarting)
+        return 0;
+    if (strchr(argv[0], G_DIR_SEPARATOR))
+        execve(argv[0], argv, env);
+    else
+        execve(g_find_program_in_path(argv[0]), argv, env);
+    return 1;
+}
index 286cd33..c74bfff 100644 (file)
 #include "lxpanelctl.h"
 #include "dbg.h"
 
-static gchar *cfgfile = NULL;
-static gchar version[] = VERSION;
 gchar *cprofile = "default";
 
-static GtkWindowGroup* win_grp; /* window group used to limit the scope of model dialog. */
-
-static int config = 0;
-FbEv *fbev = NULL;
+GtkWindowGroup* win_grp = NULL; /* window group used to limit the scope of model dialog. */
 
 GSList* all_panels = NULL;  /* a single-linked list storing all panels */
 
-gboolean is_restarting = FALSE;
-
 gboolean is_in_lxde = FALSE;
 
 static void panel_start_gui(LXPanel *p);
@@ -446,139 +439,6 @@ void _panel_set_wm_strut(LXPanel *panel)
     }
 }
 
-static void process_client_msg ( XClientMessageEvent* ev )
-{
-    int cmd = ev->data.b[0];
-    switch( cmd )
-    {
-#ifndef DISABLE_MENU
-        case LXPANEL_CMD_SYS_MENU:
-        {
-            GSList* l;
-            for( l = all_panels; l; l = l->next )
-            {
-                LXPanel* p = (LXPanel*)l->data;
-                GList *plugins, *pl;
-
-                plugins = gtk_container_get_children(GTK_CONTAINER(p->priv->box));
-                for (pl = plugins; pl; pl = pl->next)
-                {
-                    const LXPanelPluginInit *init = PLUGIN_CLASS(pl->data);
-                    if (init->show_system_menu)
-                        /* queue to show system menu */
-                        init->show_system_menu(pl->data);
-                }
-                g_list_free(plugins);
-            }
-            break;
-        }
-#endif
-        case LXPANEL_CMD_RUN:
-            gtk_run();
-            break;
-        case LXPANEL_CMD_CONFIG:
-            {
-            LXPanel * p = ((all_panels != NULL) ? all_panels->data : NULL);
-            if (p != NULL)
-                panel_configure(p, 0);
-            }
-            break;
-        case LXPANEL_CMD_RESTART:
-            restart();
-            break;
-        case LXPANEL_CMD_EXIT:
-            gtk_main_quit();
-            break;
-    }
-}
-
-static GdkFilterReturn
-panel_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer not_used)
-{
-    Atom at;
-    Window win;
-    XEvent *ev = (XEvent *) xevent;
-
-    ENTER;
-    DBG("win = 0x%x\n", ev->xproperty.window);
-    if (ev->type != PropertyNotify )
-    {
-        /* private client message from lxpanelctl */
-        if( ev->type == ClientMessage && ev->xproperty.atom == a_LXPANEL_CMD )
-        {
-            process_client_msg( (XClientMessageEvent*)ev );
-        }
-        else if( ev->type == DestroyNotify )
-        {
-            fb_ev_emit_destroy( fbev, ((XDestroyWindowEvent*)ev)->window );
-        }
-        RET(GDK_FILTER_CONTINUE);
-    }
-
-    at = ev->xproperty.atom;
-    win = ev->xproperty.window;
-    if (win == GDK_ROOT_WINDOW())
-    {
-        if (at == a_NET_CLIENT_LIST)
-        {
-            fb_ev_emit(fbev, EV_CLIENT_LIST);
-        }
-        else if (at == a_NET_CURRENT_DESKTOP)
-        {
-            GSList* l;
-            for( l = all_panels; l; l = l->next )
-                ((LXPanel*)l->data)->priv->curdesk = get_net_current_desktop();
-            fb_ev_emit(fbev, EV_CURRENT_DESKTOP);
-        }
-        else if (at == a_NET_NUMBER_OF_DESKTOPS)
-        {
-            GSList* l;
-            for( l = all_panels; l; l = l->next )
-                ((LXPanel*)l->data)->priv->desknum = get_net_number_of_desktops();
-            fb_ev_emit(fbev, EV_NUMBER_OF_DESKTOPS);
-        }
-        else if (at == a_NET_DESKTOP_NAMES)
-        {
-            fb_ev_emit(fbev, EV_DESKTOP_NAMES);
-        }
-        else if (at == a_NET_ACTIVE_WINDOW)
-        {
-            fb_ev_emit(fbev, EV_ACTIVE_WINDOW );
-        }
-        else if (at == a_NET_CLIENT_LIST_STACKING)
-        {
-            fb_ev_emit(fbev, EV_CLIENT_LIST_STACKING);
-        }
-        else if (at == a_XROOTPMAP_ID)
-        {
-            GSList* l;
-            for( l = all_panels; l; l = l->next )
-            {
-                LXPanel* p = (LXPanel*)l->data;
-                if (p->priv->transparent) {
-                    fb_bg_notify_changed_bg(p->priv->bg);
-                }
-            }
-        }
-        else if (at == a_NET_WORKAREA)
-        {
-            GSList* l;
-            for( l = all_panels; l; l = l->next )
-            {
-                LXPanel* p = (LXPanel*)l->data;
-                XFree( p->priv->workarea );
-                p->priv->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->priv->wa_len);
-                /* print_wmdata(p); */
-            }
-        }
-        else
-            return GDK_FILTER_CONTINUE;
-
-        return GDK_FILTER_REMOVE;
-    }
-    return GDK_FILTER_CONTINUE;
-}
-
 /****************************************************
  *         panel's handlers for GTK events          *
  ****************************************************/
@@ -1612,7 +1472,7 @@ void panel_destroy(Panel *p)
     gtk_widget_destroy(GTK_WIDGET(p->topgwin));
 }
 
-static LXPanel* panel_new( const char* config_file, const char* config_name )
+LXPanel* panel_new( const char* config_file, const char* config_name )
 {
     LXPanel* panel = NULL;
 
@@ -1632,286 +1492,6 @@ static LXPanel* panel_new( const char* config_file, const char* config_name )
     return panel;
 }
 
-static void
-usage()
-{
-    g_print(_("lxpanel %s - lightweight GTK2+ panel for UNIX desktops\n"), version);
-    g_print(_("Command line options:\n"));
-    g_print(_(" --help      -- print this help and exit\n"));
-    g_print(_(" --version   -- print version and exit\n"));
-//    g_print(_(" --log <number> -- set log level 0-5. 0 - none 5 - chatty\n"));
-//    g_print(_(" --configure -- launch configuration utility\n"));
-    g_print(_(" --profile name -- use specified profile\n"));
-    g_print("\n");
-    g_print(_(" -h  -- same as --help\n"));
-    g_print(_(" -p  -- same as --profile\n"));
-    g_print(_(" -v  -- same as --version\n"));
- //   g_print(_(" -C  -- same as --configure\n"));
-    g_print(_("\nVisit http://lxde.org/ for detail.\n\n"));
-}
-
-/* Lightweight lock related functions - X clipboard hacks */
-
-#define CLIPBOARD_NAME "LXPANEL_SELECTION"
-
-/*
- * clipboard_get_func - dummy get_func for gtk_clipboard_set_with_data ()
- */
-static void
-clipboard_get_func(
-    GtkClipboard *clipboard G_GNUC_UNUSED,
-    GtkSelectionData *selection_data G_GNUC_UNUSED,
-    guint info G_GNUC_UNUSED,
-    gpointer user_data_or_owner G_GNUC_UNUSED)
-{
-}
-
-/*
- * clipboard_clear_func - dummy clear_func for gtk_clipboard_set_with_data ()
- */
-static void clipboard_clear_func(
-    GtkClipboard *clipboard G_GNUC_UNUSED,
-    gpointer user_data_or_owner G_GNUC_UNUSED)
-{
-}
-
-/*
- * Lightweight version for checking single instance.
- * Try and get the CLIPBOARD_NAME clipboard instead of using file manipulation.
- *
- * Returns TRUE if successfully retrieved and FALSE otherwise.
- */
-static gboolean check_main_lock()
-{
-    static const GtkTargetEntry targets[] = { { CLIPBOARD_NAME, 0, 0 } };
-    gboolean retval = FALSE;
-    GtkClipboard *clipboard;
-    Atom atom;
-    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-
-    atom = gdk_x11_get_xatom_by_name(CLIPBOARD_NAME);
-
-    XGrabServer(xdisplay);
-
-    if (XGetSelectionOwner(xdisplay, atom) != None)
-        goto out;
-
-    clipboard = gtk_clipboard_get(gdk_atom_intern(CLIPBOARD_NAME, FALSE));
-
-    if (gtk_clipboard_set_with_data(clipboard, targets,
-                                    G_N_ELEMENTS (targets),
-                                    clipboard_get_func,
-                                    clipboard_clear_func, NULL))
-        retval = TRUE;
-
-out:
-    XUngrabServer (xdisplay);
-    gdk_flush ();
-
-    return retval;
-}
-#undef CLIPBOARD_NAME
-
-static void _start_panels_from_dir(const char *panel_dir)
-{
-    GDir* dir = g_dir_open( panel_dir, 0, NULL );
-    const gchar* name;
-
-    if( ! dir )
-    {
-        return;
-    }
-
-    while((name = g_dir_read_name(dir)) != NULL)
-    {
-        char* panel_config = g_build_filename( panel_dir, name, NULL );
-        if (strchr(panel_config, '~') == NULL)    /* Skip editor backup files in case user has hand edited in this directory */
-        {
-            LXPanel* panel = panel_new( panel_config, name );
-            if( panel )
-                all_panels = g_slist_prepend( all_panels, panel );
-        }
-        g_free( panel_config );
-    }
-    g_dir_close( dir );
-}
-
-static gboolean start_all_panels( )
-{
-    char *panel_dir;
-    const gchar * const * dir;
-
-    /* try user panels */
-    panel_dir = _user_config_file_name("panels", NULL);
-    _start_panels_from_dir(panel_dir);
-    g_free(panel_dir);
-    if (all_panels != NULL)
-        return TRUE;
-    /* else try XDG fallbacks */
-    dir = g_get_system_config_dirs();
-    if (dir) while (dir[0])
-    {
-        panel_dir = _system_config_file_name(dir[0], "panels");
-        _start_panels_from_dir(panel_dir);
-        g_free(panel_dir);
-        if (all_panels != NULL)
-            return TRUE;
-        dir++;
-    }
-    /* last try at old fallback for compatibility reasons */
-    panel_dir = _old_system_config_file_name("panels");
-    _start_panels_from_dir(panel_dir);
-    g_free(panel_dir);
-    return all_panels != NULL;
-}
-
-void load_global_config();
-void free_global_config();
-
-static void _ensure_user_config_dirs(void)
-{
-    char *dir = g_build_filename(g_get_user_config_dir(), "lxpanel", cprofile,
-                                 "panels", NULL);
-
-    /* make sure the private profile and panels dir exists */
-    g_mkdir_with_parents(dir, 0700);
-    g_free(dir);
-}
-
-int main(int argc, char *argv[], char *env[])
-{
-    int i;
-    const char* desktop_name;
-    char *file;
-
-    setlocale(LC_CTYPE, "");
-
-    g_thread_init(NULL);
-/*    gdk_threads_init();
-    gdk_threads_enter(); */
-
-    gtk_init(&argc, &argv);
-
-#ifdef ENABLE_NLS
-    bindtextdomain ( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR );
-    bind_textdomain_codeset ( GETTEXT_PACKAGE, "UTF-8" );
-    textdomain ( GETTEXT_PACKAGE );
-#endif
-
-    XSetLocaleModifiers("");
-    XSetErrorHandler((XErrorHandler) panel_handle_x_error);
-
-    resolve_atoms();
-
-    desktop_name = g_getenv("XDG_CURRENT_DESKTOP");
-    is_in_lxde = desktop_name && (0 == strcmp(desktop_name, "LXDE"));
-
-    for (i = 1; i < argc; i++) {
-        if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
-            usage();
-            exit(0);
-        } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
-            printf("lxpanel %s\n", version);
-            exit(0);
-        } else if (!strcmp(argv[i], "--log")) {
-            i++;
-            if (i == argc) {
-                g_critical( "lxpanel: missing log level");
-                usage();
-                exit(1);
-            } else {
-                /* deprecated */
-            }
-        } else if (!strcmp(argv[i], "--configure") || !strcmp(argv[i], "-C")) {
-            config = 1;
-        } else if (!strcmp(argv[i], "--profile") || !strcmp(argv[i], "-p")) {
-            i++;
-            if (i == argc) {
-                g_critical( "lxpanel: missing profile name");
-                usage();
-                exit(1);
-            } else {
-                cprofile = g_strdup(argv[i]);
-            }
-        } else {
-            printf("lxpanel: unknown option - %s\n", argv[i]);
-            usage();
-            exit(1);
-        }
-    }
-
-    /* Add a gtkrc file to be parsed too. */
-    file = _user_config_file_name("gtkrc", NULL);
-    gtk_rc_parse(file);
-    g_free(file);
-
-    /* Check for duplicated lxpanel instances */
-    if (!check_main_lock() && !config) {
-        printf("There is already an instance of LXPanel.  Now to exit\n");
-        exit(1);
-    }
-
-    _ensure_user_config_dirs();
-
-    /* Add our own icons to the search path of icon theme */
-    gtk_icon_theme_append_search_path( gtk_icon_theme_get_default(), PACKAGE_DATA_DIR "/images" );
-
-    fbev = fb_ev_new();
-    win_grp = gtk_window_group_new();
-
-    is_restarting = FALSE;
-
-    /* init LibFM */
-    fm_gtk_init(NULL);
-
-    /* prepare modules data */
-    _prepare_modules();
-
-    load_global_config();
-
-    /* NOTE: StructureNotifyMask is required by XRandR
-     * See init_randr_support() in gdkscreen-x11.c of gtk+ for detail.
-     */
-    gdk_window_set_events(gdk_get_default_root_window(), GDK_STRUCTURE_MASK |
-            GDK_SUBSTRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK);
-    gdk_window_add_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, NULL);
-
-    if( G_UNLIKELY( ! start_all_panels() ) )
-        g_warning( "Config files are not found.\n" );
-/*
- * FIXME: configure??
-    if (config)
-        configure();
-*/
-    gtk_main();
-
-    XSelectInput (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW(), NoEventMask);
-    gdk_window_remove_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, NULL);
-
-    /* destroy all panels */
-    g_slist_foreach( all_panels, (GFunc) gtk_widget_destroy, NULL );
-    g_slist_free( all_panels );
-    all_panels = NULL;
-    g_free( cfgfile );
-
-    free_global_config();
-
-    _unload_modules();
-    fm_gtk_finalize();
-
-    /* gdk_threads_leave(); */
-
-    g_object_unref(win_grp);
-    g_object_unref(fbev);
-
-    if (!is_restarting)
-        return 0;
-    if (strchr(argv[0], G_DIR_SEPARATOR))
-        execve(argv[0], argv, env);
-    else
-        execve(g_find_program_in_path(argv[0]), argv, env);
-    return 1;
-}
 
 GtkOrientation panel_get_orientation(LXPanel *panel)
 {
index 668c26e..eedee96 100644 (file)
@@ -38,7 +38,6 @@
 //#define DEBUG
 #include "dbg.h"
 
-static void init_plugin_class_list(void);
 static void plugin_class_unref(PluginClass * pc);
 
 GQuark lxpanel_plugin_qinit;
@@ -54,11 +53,6 @@ do {\
     register_plugin_class(&pc, FALSE);\
 } while (0)
 
-/* The same for new plugins type - they will be not unloaded by FmModule */
-#define REGISTER_STATIC_MODULE(pc) do { \
-    extern LXPanelPluginInit lxpanel_static_plugin_##pc; \
-    lxpanel_register_plugin_type(#pc, &lxpanel_static_plugin_##pc); } while (0)
-
 static inline const LXPanelPluginInit *_find_plugin(const char *name)
 {
     return g_hash_table_lookup(_all_types, name);
@@ -105,48 +99,6 @@ static void register_plugin_class(PluginClass * pc, gboolean dynamic)
     g_hash_table_insert(_all_types, g_strdup(pc->type), init);
 }
 
-/* Initialize the static plugins. */
-static void init_plugin_class_list(void)
-{
-#ifdef STATIC_SEPARATOR
-    REGISTER_STATIC_MODULE(separator);
-#endif
-
-#ifdef STATIC_LAUNCHTASKBAR
-    REGISTER_STATIC_MODULE(launchtaskbar);
-#endif
-
-#ifdef STATIC_DCLOCK
-    REGISTER_STATIC_MODULE(dclock);
-#endif
-
-#ifdef STATIC_WINCMD
-    REGISTER_STATIC_MODULE(wincmd);
-#endif
-
-#ifdef STATIC_DIRMENU
-    REGISTER_STATIC_MODULE(dirmenu);
-#endif
-
-#ifdef STATIC_PAGER
-    REGISTER_STATIC_MODULE(pager);
-#endif
-
-#ifdef STATIC_TRAY
-    REGISTER_STATIC_MODULE(tray);
-#endif
-
-#ifndef DISABLE_MENU
-#ifdef STATIC_MENU
-    REGISTER_STATIC_MODULE(menu);
-#endif
-#endif
-
-#ifdef STATIC_SPACE
-    REGISTER_STATIC_MODULE(space);
-#endif
-}
-
 /* Load a dynamic plugin. */
 static void plugin_load_dynamic(const char * type, const gchar * path)
 {
@@ -197,9 +149,6 @@ static void plugin_class_unref(PluginClass * pc)
 /* Loads all available old type plugins. Should be removed in future releases. */
 static void plugin_get_available_classes(void)
 {
-    /* Initialize static plugins on first call. */
-    init_plugin_class_list();
-
 #ifndef DISABLE_PLUGINS_LOADING
     GDir * dir = g_dir_open(PACKAGE_LIB_DIR "/lxpanel/plugins", 0, NULL);
     if (dir != NULL)
index 890d10b..b0ea442 100644 (file)
@@ -59,6 +59,10 @@ extern gboolean is_in_lxde;
 
 extern gchar *cprofile;
 
+extern GSList* all_panels;
+
+extern GtkWindowGroup* win_grp;
+
 /* Context of a panel on a given edge. */
 struct _Panel {
     char* name;
@@ -213,6 +217,8 @@ extern GQuark lxpanel_plugin_qconf; /* access to congig_setting_t data */
 
 gboolean _class_is_present(const LXPanelPluginInit *init);
 
+LXPanel* panel_new(const char* config_file, const char* config_name);
+
 void _panel_show_config_dialog(LXPanel *panel, GtkWidget *p, GtkWidget *dlg);
 
 void _calculate_position(LXPanel *panel);