Move deskno & deskno into dynamic plugins.
authorJim Huang <jserv.tw@gmail.com>
Sun, 12 Nov 2006 16:33:52 +0000 (16:33 +0000)
committerJim Huang <jserv.tw@gmail.com>
Sun, 12 Nov 2006 16:33:52 +0000 (16:33 +0000)
Currenly, deskno2 is not built with any configurations.

configure.ac
src/plugin.c
src/plugin.h
src/plugins/Makefile.am
src/plugins/deskno.c [deleted file]
src/plugins/deskno/Makefile.am [new file with mode: 0644]
src/plugins/deskno/deskno.c [new file with mode: 0644]
src/plugins/deskno/deskno2.c [new file with mode: 0644]
src/plugins/deskno2.c [deleted file]

index 5d2d7ac..000d19f 100644 (file)
@@ -34,6 +34,7 @@ dnl Here are plugin listing.
 plugin_netstatus=
 plugin_volume=
 plugin_cpu=
+plugin_deskno=
 
 AC_MSG_CHECKING([which plugins should be built dynamically])
 AC_ARG_WITH(plugins,
@@ -41,7 +42,7 @@ AC_ARG_WITH(plugins,
 [                         plugins may be comma separated ]
 [                         'all' builds all plugins (default), 'none' builds none ]
 [                         Possible plugins are: ]
-[                         netstatus, volume, cpu], plugins="$withval",[plugins="all"])
+[                         netstatus, volume, cpu, deskno], plugins="$withval",[plugins="all"])
 
 if test x"$plugins" != xall -a x"$plugins" != xnone; then
        if test x"$plugins_loading" = xno; then
@@ -54,6 +55,7 @@ if test x"$plugins" = xall; then
        plugin_netstatus=netstatus
        plugin_volume=volume
        plugin_cpu=cpu
+       plugin_deskno=deskno
        AC_MSG_RESULT(all)
 else
        if test "$plugins" != "none"; then
@@ -70,6 +72,9 @@ else
                        cpu)
                                plugin_cpu=cpu
                                ;;
+                       deskno)
+                               plugin_deskno=deskno
+                               ;;
                        *)
                                echo "Unknown plugin $plugin."
                                exit 1
@@ -80,7 +85,7 @@ else
        fi
 fi
 
-PLUGINS_LIST="$plugin_netstatus $plugin_volume $plugin_cpu"
+PLUGINS_LIST="$plugin_netstatus $plugin_volume $plugin_cpu $plugin_deskno"
 AC_SUBST(PLUGINS_LIST)
 
 
@@ -120,6 +125,7 @@ AC_CONFIG_FILES([
        src/plugins/netstatus/Makefile
        src/plugins/volume/Makefile
        src/plugins/cpu/Makefile
+       src/plugins/deskno/Makefile
        po/Makefile.in
        data/Makefile
        data/default
@@ -127,7 +133,7 @@ AC_CONFIG_FILES([
 AC_OUTPUT
 
 echo                                                                                                
-echo lxpanel........................ : Version $VERSION
+echo lxpanel ......................... : Version $VERSION
 echo
 echo Prefix........................... : $prefix
 if test x$plugins_loading = xyes; then
@@ -141,6 +147,9 @@ echo Building dynamic plugins:
        if test x"$plugin_cpu" != x; then
                AC_MSG_RESULT([    cpu - Display CPU loading])
        fi
+       if test x"$plugin_deskno" != x; then
+               AC_MSG_RESULT([    deskno - Display desktop number])
+       fi
 else
 echo Dynamic loader for plugins....... : disabled.
 fi
index 385b909..3a425c2 100644 (file)
@@ -114,10 +114,6 @@ init_plugin_class_list()
     REGISTER_PLUGIN_CLASS(icons_plugin_class, 0);
 #endif
 
-#ifdef STATIC_DESKNO
-    REGISTER_PLUGIN_CLASS(deskno_plugin_class, 0);
-#endif
-
     RET();
 }
 
index 5da3303..03f1e77 100644 (file)
@@ -78,6 +78,5 @@ void plugin_stop(plugin *this);
 #define STATIC_MENU
 #define STATIC_SPACE
 #define STATIC_ICONS
-#define STATIC_DESKNO
 
 #endif
index 9d82e8c..fe6ceda 100644 (file)
@@ -18,7 +18,6 @@ INCLUDES = \
        $(PACKAGE_CFLAGS)
 
 PLUGINS_SOURCES= \
-       deskno.c \
        launchbar.c \
        ptk-app-menu.c ptk-app-menu.h \
        taskbar.c \
@@ -26,7 +25,6 @@ PLUGINS_SOURCES= \
        icons.c \
        menu.c \
        separator.c \
-       deskno2.c \
        image.c \
        pager.c \
        space.c \
diff --git a/src/plugins/deskno.c b/src/plugins/deskno.c
deleted file mode 100644 (file)
index c60810b..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-// reused dclock.c and variables from pager.c
-// 11/23/04 by cmeury
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib/gi18n.h>
-
-#include "panel.h"
-#include "misc.h"
-#include "plugin.h"
-
-// #define DEBUG
-#include "dbg.h"
-
-typedef struct {
-    GtkWidget *main;
-    GtkWidget *namew;
-    GtkTooltips *tip;
-} deskno;
-
-static  void
-clicked( GtkWidget *widget, gpointer data)
-{
-    int desknum = get_net_current_desktop();
-    int desks = get_net_number_of_desktops();
-    int newdesk;
-
-    ENTER;
-    if(desknum == (desks - 1))
-       newdesk = 0;
-    else
-       newdesk = desknum + 1;
-    g_assert(data != NULL);
-    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, newdesk, 0, 0, 0, 0);
-    RET();
-}
-
-
-
-static gint
-name_update(GtkWidget *widget, deskno *dc)
-{
-    char buffer [15];
-    int n;
-    int desknum = get_net_current_desktop() + 1;
-
-    ENTER;
-    n = sprintf(buffer, "<b>%d</b>", desknum);
-    gtk_label_set_markup (GTK_LABEL(dc->namew), buffer) ;
-    RET(TRUE);
-}
-
-
-static int
-deskno_constructor(plugin *p, char** fp)
-{
-    deskno *dc;
-    GtkWidget *button;
-    
-    ENTER;
-    dc = g_new0(deskno, 1);
-    g_return_val_if_fail(dc != NULL, 0);
-    p->priv = dc;
-    
-    dc->main = gtk_event_box_new();
-    dc->tip  = gtk_tooltips_new();
-    button = gtk_button_new();
-    gtk_button_set_relief(GTK_BUTTON(button),GTK_RELIEF_NONE);
-    g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (clicked), (gpointer) dc);
-    dc->namew = gtk_label_new("ww");
-    gtk_container_add(GTK_CONTAINER(button), dc->namew);
-    gtk_container_add(GTK_CONTAINER(p->pwid), button);
-    gtk_widget_show_all(p->pwid);
-    name_update(button, dc);
-    g_signal_connect (G_OBJECT (fbev), "current_desktop", G_CALLBACK (name_update), (gpointer) dc);
-    RET(1);
-
-
-}
-
-
-static void
-deskno_destructor(plugin *p)
-{
-  deskno *dc = (deskno *)p->priv;
-
-  ENTER;
-  dc = (deskno *) p->priv;
-  g_signal_handlers_disconnect_by_func(G_OBJECT (fbev), name_update, dc); 
-  g_free(dc);
-  RET();
-}
-
-plugin_class deskno_plugin_class = {
-    fname: NULL,
-    count: 0,
-
-    type : "deskno",
-    name : N_("Desktop No / Workspace Name"),
-    version: "0.6",
-    description : N_("Display workspace number, by cmeury@users.sf.net"),
-
-    constructor : deskno_constructor,
-    destructor  : deskno_destructor,
-    config : NULL,
-    save : NULL
-};
diff --git a/src/plugins/deskno/Makefile.am b/src/plugins/deskno/Makefile.am
new file mode 100644 (file)
index 0000000..70a69d9
--- /dev/null
@@ -0,0 +1,20 @@
+INCLUDES = \
+       -I. \
+       -I$(top_srcdir)/src \
+       $(PACKAGE_CFLAGS)
+
+module_LTLIBRARIES = deskno.la
+
+moduledir = $(libdir)/lxpanel/plugins
+
+deskno_la_SOURCES = \
+       deskno.c
+
+deskno_la_LIBADD = \
+       $(PACKAGE_CFLAGS)
+
+deskno_la_LDFLAGS = \
+       -avoid-version \
+       -rpath $(moduledir) \
+       -module \
+       -export-symbols-regex '_plugin_class$$'
diff --git a/src/plugins/deskno/deskno.c b/src/plugins/deskno/deskno.c
new file mode 100644 (file)
index 0000000..c60810b
--- /dev/null
@@ -0,0 +1,108 @@
+// reused dclock.c and variables from pager.c
+// 11/23/04 by cmeury
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib/gi18n.h>
+
+#include "panel.h"
+#include "misc.h"
+#include "plugin.h"
+
+// #define DEBUG
+#include "dbg.h"
+
+typedef struct {
+    GtkWidget *main;
+    GtkWidget *namew;
+    GtkTooltips *tip;
+} deskno;
+
+static  void
+clicked( GtkWidget *widget, gpointer data)
+{
+    int desknum = get_net_current_desktop();
+    int desks = get_net_number_of_desktops();
+    int newdesk;
+
+    ENTER;
+    if(desknum == (desks - 1))
+       newdesk = 0;
+    else
+       newdesk = desknum + 1;
+    g_assert(data != NULL);
+    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, newdesk, 0, 0, 0, 0);
+    RET();
+}
+
+
+
+static gint
+name_update(GtkWidget *widget, deskno *dc)
+{
+    char buffer [15];
+    int n;
+    int desknum = get_net_current_desktop() + 1;
+
+    ENTER;
+    n = sprintf(buffer, "<b>%d</b>", desknum);
+    gtk_label_set_markup (GTK_LABEL(dc->namew), buffer) ;
+    RET(TRUE);
+}
+
+
+static int
+deskno_constructor(plugin *p, char** fp)
+{
+    deskno *dc;
+    GtkWidget *button;
+    
+    ENTER;
+    dc = g_new0(deskno, 1);
+    g_return_val_if_fail(dc != NULL, 0);
+    p->priv = dc;
+    
+    dc->main = gtk_event_box_new();
+    dc->tip  = gtk_tooltips_new();
+    button = gtk_button_new();
+    gtk_button_set_relief(GTK_BUTTON(button),GTK_RELIEF_NONE);
+    g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (clicked), (gpointer) dc);
+    dc->namew = gtk_label_new("ww");
+    gtk_container_add(GTK_CONTAINER(button), dc->namew);
+    gtk_container_add(GTK_CONTAINER(p->pwid), button);
+    gtk_widget_show_all(p->pwid);
+    name_update(button, dc);
+    g_signal_connect (G_OBJECT (fbev), "current_desktop", G_CALLBACK (name_update), (gpointer) dc);
+    RET(1);
+
+
+}
+
+
+static void
+deskno_destructor(plugin *p)
+{
+  deskno *dc = (deskno *)p->priv;
+
+  ENTER;
+  dc = (deskno *) p->priv;
+  g_signal_handlers_disconnect_by_func(G_OBJECT (fbev), name_update, dc); 
+  g_free(dc);
+  RET();
+}
+
+plugin_class deskno_plugin_class = {
+    fname: NULL,
+    count: 0,
+
+    type : "deskno",
+    name : N_("Desktop No / Workspace Name"),
+    version: "0.6",
+    description : N_("Display workspace number, by cmeury@users.sf.net"),
+
+    constructor : deskno_constructor,
+    destructor  : deskno_destructor,
+    config : NULL,
+    save : NULL
+};
diff --git a/src/plugins/deskno/deskno2.c b/src/plugins/deskno/deskno2.c
new file mode 100644 (file)
index 0000000..b62e26c
--- /dev/null
@@ -0,0 +1,137 @@
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib/gi18n.h>
+
+#include "panel.h"
+#include "misc.h"
+#include "plugin.h"
+
+//#define DEBUG
+#include "dbg.h"
+
+typedef struct {
+    GtkWidget  *main;
+    int         dno;            // current desktop nomer
+    int         dnum;           // number of desktops
+    char      **dnames;         // desktop names
+    int         dnames_num;     // number of desktop names
+    char      **lnames;         // label names
+    char       *fmt;
+} deskno;
+
+
+
+static  void
+clicked(GtkWidget *widget, deskno *dc)
+{
+    system("xfce-setting-show workspaces");
+}
+
+static  void
+update_dno(GtkWidget *widget, deskno *dc)
+{
+    ENTER;
+    dc->dno = fb_ev_current_desktop(fbev);
+    gtk_button_set_label(GTK_BUTTON(dc->main), dc->lnames[dc->dno]);
+
+    RET();
+}
+
+
+
+static  void
+update_all(GtkWidget *widget, deskno *dc)
+{
+    int i;
+
+    ENTER;
+    dc->dnum = fb_ev_number_of_desktops(fbev);
+    if (dc->dnames)
+        g_strfreev (dc->dnames);
+    if (dc->lnames)
+        g_strfreev (dc->lnames);
+    dc->dnames = get_utf8_property_list(GDK_ROOT_WINDOW(), a_NET_DESKTOP_NAMES, &(dc->dnames_num));
+    dc->lnames = g_new0 (gchar*, dc->dnum + 1);
+    for (i = 0; i < MIN(dc->dnum, dc->dnames_num); i++) {
+        dc->lnames[i] = g_strdup(dc->dnames[i]);
+    }
+    for (; i < dc->dnum; i++) {
+        dc->lnames[i] = g_strdup_printf("%d", i + 1);
+    }
+    update_dno(widget, dc);
+    RET();
+}
+
+
+static gboolean
+scroll (GtkWidget *widget, GdkEventScroll *event, deskno *dc)
+{
+    int dno;
+
+    ENTER;
+    dno = dc->dno + ((event->direction == GDK_SCROLL_UP) ? (-1) : (+1));
+    if (dno < 0)
+        dno = dc->dnum - 1;
+    else if (dno == dc->dnum)
+        dno = 0;
+    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, dno, 0, 0, 0, 0);
+    RET(TRUE);
+
+}
+
+static int
+deskno_constructor(plugin *p, char** fp)
+{
+    deskno *dc;
+    ENTER;
+    dc = g_new0(deskno, 1);
+    g_return_val_if_fail(dc != NULL, 0);
+    p->priv = dc;
+
+    dc->main = gtk_button_new_with_label("w");
+    gtk_button_set_relief(GTK_BUTTON(dc->main),GTK_RELIEF_NONE);
+    gtk_container_set_border_width(GTK_CONTAINER(dc->main), 0);
+    //gtk_button_set_alignment(GTK_BUTTON(dc->main), 0, 0.5);
+    g_signal_connect(G_OBJECT(dc->main), "clicked", G_CALLBACK (clicked), (gpointer) dc);
+    g_signal_connect(G_OBJECT(dc->main), "scroll-event", G_CALLBACK(scroll), (gpointer) dc);
+
+    update_all(dc->main, dc);
+
+    gtk_container_add(GTK_CONTAINER(p->pwid), dc->main);
+    gtk_widget_show_all(p->pwid);
+
+    g_signal_connect (G_OBJECT (fbev), "current_desktop", G_CALLBACK (update_dno), (gpointer) dc);
+    g_signal_connect (G_OBJECT (fbev), "desktop_names", G_CALLBACK (update_all), (gpointer) dc);
+    g_signal_connect (G_OBJECT (fbev), "number_of_desktops", G_CALLBACK (update_all), (gpointer) dc);
+
+    RET(1);
+}
+
+
+static void
+deskno_destructor(plugin *p)
+{
+  deskno *dc = (deskno *)p->priv;
+
+  ENTER;
+  dc = (deskno *) p->priv;
+  //g_signal_handlers_disconnect_by_func(G_OBJECT (fbev), name_update, dc);
+  g_free(dc);
+  RET();
+}
+
+plugin_class deskno2_plugin_class = {
+    fname: NULL,
+    count: 0,
+
+    type : "deskno2",
+    name : N_("Desktop No / Workspace Name"),
+    version: "0.6",
+    description : N_("Display workspace number, by cmeury@users.sf.net"),
+
+    constructor : deskno_constructor,
+    destructor  : deskno_destructor,
+    config : NULL,
+    save : NULL
+};
diff --git a/src/plugins/deskno2.c b/src/plugins/deskno2.c
deleted file mode 100644 (file)
index b62e26c..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib/gi18n.h>
-
-#include "panel.h"
-#include "misc.h"
-#include "plugin.h"
-
-//#define DEBUG
-#include "dbg.h"
-
-typedef struct {
-    GtkWidget  *main;
-    int         dno;            // current desktop nomer
-    int         dnum;           // number of desktops
-    char      **dnames;         // desktop names
-    int         dnames_num;     // number of desktop names
-    char      **lnames;         // label names
-    char       *fmt;
-} deskno;
-
-
-
-static  void
-clicked(GtkWidget *widget, deskno *dc)
-{
-    system("xfce-setting-show workspaces");
-}
-
-static  void
-update_dno(GtkWidget *widget, deskno *dc)
-{
-    ENTER;
-    dc->dno = fb_ev_current_desktop(fbev);
-    gtk_button_set_label(GTK_BUTTON(dc->main), dc->lnames[dc->dno]);
-
-    RET();
-}
-
-
-
-static  void
-update_all(GtkWidget *widget, deskno *dc)
-{
-    int i;
-
-    ENTER;
-    dc->dnum = fb_ev_number_of_desktops(fbev);
-    if (dc->dnames)
-        g_strfreev (dc->dnames);
-    if (dc->lnames)
-        g_strfreev (dc->lnames);
-    dc->dnames = get_utf8_property_list(GDK_ROOT_WINDOW(), a_NET_DESKTOP_NAMES, &(dc->dnames_num));
-    dc->lnames = g_new0 (gchar*, dc->dnum + 1);
-    for (i = 0; i < MIN(dc->dnum, dc->dnames_num); i++) {
-        dc->lnames[i] = g_strdup(dc->dnames[i]);
-    }
-    for (; i < dc->dnum; i++) {
-        dc->lnames[i] = g_strdup_printf("%d", i + 1);
-    }
-    update_dno(widget, dc);
-    RET();
-}
-
-
-static gboolean
-scroll (GtkWidget *widget, GdkEventScroll *event, deskno *dc)
-{
-    int dno;
-
-    ENTER;
-    dno = dc->dno + ((event->direction == GDK_SCROLL_UP) ? (-1) : (+1));
-    if (dno < 0)
-        dno = dc->dnum - 1;
-    else if (dno == dc->dnum)
-        dno = 0;
-    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, dno, 0, 0, 0, 0);
-    RET(TRUE);
-
-}
-
-static int
-deskno_constructor(plugin *p, char** fp)
-{
-    deskno *dc;
-    ENTER;
-    dc = g_new0(deskno, 1);
-    g_return_val_if_fail(dc != NULL, 0);
-    p->priv = dc;
-
-    dc->main = gtk_button_new_with_label("w");
-    gtk_button_set_relief(GTK_BUTTON(dc->main),GTK_RELIEF_NONE);
-    gtk_container_set_border_width(GTK_CONTAINER(dc->main), 0);
-    //gtk_button_set_alignment(GTK_BUTTON(dc->main), 0, 0.5);
-    g_signal_connect(G_OBJECT(dc->main), "clicked", G_CALLBACK (clicked), (gpointer) dc);
-    g_signal_connect(G_OBJECT(dc->main), "scroll-event", G_CALLBACK(scroll), (gpointer) dc);
-
-    update_all(dc->main, dc);
-
-    gtk_container_add(GTK_CONTAINER(p->pwid), dc->main);
-    gtk_widget_show_all(p->pwid);
-
-    g_signal_connect (G_OBJECT (fbev), "current_desktop", G_CALLBACK (update_dno), (gpointer) dc);
-    g_signal_connect (G_OBJECT (fbev), "desktop_names", G_CALLBACK (update_all), (gpointer) dc);
-    g_signal_connect (G_OBJECT (fbev), "number_of_desktops", G_CALLBACK (update_all), (gpointer) dc);
-
-    RET(1);
-}
-
-
-static void
-deskno_destructor(plugin *p)
-{
-  deskno *dc = (deskno *)p->priv;
-
-  ENTER;
-  dc = (deskno *) p->priv;
-  //g_signal_handlers_disconnect_by_func(G_OBJECT (fbev), name_update, dc);
-  g_free(dc);
-  RET();
-}
-
-plugin_class deskno2_plugin_class = {
-    fname: NULL,
-    count: 0,
-
-    type : "deskno2",
-    name : N_("Desktop No / Workspace Name"),
-    version: "0.6",
-    description : N_("Display workspace number, by cmeury@users.sf.net"),
-
-    constructor : deskno_constructor,
-    destructor  : deskno_destructor,
-    config : NULL,
-    save : NULL
-};