Browse Source

Add seprator plugin + some renames.

upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
75dfc64b9b
  1. 3
      TODO
  2. 1
      configure.in.in
  3. 1
      plugins/Makefile.am
  4. 85
      plugins/launcher/launcher-dialog.glade
  5. 3
      plugins/launcher/launcher.c
  6. 6
      plugins/launcher/launcher.h
  7. 79
      plugins/separator/Makefile.am
  8. 107
      plugins/separator/separator-dialog.glade
  9. 314
      plugins/separator/separator.c
  10. 8
      plugins/separator/separator.desktop.in.in
  11. 40
      plugins/separator/separator.h
  12. 4
      plugins/tasklist/Makefile.am
  13. 206
      plugins/tasklist/plugin.c
  14. 1268
      plugins/tasklist/tasklist-widget.c
  15. 0
      plugins/tasklist/tasklist-widget.h
  16. 1268
      plugins/tasklist/tasklist.c

3
TODO

@ -28,5 +28,4 @@ Plugins
~/.local/share/applications/).
- Transparent tray icons (Fixed in Gtk+?).
- Option to 'disable' tray icons instead of hiding them.
- Use libnotify for systray notifications, currently the code is disabled.
- Use libnotify (dbus api?) for systray notifications, currently the code is disabled.

1
configure.in.in

@ -242,6 +242,7 @@ wrapper/Makefile
plugins/Makefile
plugins/clock/Makefile
plugins/launcher/Makefile
plugins/separator/Makefile
plugins/showdesktop/Makefile
plugins/systray/Makefile
plugins/tasklist/Makefile

1
plugins/Makefile.am

@ -3,6 +3,7 @@
SUBDIRS = \
clock \
launcher \
separator \
showdesktop \
systray \
tasklist

85
plugins/launcher/launcher-dialog.glade

@ -151,11 +151,11 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkTable" id="table1">
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="n_rows">7</property>
@ -163,12 +163,11 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label5">
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry-name</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@ -176,12 +175,11 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Description:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry-description</property>
</object>
<packing>
<property name="top_attach">1</property>
@ -191,12 +189,11 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Icon:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry-icon</property>
</object>
<packing>
<property name="top_attach">2</property>
@ -206,12 +203,11 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label8">
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Co_mmand:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry-command</property>
</object>
<packing>
<property name="top_attach">3</property>
@ -221,12 +217,11 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label9">
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Working Directory:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry-working-directory</property>
</object>
<packing>
<property name="top_attach">4</property>
@ -236,7 +231,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<object class="GtkLabel" id="label21">
<property name="visible">True</property>
</object>
<packing>
@ -247,7 +242,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="entry-name">
<object class="GtkEntry" id="entry-name2">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
@ -258,7 +253,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="entry-description">
<object class="GtkEntry" id="entry-description2">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
@ -271,7 +266,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="entry-command">
<object class="GtkEntry" id="entry-command2">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
@ -284,29 +279,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="command-select">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="entry-working-directory">
<object class="GtkFileChooserButton" id="entry-working-directory2">
<property name="visible">True</property>
<property name="action">select-folder</property>
<property name="title" translatable="yes">Select A Working Directory</property>
@ -320,7 +293,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="entry-terminal">
<object class="GtkCheckButton" id="entry-terminal2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -337,7 +310,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="entry-startup-notify">
<object class="GtkCheckButton" id="entry-startup-notify2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -354,19 +327,19 @@
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
<object class="GtkButton" id="entry-icon">
<object class="GtkButton" id="button5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage" id="image6">
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="stock">gtk-missing-image</property>
<property name="icon-size">5</property>
</object>
</child>
@ -381,12 +354,32 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>

3
plugins/launcher/launcher.c

@ -267,7 +267,8 @@ launcher_plugin_construct (XfcePanelPlugin *panel_plugin)
/* open the xfconf channel */
plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
g_signal_connect (G_OBJECT (plugin->channel), "property-changed", G_CALLBACK (launcher_plugin_property_changed), plugin);
g_signal_connect (G_OBJECT (plugin->channel), "property-changed",
G_CALLBACK (launcher_plugin_property_changed), plugin);
/* show the configure menu item */
xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));

