Skip to content
Snippets Groups Projects
Commit 46e5fd8c authored by cedric's avatar cedric
Browse files

rename sample plugin to wckbuttons plugin

parent a9f4d62a
No related branches found
No related tags found
No related merge requests found
INCLUDES = \
AM_CPPFLAGS = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"xfce4-sample-plugin\" \
-DG_LOG_DOMAIN=\"xfce4-wckbuttons-plugin\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
$(PLATFORM_CPPFLAGS)
#
# Sample plugin
# Windowck Buttons plugin
#
plugin_LTLIBRARIES = \
libsample.la
libwckbuttons.la
plugindir = \
$(libdir)/xfce4/panel/plugins
libsample_la_SOURCES = \
sample.c \
sample.h \
sample-dialogs.c \
sample-dialogs.h
libwckbuttons_la_SOURCES = \
wckbuttons.c \
wckbuttons.h \
wckbuttons-dialogs.c \
wckbuttons-dialogs.h
libsample_la_CFLAGS = \
libwckbuttons_la_CFLAGS = \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(LIBXFCE4PANEL_CFLAGS) \
$(PLATFORM_CFLAGS)
libsample_la_LDFLAGS = \
libwckbuttons_la_LDFLAGS = \
-avoid-version \
-module \
-no-undefined \
-export-symbols-regex '^xfce_panel_module_(preinit|init|construct)' \
$(PLATFORM_LDFLAGS)
libsample_la_LIBADD = \
libwckbuttons_la_LIBADD = \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(LIBXFCE4PANEL_LIBS)
......@@ -44,12 +44,12 @@ desktopdir = \
$(datadir)/xfce4/panel/plugins
desktop_DATA = \
sample.desktop
wckbuttons.desktop
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
sample.desktop.in
wckbuttons.desktop.in
CLEANFILES = \
$(desktop_DATA)
......
......@@ -27,18 +27,17 @@
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include "sample.h"
#include "sample-dialogs.h"
#include "wckbuttons.h"
#include "wckbuttons-dialogs.h"
/* the website url */
#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-sample-plugin"
#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-wckbuttons-plugin"
static void
sample_configure_response (GtkWidget *dialog,
wckbuttons_configure_response (GtkWidget *dialog,
gint response,
SamplePlugin *sample)
WBPlugin *wb)
{
gboolean result;
......@@ -53,13 +52,13 @@ sample_configure_response (GtkWidget *dialog,
else
{
/* remove the dialog data from the plugin */
g_object_set_data (G_OBJECT (sample->plugin), "dialog", NULL);
g_object_set_data (G_OBJECT (wb->plugin), "dialog", NULL);
/* unlock the panel menu */
xfce_panel_plugin_unblock_menu (sample->plugin);
xfce_panel_plugin_unblock_menu (wb->plugin);
/* save the plugin */
sample_save (sample->plugin, sample);
wckbuttons_save (wb->plugin, wb);
/* destroy the properties dialog */
gtk_widget_destroy (dialog);
......@@ -69,8 +68,8 @@ sample_configure_response (GtkWidget *dialog,
void
sample_configure (XfcePanelPlugin *plugin,
SamplePlugin *sample)
wckbuttons_configure (XfcePanelPlugin *plugin,
WBPlugin *wb)
{
GtkWidget *dialog;
......@@ -78,7 +77,7 @@ sample_configure (XfcePanelPlugin *plugin,
xfce_panel_plugin_block_menu (plugin);
/* create the dialog */
dialog = xfce_titled_dialog_new_with_buttons (_("Sample Plugin"),
dialog = xfce_titled_dialog_new_with_buttons (_("Windowck Buttons"),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
......@@ -97,7 +96,7 @@ sample_configure (XfcePanelPlugin *plugin,
/* connect the reponse signal to the dialog */
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK(sample_configure_response), sample);
G_CALLBACK(wckbuttons_configure_response), wb);
/* show the entire dialog */
gtk_widget_show (dialog);
......@@ -106,7 +105,7 @@ sample_configure (XfcePanelPlugin *plugin,
void
sample_about (XfcePanelPlugin *plugin)
wckbuttons_about (XfcePanelPlugin *plugin)
{
/* about dialog code. you can use the GtkAboutDialog
* or the XfceAboutInfo widget */
......
......@@ -17,17 +17,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __SAMPLE_DIALOGS_H__
#define __SAMPLE_DIALOGS_H__
#ifndef __WCKBUTTONS_DIALOGS_H__
#define __WCKBUTTONS_DIALOGS_H__
G_BEGIN_DECLS
void
sample_configure (XfcePanelPlugin *plugin,
SamplePlugin *sample);
wckbuttons_configure (XfcePanelPlugin *plugin, WBPlugin *wb);
void
sample_about (XfcePanelPlugin *plugin);
wckbuttons_about (XfcePanelPlugin *plugin);
G_END_DECLS
......
......@@ -29,8 +29,8 @@
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-hvbox.h>
#include "sample.h"
#include "sample-dialogs.h"
#include "wckbuttons.h"
#include "wckbuttons-dialogs.h"
/* default settings */
#define DEFAULT_SETTING1 NULL
......@@ -41,17 +41,17 @@
/* prototypes */
static void
sample_construct (XfcePanelPlugin *plugin);
wckbuttons_construct (XfcePanelPlugin *plugin);
/* register the plugin */
XFCE_PANEL_PLUGIN_REGISTER (sample_construct);
XFCE_PANEL_PLUGIN_REGISTER (wckbuttons_construct);
void
sample_save (XfcePanelPlugin *plugin,
SamplePlugin *sample)
wckbuttons_save (XfcePanelPlugin *plugin,
WBPlugin *wb)
{
XfceRc *rc;
gchar *file;
......@@ -73,11 +73,11 @@ sample_save (XfcePanelPlugin *plugin,
{
/* save the settings */
DBG(".");
if (sample->setting1)
xfce_rc_write_entry (rc, "setting1", sample->setting1);
if (wb->setting1)
xfce_rc_write_entry (rc, "setting1", wb->setting1);
xfce_rc_write_int_entry (rc, "setting2", sample->setting2);
xfce_rc_write_bool_entry (rc, "setting3", sample->setting3);
xfce_rc_write_int_entry (rc, "setting2", wb->setting2);
xfce_rc_write_bool_entry (rc, "setting3", wb->setting3);
/* close the rc file */
xfce_rc_close (rc);
......@@ -87,14 +87,14 @@ sample_save (XfcePanelPlugin *plugin,
static void
sample_read (SamplePlugin *sample)
wckbuttons_read (WBPlugin *wb)
{
XfceRc *rc;
gchar *file;
const gchar *value;
/* get the plugin config file location */
file = xfce_panel_plugin_save_location (sample->plugin, TRUE);
file = xfce_panel_plugin_save_location (wb->plugin, TRUE);
if (G_LIKELY (file != NULL))
{
......@@ -108,10 +108,10 @@ sample_read (SamplePlugin *sample)
{
/* read the settings */
value = xfce_rc_read_entry (rc, "setting1", DEFAULT_SETTING1);
sample->setting1 = g_strdup (value);
wb->setting1 = g_strdup (value);
sample->setting2 = xfce_rc_read_int_entry (rc, "setting2", DEFAULT_SETTING2);
sample->setting3 = xfce_rc_read_bool_entry (rc, "setting3", DEFAULT_SETTING3);
wb->setting2 = xfce_rc_read_int_entry (rc, "setting2", DEFAULT_SETTING2);
wb->setting3 = xfce_rc_read_bool_entry (rc, "setting3", DEFAULT_SETTING3);
/* cleanup */
xfce_rc_close (rc);
......@@ -124,57 +124,55 @@ sample_read (SamplePlugin *sample)
/* something went wrong, apply default values */
DBG ("Applying default settings");
sample->setting1 = g_strdup (DEFAULT_SETTING1);
sample->setting2 = DEFAULT_SETTING2;
sample->setting3 = DEFAULT_SETTING3;
wb->setting1 = g_strdup (DEFAULT_SETTING1);
wb->setting2 = DEFAULT_SETTING2;
wb->setting3 = DEFAULT_SETTING3;
}
static SamplePlugin *
sample_new (XfcePanelPlugin *plugin)
static WBPlugin *
wckbuttons_new (XfcePanelPlugin *plugin)
{
SamplePlugin *sample;
WBPlugin *wb;
GtkOrientation orientation;
GtkWidget *label;
/* allocate memory for the plugin structure */
sample = panel_slice_new0 (SamplePlugin);
wb = panel_slice_new0 (WBPlugin);
/* pointer to plugin */
sample->plugin = plugin;
wb->plugin = plugin;
/* read the user settings */
sample_read (sample);
wckbuttons_read (wb);
/* get the current orientation */
orientation = xfce_panel_plugin_get_orientation (plugin);
/* create some panel widgets */
sample->ebox = gtk_event_box_new ();
gtk_widget_show (sample->ebox);
wb->ebox = gtk_event_box_new ();
gtk_widget_show (wb->ebox);
sample->hvbox = xfce_hvbox_new (orientation, FALSE, 2);
gtk_widget_show (sample->hvbox);
gtk_container_add (GTK_CONTAINER (sample->ebox), sample->hvbox);
wb->hvbox = xfce_hvbox_new (orientation, FALSE, 2);
gtk_widget_show (wb->hvbox);
gtk_container_add (GTK_CONTAINER (wb->ebox), wb->hvbox);
/* some sample widgets */
label = gtk_label_new (_("Sample"));
/* some wb widgets */
label = gtk_label_new (_("Window Buttons"));
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (sample->hvbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (wb->hvbox), label, FALSE, FALSE, 0);
label = gtk_label_new (_("Plugin"));
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (sample->hvbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (wb->hvbox), label, FALSE, FALSE, 0);
return sample;
return wb;
}
static void
sample_free (XfcePanelPlugin *plugin,
SamplePlugin *sample)
wckbuttons_free (XfcePanelPlugin *plugin, WBPlugin *wb)
{
GtkWidget *dialog;
......@@ -184,33 +182,33 @@ sample_free (XfcePanelPlugin *plugin,
gtk_widget_destroy (dialog);
/* destroy the panel widgets */
gtk_widget_destroy (sample->hvbox);
gtk_widget_destroy (wb->hvbox);
/* cleanup the settings */
if (G_LIKELY (sample->setting1 != NULL))
g_free (sample->setting1);
if (G_LIKELY (wb->setting1 != NULL))
g_free (wb->setting1);
/* free the plugin structure */
panel_slice_free (SamplePlugin, sample);
panel_slice_free (WBPlugin, wb);
}
static void
sample_orientation_changed (XfcePanelPlugin *plugin,
wckbuttons_orientation_changed (XfcePanelPlugin *plugin,
GtkOrientation orientation,
SamplePlugin *sample)
WBPlugin *wb)
{
/* change the orienation of the box */
xfce_hvbox_set_orientation (XFCE_HVBOX (sample->hvbox), orientation);
xfce_hvbox_set_orientation (XFCE_HVBOX (wb->hvbox), orientation);
}
static gboolean
sample_size_changed (XfcePanelPlugin *plugin,
wckbuttons_size_changed (XfcePanelPlugin *plugin,
gint size,
SamplePlugin *sample)
WBPlugin *wb)
{
GtkOrientation orientation;
......@@ -230,42 +228,42 @@ sample_size_changed (XfcePanelPlugin *plugin,
static void
sample_construct (XfcePanelPlugin *plugin)
wckbuttons_construct (XfcePanelPlugin *plugin)
{
SamplePlugin *sample;
WBPlugin *wb;
/* setup transation domain */
xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
/* create the plugin */
sample = sample_new (plugin);
wb = wckbuttons_new (plugin);
/* add the ebox to the panel */
gtk_container_add (GTK_CONTAINER (plugin), sample->ebox);
gtk_container_add (GTK_CONTAINER (plugin), wb->ebox);
/* show the panel's right-click menu on this ebox */
xfce_panel_plugin_add_action_widget (plugin, sample->ebox);
xfce_panel_plugin_add_action_widget (plugin, wb->ebox);
/* connect plugin signals */
g_signal_connect (G_OBJECT (plugin), "free-data",
G_CALLBACK (sample_free), sample);
G_CALLBACK (wckbuttons_free), wb);
g_signal_connect (G_OBJECT (plugin), "save",
G_CALLBACK (sample_save), sample);
G_CALLBACK (wckbuttons_save), wb);
g_signal_connect (G_OBJECT (plugin), "size-changed",
G_CALLBACK (sample_size_changed), sample);
G_CALLBACK (wckbuttons_size_changed), wb);
g_signal_connect (G_OBJECT (plugin), "orientation-changed",
G_CALLBACK (sample_orientation_changed), sample);
G_CALLBACK (wckbuttons_orientation_changed), wb);
/* show the configure menu item and connect signal */
xfce_panel_plugin_menu_show_configure (plugin);
g_signal_connect (G_OBJECT (plugin), "configure-plugin",
G_CALLBACK (sample_configure), sample);
G_CALLBACK (wckbuttons_configure), wb);
/* show the about menu item and connect signal */
xfce_panel_plugin_menu_show_about (plugin);
g_signal_connect (G_OBJECT (plugin), "about",
G_CALLBACK (sample_about), NULL);
G_CALLBACK (wckbuttons_about), NULL);
}
[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
_Name=Sample Plugin
_Comment=Sample plugin for the Xfce panel
Icon=xfce4-sample-plugin
X-XFCE-Module=sample
_Name=Window Buttons
_Comment=Put the maximized window buttons on the panel.
Icon=wckbuttons-plugin
X-XFCE-Module=wckbuttons
X-XFCE-Internal=false
X-XFCE-Unique=false
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __SAMPLE_H__
#define __SAMPLE_H__
#ifndef __WCKBUTTONS_H__
#define __WCKBUTTONS_H__
G_BEGIN_DECLS
......@@ -32,19 +32,19 @@ typedef struct
GtkWidget *hvbox;
GtkWidget *label;
/* sample settings */
/* wckbuttons settings */
gchar *setting1;
gint setting2;
gboolean setting3;
}
SamplePlugin;
WBPlugin;
void
sample_save (XfcePanelPlugin *plugin,
SamplePlugin *sample);
wckbuttons_save (XfcePanelPlugin *plugin,
WBPlugin *wb);
G_END_DECLS
#endif /* !__SAMPLE_H__ */
#endif /* !__WCKBUTTONS_H__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment