Browse Source

Major rewrite several internals. Unify panel items and modules in PanelControl structure (and change the xml file format in the process), make all dialogs instant-apply, rearrange preferences dialog, add option to keep panel on top, probably more

(Old svn revision: 3302)
upstream/xfce4-panel-4.10.1
Jasper Huijsmans 20 years ago
parent
commit
0b63ca0c3a
  1. 3
      AUTHORS
  2. 13
      ChangeLog
  3. 6
      Makefile.in
  4. 24
      README
  5. 133
      README.xml
  6. 37
      TODO
  7. 62
      example.xfce4rc.in
  8. 3
      icons/Makefile.am
  9. 3
      icons/Makefile.in
  10. 8
      panel/Makefile.am
  11. 109
      panel/Makefile.in
  12. 626
      panel/builtins.c
  13. 11
      panel/builtins.h
  14. 131
      panel/callbacks.c
  15. 28
      panel/callbacks.h
  16. 565
      panel/central.c
  17. 38
      panel/central.h
  18. 426
      panel/controls.c
  19. 94
      panel/controls.h
  20. 330
      panel/controls_dialog.c
  21. 27
      panel/controls_dialog.h
  22. 393
      panel/dialogs.c
  23. 4
      panel/dialogs.h
  24. 105
      panel/global.h
  25. 117
      panel/iconbutton.c
  26. 37
      panel/iconbutton.h
  27. 37
      panel/icons.c
  28. 2
      panel/icons.h
  29. 89
      panel/info.c
  30. 232
      panel/item.c
  31. 35
      panel/item.h
  32. 1084
      panel/item_dialog.c
  33. 8
      panel/item_dialog.h
  34. 312
      panel/module.c
  35. 94
      panel/module.h
  36. 31
      panel/move.c
  37. 667
      panel/popup.c
  38. 34
      panel/popup.h
  39. 132
      panel/settings.c
  40. 4
      panel/settings.h
  41. 844
      panel/side.c
  42. 59
      panel/side.h
  43. 83
      panel/wmhints.c
  44. 4
      panel/wmhints.h
  45. 678
      panel/xfce.c
  46. 32
      panel/xfce.h
  47. 114
      panel/xfce_support.c
  48. 16
      panel/xfce_support.h
  49. 532
      plugins/mailcheck/mailcheck.c

3
AUTHORS

@ -0,0 +1,3 @@
Jasper Huijsmans <huysmans@users.sourceforge.net>
Olivier Fourdan <fourdan@xfce.org>
Xavier Maillard

13
ChangeLog

@ -1,3 +1,16 @@
2002-08-11 23:04 huysmans
* panel/info.c: fix deprecated gtk function
2002-08-11 22:55 huysmans
* panel/xfce.c: temporarily comment out the DOCK_TYPE window hint
2002-08-11 21:38 huysmans
* ChangeLog, panel/info.c: Update ChangeLog and update info panel a
bit
2002-08-11 08:29 huysmans
* ChangeLog, icons/xfce_slogan.xpm, panel/info.c: Really add info

6
Makefile.in

@ -114,9 +114,9 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS aclocal.m4 compile config.guess config.h.in \
config.sub configure configure.ac depcomp install-sh ltmain.sh \
missing mkinstalldirs xfce4.spec.in
Makefile.in NEWS TODO aclocal.m4 compile config.guess \
config.h.in config.sub configure configure.ac depcomp \
install-sh ltmain.sh missing mkinstalldirs xfce4.spec.in
DIST_SUBDIRS = $(SUBDIRS)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive

24
README

@ -35,24 +35,28 @@ The panel design is a hierarchy of components:
- Side panels (file side.c): Left and right panel containing several panel groups.
A panel group consists of a top widget and a bottom widget. The top widget is
usually a popup button, but for the outermost groups it is a move handle. The
bottom widget is either a panel item (a button with an icon) or a panel module
(dynamically updated).
bottom widget is called panel control and can be either a panel item (a button
with an icon) or a panel module (dynamically updated).
- Panel popup (file popup.c): Popup button and popup menu containing menu items.
Other files:
- popup.c: function for the popup menu inlcuding menu items.
- Panel item (file item.c): Tradioanl panel item consisting of an icon button,
which starts an application.
- control.c: panel control interface
- Panel module (files module.c and builtins.c): New panel control, which is
dynamically updated. Modules can be builtin or external using the gmodule
interface.
- item.c: traditional panel control (icon button that launches programs)
- iconbutton.c: icon button used by panel items. Separate for easy use by other
modules.
- builtin.c: builtin dynamic panel controls (e.g. clock and trash can).
Other files:
- callbacks.c: most callback functions are defined here.
- dialogs.c: panel configuration dialogs.
- item_dialog.c: configuration dialog for item/module and menuitem
- controls_dialog.c: configuration of panel controls
- item_dialog.c: configuration dialog for panel item or menu item
- xfce_support.c: convenience dialogs and general convenience functions.

133
README.xml

@ -1,133 +0,0 @@
Proposal for xml config file for xfce
-------------------------------------
See example.xfce4rc for an example
namespace: xfce:"http://www.xfce.org/xfce" (not implemented)
==============================================================================
root: Xfce
children:
Panel
Central
Left
Right
==============================================================================
name: Panel
parent: Xfce
properties: size (int), popupsize (int), style (int), icontheme (string),
left (int), right (int), screens (int)
children:
Position
Lock
Exit
name: Central
parent: Xfce
properties: none
content: none
children:
Screens
Lock
Power
name: Left
parent: Xfce
properties: visible
content: none
children:
Group
name Right
parent: Xfce
properties: visible
content: none
children:
Group
==============================================================================
name: Position
parent: Panel
properties: x (int), y (int)
content: none
children: none
name: Lock
parent: Panel
properties: none
content: lock command
children: none
name: Exit
parent: Panel
properties: none
content: command run at exit
children: none
------------------------------------------------------------------------------
name: Screen
parent: Central
properties: none
content: screen name
children: none
------------------------------------------------------------------------------
name: Group
parent: Left, Right
properties: none
content: none
children:
Popup
Item
Module
==============================================================================
name: Popup
parent: Group
properties: none
content: none
children:
Item
name: Module
parent: Group
properties: id (int)
content: module name
children: none
------------------------------------------------------------------------------
name: Item
parent: Group, Popup
properties: none
content: none
children:
Caption
Command
Tooltip
Icon
==============================================================================
name: Caption
parent: Item
properties: none
content: label for item
children: none
name: Command
parent: Item
properties: none
content: command to execute
children: none
name: Tooltip
parent: Item
properties: none
content: tooltip for item
children: none
name: Icon
parent: Item
properties: id (int)
content: path to icon
children: none

37
TODO

@ -0,0 +1,37 @@
TODO list for xfce4
===================
Major features for 4.0
----------------------
* port clock widget In progress (zeDek)
* unify panel controls Done
(make everything a module)
* improve module configuration
- add chosen module to panel Done
- direct-apply options Done
- save config in main file Done
(pass xmlNodePtr to module)
* improve global configuration
- add stay-on-top option Done
- split up dialog In progress
- port to new xfce-wide system
* write API docs for plugin writers
* write user docs
* provide good default configuration
* allow different positions for
popup button in all sizes Done
Nice to have for 4.0
--------------------
* more themes: Night, KDE, Next, WindowsXP, BeOS, ...
(not too many released with xfce4; < 10)
* volume control plugin
Possible future features (after 4.0)
------------------------------------
* optional pager instead of desktop buttons
* swallow apps
* hide popup buttons
* 'Eugenia'-like design with vertical move
handles and variable size plugins

62
example.xfce4rc.in

@ -1,27 +1,13 @@
<?xml version="1.0"?>
<Xfce>
<Panel size="1" popupsize="1" style="1" left="5" right="5" screens="4">
<Position x="269" y="955"/>
<Panel>
<Position x="-1" y="-1"/>
<Lock>xflock</Lock>
<Exit>Apps/ROX-Session/AppRun</Exit>
</Panel>
<Central>
<Screen>One</Screen>
<Screen>Two</Screen>
<Screen>Three</Screen>
<Screen>Four</Screen>
<Screen>Five</Screen>
<Screen>Six</Screen>
<Screen>Seven</Screen>
<Screen>Eight</Screen>
<Screen>Nine</Screen>
<Screen>Ten</Screen>
<Screen>Eleven</Screen>
<Screen>Twelve</Screen>
</Central>
<Central/>
<Left>
<Group>
<Module id="0"/>
<Control id="0"/>
</Group>
<Group>
<Popup>
@ -62,11 +48,11 @@
<Icon id="-1">_pkgdatadir_/icons/DiskFloppy.xpm</Icon>
</Item>
</Popup>
<Item>
<Control id="-2">
<Command term="0">xftree</Command>
<Tooltip>Bestandsbeheer</Tooltip>
<Icon id="2"/>
</Item>
</Control>
</Group>
<Group>
<Popup>
@ -77,11 +63,11 @@
<Icon id="1"/>
</Item>
</Popup>
<Item>
<Control id="-2">
<Command term="0">gvim</Command>
<Tooltip>Editor</Tooltip>
<Icon id="1"/>
</Item>
</Control>
</Group>
<Group>
<Popup>
@ -92,7 +78,7 @@
<Icon id="-1">_pkgdatadir_/pixmaps/Bookshelf.xpm</Icon>
</Item>
</Popup>
<Module id="-1">libmailcheck.so</Module>
<Control id="-1">libmailcheck.so</Control>
</Group>
<Group>
<Popup>
@ -103,24 +89,24 @@
<Icon id="-1">_pkgdatadir_/pixmaps/gnome-globe.png</Icon>
</Item>
</Popup>
<Item>
<Control id="-2">
<Command term="0">galeon -w</Command>
<Tooltip>Galeon internet browser</Tooltip>
<Icon id="7"/>
</Item>
</Control>
</Group>
<Group>
<Popup/>
<Item>
<Control id="-2">
<Command term="0"/>
<Tooltip>Click Mouse 3 to change item</Tooltip>
<Icon id="0"/>
</Item>
</Control>
</Group>
</Left>
<Right>
<Group>
<Module id="1"/>
<Control id="1"/>
</Group>
<Group>
<Popup>
@ -136,11 +122,11 @@
<Icon id="-1">_pkgdatadir_/icons/Pencils.xpm</Icon>
</Item>
</Popup>
<Item>
<Control id="-2">
<Command term="0">xfhelp</Command>
<Tooltip>Xfce Handleiding</Tooltip>
<Icon id="5"/>
</Item>
</Control>
</Group>
<Group>
<Popup>
@ -157,35 +143,35 @@
<Icon id="-1">_pkgdatadir_/icons/Mouse.xpm</Icon>
</Item>
</Popup>
<Item>
<Control id="-2">
<Command term="0">xfstyle</Command>
<Tooltip>XFce Style Manager</Tooltip>
<Icon id="3"/>
</Item>
</Control>
</Group>
<Group>
<Popup/>
<Item>
<Control id="-2">
<Command term="0">anjuta</Command>
<Tooltip>Anjuta C/C++ IDE</Tooltip>
<Icon id="-1">/usr/share/pixmaps/anjuta/applogo.png</Icon>
</Item>
</Control>
</Group>
<Group>
<Popup/>
<Item>
<Control id="-2">
<Command term="0">xfprint</Command>
<Tooltip>Drag file to print</Tooltip>
<Icon id="9"/>
</Item>
</Control>
</Group>
<Group>
<Popup/>
<Item>
<Control id="-2">
<Command term="0"/>
<Tooltip>Click Mouse 3 to change item</Tooltip>
<Icon id="0"/>
</Item>
</Control>
</Group>
</Right>
</Xfce>

3
icons/Makefile.am

@ -29,6 +29,7 @@ trash_empty.xpm \
trash_full.xpm \
unknown.xpm \
up.xpm \
xfce_icon.xpm
xfce_icon.xpm \
xfce_slogan.xpm
EXTRA_DIST = $(noinst_DATA)

3
icons/Makefile.in

@ -121,7 +121,8 @@ trash_empty.xpm \
trash_full.xpm \
unknown.xpm \
up.xpm \
xfce_icon.xpm
xfce_icon.xpm \
xfce_slogan.xpm
EXTRA_DIST = $(noinst_DATA)

8
panel/Makefile.am

@ -3,12 +3,14 @@ xfce4_SOURCES = \
builtins.c \
callbacks.c \
central.c \
controls.c \
controls_dialog.c \
dialogs.c \
iconbutton.c \
icons.c \
info.c \
item.c \
item_dialog.c \
module.c \
move.c \
popup.c \
settings.c \
@ -17,6 +19,7 @@ wmhints.c \
builtins.h \
callbacks.h \
central.h \
controls_dialog.h \
dialogs.h \
item_dialog.h \
move.h \
@ -28,9 +31,10 @@ xfce.c \
xfce_support.c
pkginclude_HEADERS = \
iconbutton.h \
icons.h \
item.h \
module.h \
controls.h \
xfce.h \
xfce_support.h \
global.h

109
panel/Makefile.in

@ -95,12 +95,14 @@ xfce4_SOURCES = \
builtins.c \
callbacks.c \
central.c \
controls.c \
controls_dialog.c \
dialogs.c \
iconbutton.c \
icons.c \
info.c \
item.c \
item_dialog.c \
module.c \
move.c \
popup.c \
settings.c \
@ -109,6 +111,7 @@ wmhints.c \
builtins.h \
callbacks.h \
central.h \
controls_dialog.h \
dialogs.h \
item_dialog.h \
move.h \
@ -121,15 +124,16 @@ xfce_support.c
pkginclude_HEADERS = \
iconbutton.h \
icons.h \
item.h \
module.h \
controls.h \
xfce.h \
xfce_support.h \
global.h
xfce4_CFLAGS = @CFLAGS@ @X_CFLAGS@ @BASE_DEPENDENCIES_CFLAGS@ -DG_DISABLE_DEPRECATED -DDATADIR=\"$(pkgdatadir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -DVERSION=\"@VERSION@\"
xfce4_CFLAGS = @CFLAGS@ @X_CFLAGS@ @BASE_DEPENDENCIES_CFLAGS@ -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDATADIR=\"$(pkgdatadir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -DVERSION=\"@VERSION@\"
xfce4_LDADD = @LIBS@ @X_LIBS@ @BASE_DEPENDENCIES_LIBS@
subdir = panel
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@ -139,13 +143,14 @@ bin_PROGRAMS = xfce4$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_xfce4_OBJECTS = xfce4-builtins.$(OBJEXT) xfce4-callbacks.$(OBJEXT) \
xfce4-central.$(OBJEXT) xfce4-dialogs.$(OBJEXT) \
xfce4-icons.$(OBJEXT) xfce4-info.$(OBJEXT) xfce4-item.$(OBJEXT) \
xfce4-item_dialog.$(OBJEXT) xfce4-module.$(OBJEXT) \
xfce4-move.$(OBJEXT) xfce4-popup.$(OBJEXT) \
xfce4-settings.$(OBJEXT) xfce4-side.$(OBJEXT) \
xfce4-wmhints.$(OBJEXT) xfce4-xfce.$(OBJEXT) \
xfce4-xfce_support.$(OBJEXT)
xfce4-central.$(OBJEXT) xfce4-controls.$(OBJEXT) \
xfce4-controls_dialog.$(OBJEXT) xfce4-dialogs.$(OBJEXT) \
xfce4-iconbutton.$(OBJEXT) xfce4-icons.$(OBJEXT) \
xfce4-info.$(OBJEXT) xfce4-item.$(OBJEXT) \
xfce4-item_dialog.$(OBJEXT) xfce4-move.$(OBJEXT) \
xfce4-popup.$(OBJEXT) xfce4-settings.$(OBJEXT) \
xfce4-side.$(OBJEXT) xfce4-wmhints.$(OBJEXT) \
xfce4-xfce.$(OBJEXT) xfce4-xfce_support.$(OBJEXT)
xfce4_OBJECTS = $(am_xfce4_OBJECTS)
xfce4_DEPENDENCIES =
xfce4_LDFLAGS =
@ -160,11 +165,13 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/xfce4-builtins.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-callbacks.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-central.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-controls.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-controls_dialog.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-dialogs.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-iconbutton.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-icons.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-info.Po ./$(DEPDIR)/xfce4-item.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-item_dialog.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-module.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-move.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-popup.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4-settings.Po \
@ -227,12 +234,14 @@ clean-binPROGRAMS:
xfce4-builtins.$(OBJEXT): builtins.c
xfce4-callbacks.$(OBJEXT): callbacks.c
xfce4-central.$(OBJEXT): central.c
xfce4-controls.$(OBJEXT): controls.c
xfce4-controls_dialog.$(OBJEXT): controls_dialog.c
xfce4-dialogs.$(OBJEXT): dialogs.c
xfce4-iconbutton.$(OBJEXT): iconbutton.c
xfce4-icons.$(OBJEXT): icons.c
xfce4-info.$(OBJEXT): info.c
xfce4-item.$(OBJEXT): item.c
xfce4-item_dialog.$(OBJEXT): item_dialog.c
xfce4-module.$(OBJEXT): module.c
xfce4-move.$(OBJEXT): move.c
xfce4-popup.$(OBJEXT): popup.c
xfce4-settings.$(OBJEXT): settings.c
@ -253,12 +262,14 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-builtins.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-callbacks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-central.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-controls.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-controls_dialog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-dialogs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-iconbutton.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-icons.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-item.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-item_dialog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-module.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-move.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-popup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4-settings.Po@am__quote@
@ -342,6 +353,42 @@ xfce4-central.lo: central.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-central.lo `test -f 'central.c' || echo '$(srcdir)/'`central.c
xfce4-controls.o: controls.c
@AMDEP_TRUE@ source='controls.c' object='xfce4-controls.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-controls.Po' tmpdepfile='$(DEPDIR)/xfce4-controls.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-controls.o `test -f 'controls.c' || echo '$(srcdir)/'`controls.c
xfce4-controls.obj: controls.c
@AMDEP_TRUE@ source='controls.c' object='xfce4-controls.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-controls.Po' tmpdepfile='$(DEPDIR)/xfce4-controls.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-controls.obj `cygpath -w controls.c`
xfce4-controls.lo: controls.c
@AMDEP_TRUE@ source='controls.c' object='xfce4-controls.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-controls.Plo' tmpdepfile='$(DEPDIR)/xfce4-controls.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-controls.lo `test -f 'controls.c' || echo '$(srcdir)/'`controls.c
xfce4-controls_dialog.o: controls_dialog.c
@AMDEP_TRUE@ source='controls_dialog.c' object='xfce4-controls_dialog.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-controls_dialog.Po' tmpdepfile='$(DEPDIR)/xfce4-controls_dialog.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-controls_dialog.o `test -f 'controls_dialog.c' || echo '$(srcdir)/'`controls_dialog.c
xfce4-controls_dialog.obj: controls_dialog.c
@AMDEP_TRUE@ source='controls_dialog.c' object='xfce4-controls_dialog.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-controls_dialog.Po' tmpdepfile='$(DEPDIR)/xfce4-controls_dialog.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-controls_dialog.obj `cygpath -w controls_dialog.c`
xfce4-controls_dialog.lo: controls_dialog.c
@AMDEP_TRUE@ source='controls_dialog.c' object='xfce4-controls_dialog.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-controls_dialog.Plo' tmpdepfile='$(DEPDIR)/xfce4-controls_dialog.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-controls_dialog.lo `test -f 'controls_dialog.c' || echo '$(srcdir)/'`controls_dialog.c
xfce4-dialogs.o: dialogs.c
@AMDEP_TRUE@ source='dialogs.c' object='xfce4-dialogs.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-dialogs.Po' tmpdepfile='$(DEPDIR)/xfce4-dialogs.TPo' @AMDEPBACKSLASH@
@ -360,6 +407,24 @@ xfce4-dialogs.lo: dialogs.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-dialogs.lo `test -f 'dialogs.c' || echo '$(srcdir)/'`dialogs.c
xfce4-iconbutton.o: iconbutton.c
@AMDEP_TRUE@ source='iconbutton.c' object='xfce4-iconbutton.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-iconbutton.Po' tmpdepfile='$(DEPDIR)/xfce4-iconbutton.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-iconbutton.o `test -f 'iconbutton.c' || echo '$(srcdir)/'`iconbutton.c
xfce4-iconbutton.obj: iconbutton.c
@AMDEP_TRUE@ source='iconbutton.c' object='xfce4-iconbutton.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-iconbutton.Po' tmpdepfile='$(DEPDIR)/xfce4-iconbutton.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-iconbutton.obj `cygpath -w iconbutton.c`
xfce4-iconbutton.lo: iconbutton.c
@AMDEP_TRUE@ source='iconbutton.c' object='xfce4-iconbutton.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-iconbutton.Plo' tmpdepfile='$(DEPDIR)/xfce4-iconbutton.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-iconbutton.lo `test -f 'iconbutton.c' || echo '$(srcdir)/'`iconbutton.c
xfce4-icons.o: icons.c
@AMDEP_TRUE@ source='icons.c' object='xfce4-icons.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-icons.Po' tmpdepfile='$(DEPDIR)/xfce4-icons.TPo' @AMDEPBACKSLASH@
@ -432,24 +497,6 @@ xfce4-item_dialog.lo: item_dialog.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-item_dialog.lo `test -f 'item_dialog.c' || echo '$(srcdir)/'`item_dialog.c
xfce4-module.o: module.c
@AMDEP_TRUE@ source='module.c' object='xfce4-module.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-module.Po' tmpdepfile='$(DEPDIR)/xfce4-module.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c
xfce4-module.obj: module.c
@AMDEP_TRUE@ source='module.c' object='xfce4-module.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-module.Po' tmpdepfile='$(DEPDIR)/xfce4-module.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-module.obj `cygpath -w module.c`
xfce4-module.lo: module.c
@AMDEP_TRUE@ source='module.c' object='xfce4-module.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-module.Plo' tmpdepfile='$(DEPDIR)/xfce4-module.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_CFLAGS) $(CFLAGS) -c -o xfce4-module.lo `test -f 'module.c' || echo '$(srcdir)/'`module.c
xfce4-move.o: move.c
@AMDEP_TRUE@ source='move.c' object='xfce4-move.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/xfce4-move.Po' tmpdepfile='$(DEPDIR)/xfce4-move.TPo' @AMDEPBACKSLASH@

626
panel/builtins.c

@ -1,6 +1,6 @@
/* builtins.c
*
* Copyright (C) 2002 Jasper Huijsmans (j.b.huijsmans@hetnet.nl)
* Copyright (C) 2002 Jasper Huijsmans (huysmans@users.sourceforge.net)
*
* 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
@ -24,59 +24,28 @@
#include <time.h>
#include "builtins.h"
#include "xfce.h"
#include "controls.h"
#include "iconbutton.h"
#include "xfce_support.h"
#include "module.h"
#include "item.h"
#include "icons.h"
#include "dialogs.h"
#include "iconbutton.h"
#include "callbacks.h"
#include "xfce.h"
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Builtin modules
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static gboolean create_clock_module(PanelModule * pm);
static gboolean create_trash_module(PanelModule * pm);
static gboolean create_exit_module(PanelModule * pm);
static gboolean create_config_module(PanelModule * pm);
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* panel control configuration
*/
GtkWidget *revert_button;
gboolean create_builtin_module(PanelModule * pm)
{
switch (pm->id)
{
case CLOCK_MODULE:
return create_clock_module(pm);
break;
case TRASH_MODULE:
return create_trash_module(pm);
break;
case EXIT_MODULE:
return create_exit_module(pm);
break;
case CONFIG_MODULE:
return create_config_module(pm);
break;
default:
return FALSE;
}
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Clock module
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* Clock module
* ------------
* To be replaced by the 'real clock widget'
*/
enum
{ ANALOG, DIGITAL, LED };
typedef struct
{
int size;
int type;
gboolean twentyfour;
@ -92,7 +61,6 @@ static t_clock *clock_new(void)
{
t_clock *clock = g_new(t_clock, 1);
clock->size = MEDIUM;
clock->show_colon = TRUE;
clock->type = DIGITAL;
clock->twentyfour = TRUE;
@ -101,8 +69,6 @@ static t_clock *clock_new(void)
gtk_container_set_border_width(GTK_CONTAINER(clock->frame), 0);
gtk_frame_set_shadow_type(GTK_FRAME(clock->frame), GTK_SHADOW_IN);
gtk_widget_show(clock->frame);
/* protect against destruction when unpacking */
g_object_ref(clock->frame);
clock->eventbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(clock->frame), clock->eventbox);
@ -115,16 +81,14 @@ static t_clock *clock_new(void)
return clock;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static gboolean adjust_time(PanelModule * pm)
static gboolean adjust_time(PanelControl * pc)
{
time_t t;
struct tm *tm;
int hrs, mins;
char *text, *markup;
t_clock *clock = (t_clock *) pm->data;
t_clock *clock = (t_clock *) pc->data;
t = time(0);
tm = localtime(&t);
@ -132,25 +96,30 @@ static gboolean adjust_time(PanelModule * pm)
hrs = tm->tm_hour;
mins = tm->tm_min;
text = g_strdup_printf("%.2d%c%.2d", hrs, clock->show_colon ? ':' : ' ', mins);
text =
g_strdup_printf("%.2d%c%.2d", hrs, clock->show_colon ? ':' : ' ', mins);
switch (clock->size)
switch (settings.size)
{
case TINY:
markup = g_strconcat("<tt><span size=\"x-small\">",
text, "</span></tt>", NULL);
markup =
g_strconcat("<tt><span size=\"x-small\">", text, "</span></tt>",
NULL);
break;
case SMALL:
markup = g_strconcat("<tt><span size=\"small\">",
text, "</span></tt>", NULL);
markup =
g_strconcat("<tt><span size=\"small\">", text, "</span></tt>",
NULL);
break;
case LARGE:
markup = g_strconcat("<tt><span size=\"large\">",
text, "</span></tt>", NULL);
markup =
g_strconcat("<tt><span size=\"large\">", text, "</span></tt>",
NULL);
break;
default:
markup = g_strconcat("<tt><span size=\"medium\">",
text, "</span></tt>", NULL);
markup =
g_strconcat("<tt><span size=\"medium\">", text, "</span></tt>",
NULL);
break;
}
@ -164,48 +133,25 @@ static gboolean adjust_time(PanelModule * pm)
return TRUE;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
void clock_pack(PanelModule * pm, GtkBox * box)
void clock_free(PanelControl * pc)
{
t_clock *clock = (t_clock *) pm->data;
gtk_box_pack_start(box, clock->frame, TRUE, TRUE, 0);
}
void clock_unpack(PanelModule * pm, GtkContainer * container)
{
t_clock *clock = (t_clock *) pm->data;
gtk_container_remove(container, clock->frame);
}
void clock_free(PanelModule * pm)
{
t_clock *clock = (t_clock *) pm->data;
if(GTK_IS_WIDGET(clock->frame))
gtk_widget_destroy(clock->frame);
t_clock *clock = (t_clock *) pc->data;
g_free(clock);
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
void clock_set_size(PanelModule * pm, int size)
void clock_set_size(PanelControl * pc, int size)
{
int s = icon_size(size);
t_clock *clock = (t_clock *) pm->data;
clock->size = size;
int s = icon_size[size];
t_clock *clock = (t_clock *) pc->data;
gtk_widget_set_size_request(clock->label, -1, s);
adjust_time(pm);
adjust_time(pc);
}
void clock_set_style(PanelModule * pm, int style)
void clock_set_style(PanelControl * pc, int style)
{
t_clock *clock = (t_clock *) pm->data;
t_clock *clock = (t_clock *) pc->data;
if(style == OLD_STYLE)
{
@ -274,13 +220,34 @@ static GtkWidget *create_clock_24hrs_button(t_clock * clock)
return cb;
}
void clock_add_options(PanelModule * pm, GtkContainer * container)
static void clock_create_backup(t_clock *clock)
{
}
static void clock_clean_backup(void)
{
}
static void clock_revert(t_clock *clock)
{
}
static void clock_apply_configuration(PanelControl * pc)
{
}
void clock_add_options(PanelControl * pc, GtkContainer * container,
GtkWidget * revert, GtkWidget * done)
{
GtkWidget *vbox, *om, *hbox, *label, *checkbutton;
GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
t_clock *clock = (t_clock *) pm->data;
t_clock *clock = (t_clock *) pc->data;
clock_create_backup(clock);
revert_button = revert;
vbox = gtk_vbox_new(FALSE, 4);
gtk_widget_show(vbox);
@ -312,102 +279,113 @@ void clock_add_options(PanelModule * pm, GtkContainer * container)
gtk_widget_show(checkbutton);
gtk_box_pack_start(GTK_BOX(hbox), checkbutton, FALSE, FALSE, 0);
/* signals */
g_signal_connect_swapped(revert, "clicked",
G_CALLBACK(clock_revert), clock);
g_signal_connect_swapped(done, "clicked",
G_CALLBACK(clock_clean_backup), NULL);
g_signal_connect_swapped(done, "clicked",
G_CALLBACK(clock_apply_configuration), pc);
gtk_container_add(container, vbox);
}
static void clock_apply_configuration(PanelModule * pm)
{
}
void clock_configure(PanelModule * pm)
{
report_error(_("No configuration possible (yet)."));
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static gboolean create_clock_module(PanelModule * pm)
/* create clock panel control
*/
void create_clock(PanelControl * pc)
{
t_clock *clock = clock_new();
pm->caption = g_strdup(_("XFce clock"));
pm->data = (gpointer) clock;
pm->main = clock->eventbox;
pm->interval = 1000; /* 1 sec */
pm->update = (gpointer) adjust_time;
gtk_container_add(GTK_CONTAINER(pc->base), clock->frame);
pm->pack = (gpointer) clock_pack;
pm->unpack = (gpointer) clock_unpack;
pm->free = (gpointer) clock_free;
pc->caption = g_strdup(_("XFce clock"));
pc->data = (gpointer) clock;
pc->main = clock->eventbox;
pm->set_size = (gpointer) clock_set_size;
pm->set_style = (gpointer) clock_set_style;
pc->interval = 1000; /* 1 sec */
pc->update = (gpointer) adjust_time;
pm->add_options = (gpointer) clock_add_options;
pm->apply_configuration = (gpointer) clock_apply_configuration;
/* pm->configure = (gpointer) clock_configure;*/
pc->free = (gpointer) clock_free;
if(pm->parent)
adjust_time(pm);
pc->set_size = (gpointer) clock_set_size;
pc->set_style = (gpointer) clock_set_style;
return TRUE;
pc->add_options = (gpointer) clock_add_options;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Trash module
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* Trash module
* ------------
*/
typedef struct
{
char *dirname;
int size;
char *command;
gboolean in_terminal;
gboolean empty;
GdkPixbuf *empty_pb;
GdkPixbuf *full_pb;
/* we just overload the panel item a bit */
PanelItem *item;
IconButton *button;
}
t_trash;
static t_trash *trash_new(PanelGroup * pg)
static void trash_run(t_trash * trash)
{
exec_cmd(trash->command, trash->in_terminal);
}
void trash_dropped(GtkWidget *widget, GList *drop_data, gpointer data)
{
t_trash *trash = (t_trash *)data;
char *cmd;
GList *li;
for (li = drop_data; li && li->data; li = li->next)
{
cmd = g_strconcat(trash->command, " ", (char *)li->data, NULL);
exec_cmd_silent(cmd, FALSE);
g_free(cmd);
}
}
static t_trash *trash_new(void)
{
t_trash *trash = g_new(t_trash, 1);
const char *home = g_getenv("HOME");
GtkWidget *b;
trash->dirname = g_strconcat(home, "/.xfce/trash", NULL);
trash->size = MEDIUM;
trash->empty = TRUE;
trash->item = panel_item_new(pg);
trash->item->command = g_strdup("xftrash");
trash->command = g_strdup("xftrash");
trash->in_terminal = FALSE;
trash->empty_pb = get_module_pixbuf(TRASH_EMPTY_ICON);
trash->full_pb = get_module_pixbuf(TRASH_FULL_ICON);
create_panel_item(trash->item);
g_object_unref(trash->item->pb);
trash->item->pb = trash->empty_pb;
trash->button = icon_button_new(trash->empty_pb);
panel_item_set_size(trash->item, MEDIUM);
b = icon_button_get_button(trash->button);
add_tooltip(b, _("Trashcan: 0 files"));
add_tooltip(trash->item->button, _("Trashcan: 0 files"));
/* signals */
dnd_set_drag_dest(b);
dnd_set_callback(b, DROP_CALLBACK(trash_dropped), trash);
g_signal_connect_swapped(b, "clicked", G_CALLBACK(trash_run), trash);
return trash;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static gboolean check_trash(PanelModule * pm)
static gboolean check_trash(PanelControl * pc)
{
t_trash *trash = (t_trash *) pm->data;
PanelItem *pi = trash->item;
t_trash *trash = (t_trash *) pc->data;
GDir *dir;
const char *file;
@ -425,10 +403,11 @@ static gboolean check_trash(PanelModule * pm)
{
if(!trash->empty)
{
pi->pb = trash->empty_pb;
trash->empty = TRUE;
changed = TRUE;
add_tooltip(pi->button, _("Trashcan: 0 files"));
icon_button_set_pixbuf(trash->button, trash->empty_pb);
add_tooltip(icon_button_get_button(trash->button),
_("Trashcan: 0 files"));
}
}
else
@ -440,12 +419,11 @@ static gboolean check_trash(PanelModule * pm)
chdir(trash->dirname);
if(trash->empty)
{
pi->pb = trash->full_pb;
trash->empty = FALSE;
changed = TRUE;
icon_button_set_pixbuf(trash->button, trash->full_pb);
}
while(file)
@ -469,68 +447,39 @@ static gboolean check_trash(PanelModule * pm)
sprintf(text, _("Trashcan: %d files / %d MB"), number,
size / (1024 * 1024));
add_tooltip(pi->button, text);
add_tooltip(icon_button_get_button(trash->button), text);
}
if(dir)
g_dir_close(dir);
if(changed)
{
panel_item_set_size(trash->item, settings.size);
}
return TRUE;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static void trash_pack(PanelModule * pm, GtkBox * box)
{
t_trash *trash = (t_trash *) pm->data;
panel_item_pack(trash->item, box);
}
static void trash_unpack(PanelModule * pm, GtkContainer * container)
{
t_trash *trash = (t_trash *) pm->data;
panel_item_unpack(trash->item, container);
}
static void trash_free(PanelModule * pm)
static void trash_free(PanelControl * pc)
{
t_trash *trash = (t_trash *) pm->data;
t_trash *trash = (t_trash *) pc->data;
g_free(trash->dirname);
/* will be unreffed in panel_item_free() */
g_object_ref(trash->item->pb);
panel_item_free(trash->item);
icon_button_free(trash->button);
g_object_unref(trash->empty_pb);
g_object_unref(trash->full_pb);
if(GTK_IS_WIDGET(pm->main))
gtk_widget_destroy(pm->main);
g_free(trash);
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static void trash_set_size(PanelModule * pm, int size)
static void trash_set_size(PanelControl * pc, int size)
{
t_trash *trash = (t_trash *) pm->data;
t_trash *trash = (t_trash *) pc->data;
trash->size = size;
panel_item_set_size(trash->item, size);
icon_button_set_size(trash->button, size);
}
static void trash_set_icon_theme(PanelModule * pm, const char *theme)
static void trash_set_theme(PanelControl * pc, const char *theme)
{
t_trash *trash = (t_trash *) pm->data;
t_trash *trash = (t_trash *) pc->data;
g_object_unref(trash->empty_pb);
g_object_unref(trash->full_pb);
@ -539,42 +488,36 @@ static void trash_set_icon_theme(PanelModule * pm, const char *theme)
trash->full_pb = get_module_pixbuf(TRASH_FULL_ICON);
if(trash->empty)
trash->item->pb = trash->empty_pb;
icon_button_set_pixbuf(trash->button, trash->empty_pb);
else
trash->item->pb = trash->full_pb;
panel_item_set_size(trash->item, trash->size);
icon_button_set_pixbuf(trash->button, trash->full_pb);
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static gboolean create_trash_module(PanelModule * pm)
/* create trash panel control
*/
void create_trash(PanelControl * pc)
{
t_trash *trash = trash_new(pm->parent);
pm->caption = g_strdup(_("Trash can"));
pm->data = (gpointer) trash;
pm->main = trash->item->button;
t_trash *trash = trash_new();
GtkWidget *b = icon_button_get_button(trash->button);
pm->interval = 2000; /* 2 sec */
pm->update = (gpointer) check_trash;
gtk_container_add(GTK_CONTAINER(pc->base), b);
pm->pack = (gpointer) trash_pack;
pm->unpack = (gpointer) trash_unpack;
pm->free = (gpointer) trash_free;
pc->caption = g_strdup(_("Trash can"));
pc->data = (gpointer) trash;
pc->main = b;
pm->set_size = (gpointer) trash_set_size;
pm->set_icon_theme = (gpointer) trash_set_icon_theme;
pc->interval = 2000; /* 2 sec */
pc->update = (gpointer) check_trash;
if(pm->parent)
check_trash(pm);
pc->free = (gpointer) trash_free;
return TRUE;
pc->set_size = (gpointer) trash_set_size;
pc->set_theme = (gpointer) trash_set_theme;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Exit module
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* Exit module
* -----------
*/
typedef struct
{
GtkWidget *vbox;
@ -587,24 +530,18 @@ t_exit;
static t_exit *exit_new(void)
{
GtkWidget *im;
GdkPixbuf *pb = NULL;
t_exit *exit = g_new(t_exit, 1);
exit->vbox = gtk_vbox_new(TRUE, 0);
gtk_widget_show(exit->vbox);
/* protect against destruction when unpacking */
g_object_ref(exit->vbox);
exit->lock_button = gtk_button_new();
gtk_button_set_relief(GTK_BUTTON(exit->lock_button), GTK_RELIEF_NONE);
gtk_widget_show(exit->lock_button);
gtk_box_pack_start(GTK_BOX(exit->vbox), exit->lock_button, TRUE, TRUE, 0);
pb = get_system_pixbuf(MINILOCK_ICON);
im = gtk_image_new_from_pixbuf(pb);
im = gtk_image_new();
gtk_widget_show(im);
g_object_unref(pb);
gtk_container_add(GTK_CONTAINER(exit->lock_button), im);
exit->exit_button = gtk_button_new();
@ -612,68 +549,48 @@ static t_exit *exit_new(void)
gtk_widget_show(exit->exit_button);
gtk_box_pack_start(GTK_BOX(exit->vbox), exit->exit_button, TRUE, TRUE, 0);
pb = get_system_pixbuf(MINIPOWER_ICON);
im = gtk_image_new_from_pixbuf(pb);
im = gtk_image_new();
gtk_widget_show(im);
g_object_unref(pb);
gtk_container_add(GTK_CONTAINER(exit->exit_button), im);
add_tooltip(exit->lock_button, _("Lock the screen"));
add_tooltip(exit->exit_button, _("Exit"));
g_signal_connect_swapped(exit->lock_button, "clicked",
G_CALLBACK(mini_lock_cb), NULL);
g_signal_connect_swapped(exit->exit_button, "clicked",
G_CALLBACK(quit), NULL);
return exit;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static void exit_pack(PanelModule * pm, GtkBox * box)
{
t_exit *exit = (t_exit *) pm->data;
g_signal_connect_swapped(exit->lock_button, "clicked",
G_CALLBACK(mini_lock_cb), NULL);
gtk_box_pack_start(box, exit->vbox, TRUE, TRUE, 0);
}
g_signal_connect_swapped(exit->exit_button, "clicked", G_CALLBACK(quit),
NULL);
static void exit_unpack(PanelModule * pm, GtkContainer * container)
{
t_exit *exit = (t_exit *) pm->data;
gtk_container_remove(container, exit->vbox);
return exit;
}
static void exit_free(PanelModule * pm)
static void exit_free(PanelControl * pc)
{
t_exit *exit = (t_exit *) pm->data;
t_exit *exit = (t_exit *) pc->data;
if(GTK_IS_WIDGET(pm->main))
gtk_widget_destroy(pm->main);
if(GTK_IS_WIDGET(pc->main))
gtk_widget_destroy(pc->main);
g_free(exit);
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
static void exit_set_size(PanelModule * pm, int size)
static void exit_set_size(PanelControl * pc, int size)
{
t_exit *exit = (t_exit *) pm->data;
t_exit *exit = (t_exit *) pc->data;
GdkPixbuf *pb1, *pb2;
GtkWidget *im;
int width, height;
width = icon_size(size);
height = icon_size(size) / 2;
width = icon_size[size];
height = icon_size[size] / 2;
gtk_widget_set_size_request(exit->exit_button, width + 4, height + 2);
gtk_widget_set_size_request(exit->lock_button, width + 4, height + 2);
pb1 = get_system_pixbuf(MINIPOWER_ICON);
im = gtk_bin_get_child(GTK_BIN(exit->exit_button));
pb2 = get_scaled_pixbuf(pb1, height-4);
pb2 = get_scaled_pixbuf(pb1, height - 4);
gtk_image_set_from_pixbuf(GTK_IMAGE(im), pb2);
g_object_unref(pb1);
@ -681,23 +598,46 @@ static void exit_set_size(PanelModule * pm, int size)
pb1 = get_system_pixbuf(MINILOCK_ICON);
im = gtk_bin_get_child(GTK_BIN(exit->lock_button));
pb2 = get_scaled_pixbuf(pb1, height-4);
pb2 = get_scaled_pixbuf(pb1, height - 4);
gtk_image_set_from_pixbuf(GTK_IMAGE(im), pb2);
g_object_unref(pb1);
g_object_unref(pb2);
}
static void exit_set_icon_theme(PanelModule * pm, const char *theme)
static void exit_set_theme(PanelControl * pc, const char *theme)
{
exit_set_size(pm, settings.size);
exit_set_size(pc, settings.size);
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
GtkWidget *lock_entry;
GtkWidget *exit_entry;
void exit_add_options(PanelModule * pm, GtkContainer * container)