6
plugins/launcher/launcher.h

@ -15,8 +15,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __XFCE_LAUNCHER_PLUGIN_H__
#define __XFCE_LAUNCHER_PLUGIN_H__
#ifndef __LAUNCHER_H__
#define __LAUNCHER_H__
#include <gtk/gtk.h>
#include <xfconf/xfconf.h>
@ -121,4 +121,4 @@ GdkPixbuf *launcher_plugin_load_pixbuf (const gchar *name, gint size, GtkIconThe
G_END_DECLS
#endif /* !__XFCE_LAUNCHER_PLUGIN_H__ */
#endif /* !__LAUNCHER_H__ */

79
plugins/separator/Makefile.am

@ -1,57 +1,69 @@
# $Id$
INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libseparator\" \
-DLOCALEDIR=\"$(localedir)\" \
INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libseparator\" \
-DLOCALEDIR=\"$(localedir)\" \
$(PLATFORM_CPPFLAGS)
plugindir = \
plugindir = \
$(libdir)/xfce4/panel-plugins
plugin_LTLIBRARIES = \
plugin_LTLIBRARIES = \
libseparator.la
libseparator_la_SOURCES = \
separator.c
libseparator_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(PLATFORM_CFLAGS)
libseparator_la_LDFLAGS = \
-avoid-version \
-module \
libseparator_la_SOURCES = \
separator.c \
separator.h \
separator-dialog_glade.h
libseparator_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(PLATFORM_CFLAGS) \
$(XFCONF_CFLAGS)
libseparator_la_LDFLAGS = \
-avoid-version \
-module \
$(PLATFORM_LDFLAGS)
if HAVE_CYGWIN
libseparator_la_LDFLAGS += \
libseparator_la_LDFLAGS += \
-no-undefined
endif
libseparator_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(CAIRO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS)
libseparator_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(CAIRO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(XFCONF_LIBS)
libseparator_la_DEPENDENCIES = \
libseparator_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la
if MAINTAINER_MODE
BUILT_SOURCES = \
separator-dialog_glade.h
separator-dialog_glade.h: separator-dialog.glade
exo-csource --static --strip-comments --strip-content --name=separator_dialog_glade $< >$@
endif
#
# .desktop file
#
desktopdir = \
desktopdir = \
$(datadir)/xfce4/panel-plugins
desktop_in_in_files = \
desktop_in_in_files = \
separator.desktop.in.in
desktop_in_files = \
desktop_in_files = \
$(desktop_in_in_files:.desktop.in.in=.desktop.in)
%.desktop.in: %.desktop.in.in
@ -60,11 +72,12 @@ desktop_in_files = \
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
EXTRA_DIST = \
separator-dialog.glade \
$(desktop_in_in_files)
DISTCLEANFILES = \
$(desktop_DATA) \
DISTCLEANFILES = \
$(desktop_DATA) \
$(desktop_in_files)
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

107
plugins/separator/separator-dialog.glade

@ -4,7 +4,7 @@
<!-- interface-requires xfce4 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
<property name="title" translatable="yes">Seperator Properties</property>
<property name="title" translatable="yes">Separator Properties</property>
<property name="icon_name">gtk-properties</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
@ -21,82 +21,57 @@
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<property name="top_padding">6</property>
<property name="bottom_padding">12</property>
<property name="left_padding">18</property>
<property name="right_padding">6</property>
<child>
<object class="GtkVBox" id="vbox1">
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkRadioButton" id="style-empty">
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="label" translatable="yes">_Empty space</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Style:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">style</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="style">
<property name="visible">True</property>
<property name="model">style-model</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="style-empty-expand">
<object class="GtkCheckButton" id="expand">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">style-empty</property>
<property name="label" translatable="yes">E_xpanding empty space</property>
<property name="label" translatable="yes">_Expand</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="style-line">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">style-empty</property>
<property name="label" translatable="yes">_Line</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="style-handle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">style-empty</property>
<property name="label" translatable="yes">_Handle</property>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="style-dots">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">style-empty</property>
<property name="label" translatable="yes">_Dots</property>
</object>
<packing>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>
@ -141,4 +116,24 @@
</object>
</child>
</object>
<object class="GtkListStore" id="style-model">
<columns>
<!-- column-name title -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Transparent</col>
</row>
<row>
<col id="0" translatable="yes">Separator</col>
</row>
<row>
<col id="0" translatable="yes">Handle</col>
</row>
<row>
<col id="0" translatable="yes">Dots</col>
</row>
</data>
</object>
</interface>

314
plugins/separator/separator.c

@ -22,160 +22,314 @@
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
#include "separator.h"
#include "separator-dialog_glade.h"
typedef struct _XfceSeparatorClass XfceSeparatorClass;
typedef struct _XfceSeparator XfceSeparator;
typedef enum _XfceSeparatorMode XfceSeparatorStyle;
#define SEPARATOR_OFFSET (0.15)
#define SEPARATOR_SIZE (8)
static void xfce_separator_class_init (XfceSeparatorClass *klass);
static void xfce_separator_init (XfceSeparator *separator);
static void xfce_separator_finalize (GObject *object);
static void xfce_separator_configure_plugin (XfcePanelPlugin *plugin);
static void xfce_separator_load (XfceSeparator *separator);
static void separator_plugin_class_init (SeparatorPluginClass *klass);
static void separator_plugin_init (SeparatorPlugin *separator);
static gboolean separator_plugin_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void separator_plugin_construct (XfcePanelPlugin *panel_plugin);
static void separator_plugin_free_data (XfcePanelPlugin *panel_plugin);
static gboolean separator_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size);
static void separator_plugin_save (XfcePanelPlugin *panel_plugin);
static void separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
static void separator_plugin_property_changed (XfconfChannel *channel,
const gchar *property_name,
const GValue *value,
SeparatorPlugin *plugin);
struct _XfceSeparatorClass
enum _SeparatorPluginMode
{
/* modes */
SEPARATOR_PLUGIN_MODE_TRANSPARENT = 0,
SEPARATOR_PLUGIN_MODE_SEPARATOR,
SEPARATOR_PLUGIN_MODE_HANDLE,
SEPARATOR_PLUGIN_MODE_DOTS,
/* defines */
SEPARATOR_PLUGIN_MODE_MIN = SEPARATOR_PLUGIN_MODE_TRANSPARENT,
SEPARATOR_PLUGIN_MODE_MAX = SEPARATOR_PLUGIN_MODE_DOTS,
SEPARATOR_PLUGIN_MODE_DEFAULT = SEPARATOR_PLUGIN_MODE_SEPARATOR
};
struct _SeparatorPluginClass
{
/* parent class */
XfcePanelPluginClass __parent__;
};
struct _XfceSeparator
struct _SeparatorPlugin
{
/* parent type */
XfcePanelPlugin __parent__;
/* separator style */
XfceSeparatorStyle style;
/* xfconf channel */
XfconfChannel *channel;
/* if the separator should expand */
guint expand : 1;
/* separator style */
SeparatorPluginStyle style;
};
enum _XfceSeparatorMode
{
XFCE_SEPARATOR_MODE_TRANSPARENT,
XFCE_SEPARATOR_MODE_SEPARATOR,
XFCE_SEPARATOR_MODE_HANDLE,
XFCE_SEPARATOR_MODE_DOTS
};
G_DEFINE_TYPE (SeparatorPlugin, separator_plugin, XFCE_TYPE_PANEL_PLUGIN);
XFCE_PANEL_DEFINE_TYPE (XfceSeparator, xfce_separator, XFCE_TYPE_PANEL_PLUGIN);
/* register the panel plugin */
XFCE_PANEL_PLUGIN_REGISTER_OBJECT (XFCE_TYPE_SEPARATOR_PLUGIN);
static void
xfce_separator_class_init (XfceSeparatorClass *klass)
separator_plugin_class_init (SeparatorPluginClass *klass)
{
XfcePanelPluginClass *plugin_class;
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->expose_event = separator_plugin_expose_event;
plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
plugin_class->save = xfce_separator_save;
plugin_class->configure_plugin = xfce_separator_configure_plugin;
plugin_class->construct = separator_plugin_construct;
plugin_class->free_data = separator_plugin_free_data;
plugin_class->save = separator_plugin_save;
plugin_class->size_changed = separator_plugin_size_changed;
plugin_class->configure_plugin = separator_plugin_configure_plugin;
}
static void
xfce_separator_init (XfceSeparator *separator)
separator_plugin_init (SeparatorPlugin *plugin)
{
/* initialize the default values */
separator->style = XFCE_SEPARATOR_MODE_SEPARATOR;
separator->expand = FALSE;
/* init, draw nothing */
plugin->style = SEPARATOR_PLUGIN_MODE_TRANSPARENT;
/* initialize xfconf */
xfconf_init (NULL);
}
static gboolean
separator_plugin_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (widget);
GtkAllocation *alloc = &(widget->allocation);
switch (plugin->style)
{
case SEPARATOR_PLUGIN_MODE_TRANSPARENT:
/* do nothing */
break;
case SEPARATOR_PLUGIN_MODE_SEPARATOR:
if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) ==
GTK_ORIENTATION_HORIZONTAL)
{
/* paint vertical separator */
gtk_paint_vline (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
&(event->area),
widget, "separator",
alloc->y + alloc->height * SEPARATOR_OFFSET,
alloc->y + alloc->height * (1.00 - SEPARATOR_OFFSET),
alloc->x + alloc->width / 2 - 1);
}
else
{
/* paint horizontal separator */
gtk_paint_hline (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
&(event->area),
widget, "separator",
alloc->x + alloc->width * SEPARATOR_OFFSET,
alloc->x + alloc->width * (1.00 - SEPARATOR_OFFSET),
alloc->y + alloc->height / 2 - 1);
}
break;
case SEPARATOR_PLUGIN_MODE_HANDLE:
/* paint handle box */
gtk_paint_handle (widget->style,
widget->window,
GTK_WIDGET_STATE (widget),
GTK_SHADOW_NONE,
&(event->area),
widget, "handlebox",
alloc->x, alloc->y,
alloc->width, alloc->height,
xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)));
break;
case SEPARATOR_PLUGIN_MODE_DOTS:
/* TODO */
break;
}
return FALSE;
}
static void
separator_plugin_construct (XfcePanelPlugin *panel_plugin)
{
SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
gboolean expand;
guint style;
/* set the xfconf channel */
plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
g_signal_connect (G_OBJECT (plugin->channel), "property-changed",
G_CALLBACK (separator_plugin_property_changed), plugin);
/* show the properties dialog */
xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (clock));
xfce_panel_plugin_menu_show_configure (panel_plugin);
/* read the user settings */
xfce_separator_load (separator);
/* read the style */
style = xfconf_channel_get_uint (plugin->channel, "/style", SEPARATOR_PLUGIN_MODE_DEFAULT);
plugin->style = CLAMP (style, SEPARATOR_PLUGIN_MODE_MIN, SEPARATOR_PLUGIN_MODE_MAX);
/* expand the plugin if requested */
expand = xfconf_channel_get_bool (plugin->channel, "/expand", FALSE);
xfce_panel_plugin_set_expand (panel_plugin, expand);
/* now we draw the plugin */
gtk_widget_queue_draw (GTK_WIDGET (panel_plugin));
}
static void
xfce_separator_save (XfcePanelPlugin *plugin)
separator_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
XfceSeparator *separator = XFCE_SEPARATOR (plugin);
gchar *filename;
XfceRc *rc;
SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
/* get the config file */
filename = xfce_panel_plugin_save_location (plugin, TRUE);
if (G_LIKELY (filename))
{
/* open rc file */
rc = xfce_rc_simple_open (filename, FALSE);
/* release the xfonf channel */
g_object_unref (G_OBJECT (plugin->channel));
/* cleanup */
g_free (filename);
/* shutdown xfconf */
xfconf_shutdown ();
}
if (G_LIKELY (rc))
{
/* save the settings */
xfce_rc_write_int_entry (rc, "Expand", separator->expand);
xfce_rc_write_bool_entry (rc, "Style", separator->style);
/* close the rc file */
xfce_rc_close (rc);
}
}
static gboolean
separator_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size)
{
/* set the minimum separator size */
if (xfce_panel_plugin_get_orientation (panel_plugin) ==
GTK_ORIENTATION_HORIZONTAL)
gtk_widget_set_size_request (GTK_WIDGET (panel_plugin),
SEPARATOR_SIZE, size);
else
gtk_widget_set_size_request (GTK_WIDGET (panel_plugin),
size, SEPARATOR_SIZE);
return TRUE;
}
static void
xfce_separator_configure_plugin (XfcePanelPlugin *plugin)
separator_plugin_save (XfcePanelPlugin *panel_plugin)
{
SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
/* store settings */
xfconf_channel_set_uint (plugin->channel, "/style", plugin->style);
xfconf_channel_set_bool (plugin->channel, "/expand",
xfce_panel_plugin_get_expand (panel_plugin));
}
static void
xfce_separator_load (XfceSeparator *separator)
separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
{
gchar *filename;
XfceRc *rc;
SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
GtkBuilder *builder;
GObject *dialog;
GObject *object;
/* config filename */
filename = xfce_panel_plugin_lookup_rc_file (XFCE_PANEL_PLUGIN (separator));
if (G_LIKELY (filename))
panel_return_if_fail (XFCE_IS_SEPARATOR_PLUGIN (plugin));
/* load the dialog from the glade file */
builder = gtk_builder_new ();
if (gtk_builder_add_from_string (builder, separator_dialog_glade, separator_dialog_glade_length, NULL))
{
/* open rc file (readonly) */
rc = xfce_rc_simple_open (filename, TRUE);
dialog = gtk_builder_get_object (builder, "dialog");
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
/* cleanup */
g_free (filename);
xfce_panel_plugin_block_menu (panel_plugin);
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) xfce_panel_plugin_unblock_menu, panel_plugin);
if (G_LIKELY (rc))
{
/* read the settings */
separator->expand = xfce_rc_read_bool_entry (rc, "Expand", FALSE);
separator->style = xfce_rc_read_int_entry (rc, "Style", XFCE_SEPARATOR_MODE_SEPARATOR);
object = gtk_builder_get_object (builder, "close-button");
g_signal_connect_swapped (G_OBJECT (object), "clicked", G_CALLBACK (gtk_widget_destroy), dialog);
/* close the rc file */
xfce_rc_close (rc);
}
}
}
object = gtk_builder_get_object (builder, "expand");
xfconf_g_property_bind (plugin->channel, "/expand", G_TYPE_BOOLEAN, object, "active");
object = gtk_builder_get_object (builder, "style");
xfconf_g_property_bind (plugin->channel, "/style", G_TYPE_UINT, object, "active");
/* TODO remove when implemented by glade */
GtkCellRenderer *cell1 = gtk_cell_renderer_text_new ();
object = gtk_builder_get_object (builder, "style");
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), cell1, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell1, "text", 0, NULL);
G_MODULE_EXPORT void
xfce_panel_plugin_register_types (XfcePanelModule *panel_module)
{
/* register the separator type */
xfce_separator_register_type (panel_module);
gtk_widget_show (GTK_WIDGET (dialog));
}
else
{
/* release the builder */
g_object_unref (G_OBJECT (builder));
}
}
XFCE_PANEL_PLUGIN_REGISTER_OBJECT (XFCE_TYPE_SEPARATOR)
static void
separator_plugin_property_changed (XfconfChannel *channel,
const gchar *property_name,
const GValue *value,
SeparatorPlugin *plugin)
{
panel_return_if_fail (XFCONF_IS_CHANNEL (channel));
panel_return_if_fail (XFCE_IS_SEPARATOR_PLUGIN (plugin));
panel_return_if_fail (plugin->channel == channel);
/* update the changed property */
if (strcmp (property_name, "/style") == 0)
plugin->style = CLAMP (g_value_get_uint (value),
SEPARATOR_PLUGIN_MODE_MIN,
SEPARATOR_PLUGIN_MODE_MAX);
else if (strcmp (property_name, "/expand") == 0)
xfce_panel_plugin_set_expand (XFCE_PANEL_PLUGIN (plugin),
g_value_get_boolean (value));
/* redraw */
gtk_widget_queue_draw (GTK_WIDGET (plugin));
}

8
plugins/separator/separator.desktop.in.in

@ -1,9 +1,9 @@
[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
_Name=Separator or Spacing
_Comment=Adds a space or a line between panel items
Icon=x-office-calendar
_Name=Separator
_Comment=Adds a separator or space between panel items
Icon=gtk-remove
X-XFCE-Module=separator
X-XFCE-Module-Path=@libdir@/xfce4/panel-plugins
X-XFCE-External=TRUE
X-XFCE-External=FALSE

40
plugins/separator/separator.h

@ -0,0 +1,40 @@
/* $Id$ */
/*
* 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., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __SEPARATOR_H__
#define __SEPARATOR_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
typedef struct _SeparatorPluginClass SeparatorPluginClass;
typedef struct _SeparatorPlugin SeparatorPlugin;
typedef enum _SeparatorPluginMode SeparatorPluginStyle;
#define XFCE_TYPE_SEPARATOR_PLUGIN (separator_plugin_get_type ())
#define XFCE_SEPARATOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_SEPARATOR_PLUGIN, SeparatorPlugin))
#define XFCE_SEPARATOR_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_SEPARATOR_PLUGIN, SeparatorPluginClass))
#define XFCE_IS_SEPARATOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_SEPARATOR_PLUGIN))
#define XFCE_IS_SEPARATOR_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_SEPARATOR_PLUGIN))
#define XFCE_SEPARATOR_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_SEPARATOR_PLUGIN, SeparatorPluginClass))
GType separator_plugin_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* !__SEPARATOR_H__ */

4
plugins/tasklist/Makefile.am

@ -14,9 +14,9 @@ plugin_LTLIBRARIES = \
libtasklist.la
libtasklist_la_SOURCES = \
plugin.c \
tasklist.c \
tasklist.h \
tasklist-widget.c \
tasklist-widget.h \
tasklist-dialog_glade.h
libtasklist_la_CFLAGS = \

206
plugins/tasklist/plugin.c

@ -1,206 +0,0 @@
/* $Id$ */
/*
* This library 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 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 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 <xfconf/xfconf.h>
#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4panel/libxfce4panel.h>
#include "tasklist.h"
#include "tasklist-dialog_glade.h"
#define XFCE_TYPE_TASKLIST_PLUGIN (tasklist_plugin_get_type ())
#define XFCE_TASKLIST_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TASKLIST_PLUGIN, TasklistPlugin))
#define XFCE_TASKLIST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_TASKLIST_PLUGIN, TasklistPluginClass))
#define XFCE_IS_TASKLIST_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_TASKLIST_PLUGIN))
#define XFCE_IS_TASKLIST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_TASKLIST_PLUGIN))
#define XFCE_TASKLIST_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_TASKLIST_PLUGIN, TasklistPluginClass))
typedef struct _TasklistPluginClass TasklistPluginClass;
struct _TasklistPluginClass
{
XfcePanelPluginClass __parent__;
};
typedef struct _TasklistPlugin TasklistPlugin;
struct _TasklistPlugin
{
XfcePanelPlugin __parent__;
/* the xfconf channel */
XfconfChannel *channel;
/* the tasklist widget */
GtkWidget *tasklist;
};
static void tasklist_plugin_class_init (TasklistPluginClass *klass);
static void tasklist_plugin_init (TasklistPlugin *plugin);
static void tasklist_plugin_construct (XfcePanelPlugin *panel_plugin);
static void tasklist_plugin_free_data (XfcePanelPlugin *panel_plugin);
static void tasklist_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, GtkOrientation orientation);
static void tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
G_DEFINE_TYPE (TasklistPlugin, tasklist_plugin, XFCE_TYPE_PANEL_PLUGIN);
/* register the panel plugin */
XFCE_PANEL_PLUGIN_REGISTER_OBJECT (XFCE_TYPE_TASKLIST_PLUGIN);
static void
tasklist_plugin_class_init (TasklistPluginClass *klass)
{
XfcePanelPluginClass *plugin_class;
plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
plugin_class->construct = tasklist_plugin_construct;
plugin_class->free_data = tasklist_plugin_free_data;
plugin_class->orientation_changed = tasklist_plugin_orientation_changed;
plugin_class->configure_plugin = tasklist_plugin_configure_plugin;
}
static void
tasklist_plugin_init (TasklistPlugin *plugin)
{
/* initialize xfconf */
xfconf_init (NULL);
plugin->tasklist = g_object_new (XFCE_TYPE_TASKLIST, NULL);
gtk_container_add (GTK_CONTAINER (plugin), plugin->tasklist);
}
static void
tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
{
TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
/* expand the plugin */
xfce_panel_plugin_set_expand (XFCE_PANEL_PLUGIN (plugin), TRUE);
xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
/* open the xfconf channel */
plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
/* create bindings */
xfconf_g_property_bind (plugin->channel, "/style", G_TYPE_UINT,
plugin->tasklist, "style");
xfconf_g_property_bind (plugin->channel, "/include-all-workspaces", G_TYPE_BOOLEAN,
plugin->tasklist, "include-all-workspaces");
xfconf_g_property_bind (plugin->channel, "/flat-buttons", G_TYPE_BOOLEAN,
plugin->tasklist, "flat-buttons");
xfconf_g_property_bind (plugin->channel, "/switch-workspace-on-unminimize", G_TYPE_BOOLEAN,
plugin->tasklist, "switch-workspace-on-unminimize");
xfconf_g_property_bind (plugin->channel, "/show-only-minimized", G_TYPE_BOOLEAN,
plugin->tasklist, "show-only-minimized");
/* show the tasklist */
gtk_widget_show (plugin->tasklist);
}
static void
tasklist_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
/* release the xfconf channel */
if (G_LIKELY (plugin->channel))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}
static void
tasklist_plugin_orientation_changed (XfcePanelPlugin *panel_plugin,
GtkOrientation orientation)
{
TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
/* set the new tasklist orientation */
xfce_tasklist_set_orientation (XFCE_TASKLIST (plugin->tasklist), orientation);
}
static void
tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
{
TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
GtkBuilder *builder;
GObject *dialog;
GObject *object;
builder = gtk_builder_new ();
if (gtk_builder_add_from_string (builder, tasklist_dialog_glade, tasklist_dialog_glade_length, NULL))
{
dialog = gtk_builder_get_object (builder, "dialog");
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
object = gtk_builder_get_object (builder, "close-button");
g_signal_connect_swapped (G_OBJECT (object), "clicked", G_CALLBACK (gtk_widget_destroy), dialog);
object = gtk_builder_get_object (builder, "style");
exo_mutual_binding_new (G_OBJECT (plugin->tasklist), "style", object, "active");
object = gtk_builder_get_object (builder, "include-all-workspaces");
exo_mutual_binding_new (G_OBJECT (plugin->tasklist), "include-all-workspaces", object, "active");
object = gtk_builder_get_object (builder, "flat-buttons");
exo_mutual_binding_new (G_OBJECT (plugin->tasklist), "flat-buttons", object, "active");
object = gtk_builder_get_object (builder, "switch-workspace-on-unminimize");
exo_mutual_binding_new_with_negation (G_OBJECT (plugin->tasklist), "switch-workspace-on-unminimize", object, "active");
object = gtk_builder_get_object (builder, "show-only-minimized");
exo_mutual_binding_new (G_OBJECT (plugin->tasklist), "show-only-minimized", object, "active");
/* TODO remove when implemented by glade */
GtkCellRenderer *cell1 = gtk_cell_renderer_text_new ();
object = gtk_builder_get_object (builder, "style");
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), cell1, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell1, "text", 0, NULL);
gtk_widget_show (GTK_WIDGET (dialog));
}
else
{
/* release the builder */
g_object_unref (G_OBJECT (builder));
}
}

1268
plugins/tasklist/tasklist-widget.c

File diff suppressed because it is too large

0
plugins/tasklist/tasklist.h → plugins/tasklist/tasklist-widget.h

1268
plugins/tasklist/tasklist.c

File diff suppressed because it is too large
Loading…
Cancel
Save