Removed the need for PanelAppletPosition with the new "spacer" plug-in

This commit is contained in:
Pierre Pronchery 2011-08-22 23:35:03 +00:00
parent 85a6e3b89c
commit 1628d25244
32 changed files with 131 additions and 85 deletions

View File

@ -88,6 +88,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/applets/pager.c \
$(PACKAGE)-$(VERSION)/src/applets/phone.c \
$(PACKAGE)-$(VERSION)/src/applets/separator.c \
$(PACKAGE)-$(VERSION)/src/applets/spacer.c \
$(PACKAGE)-$(VERSION)/src/applets/swap.c \
$(PACKAGE)-$(VERSION)/src/applets/systray.c \
$(PACKAGE)-$(VERSION)/src/applets/tasks.c \

View File

@ -46,12 +46,6 @@ typedef struct _PanelAppletHelper
int (*suspend)(Panel * panel);
} PanelAppletHelper;
typedef enum _PanelAppletPosition
{
PANEL_APPLET_POSITION_START = 0,
PANEL_APPLET_POSITION_END
} PanelAppletPosition;
struct _PanelApplet
{
PanelAppletHelper * helper;
@ -61,7 +55,6 @@ struct _PanelApplet
void (*destroy)(PanelApplet * applet);
GtkWidget * (*settings)(PanelApplet * applet, gboolean apply,
gboolean reset);
PanelAppletPosition position;
gboolean expand;
gboolean fill;
void * priv;

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Panel 0.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-06 01:55+0200\n"
"POT-Creation-Date: 2011-08-23 01:18+0200\n"
"PO-Revision-Date: 2010-04-22 12:45+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -17,33 +17,33 @@ msgstr ""
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: ../src/applets/battery.c:170
#: ../src/applets/battery.c:169
msgid "Unknown"
msgstr "Inconnu"
#: ../src/applets/battery.c:186 ../src/panel.c:426 ../src/panel.c:431
#: ../src/applets/battery.c:185 ../src/panel.c:426 ../src/panel.c:431
#: ../src/run.c:214 ../src/run.c:220
msgid "Error"
msgstr "Erreur"
#: ../src/applets/battery.c:192
#: ../src/applets/battery.c:191
#, c-format
msgid "Battery level: %.0lf%%%s"
msgstr "Batterie : %.0lf%%%s"
#: ../src/applets/battery.c:193
#: ../src/applets/battery.c:192
msgid " (charging)"
msgstr " (en charge)"
#: ../src/applets/bluetooth.c:100
#: ../src/applets/bluetooth.c:99
msgid "Bluetooth is enabled"
msgstr "Bluetooth actif"
#: ../src/applets/clock.c:86 ../src/applets/clock.c:97
#: ../src/applets/clock.c:85 ../src/applets/clock.c:96
msgid "%H:%M"
msgstr "%H:%M"
#: ../src/applets/clock.c:95
#: ../src/applets/clock.c:94
msgid ""
"%H:%M:%S\n"
"%d/%m/%Y"
@ -51,121 +51,121 @@ msgstr ""
"%H:%M:%S\n"
"%d/%m/%Y"
#: ../src/applets/close.c:96
#: ../src/applets/close.c:95
msgid "Close"
msgstr "Fermer"
#: ../src/applets/cpu.c:95
#: ../src/applets/cpu.c:94
msgid "CPU:"
msgstr ""
#: ../src/applets/cpu.c:111 ../src/applets/cpufreq.c:128
#: ../src/applets/memory.c:105 ../src/applets/swap.c:105
#: ../src/applets/cpu.c:110 ../src/applets/cpufreq.c:127
#: ../src/applets/memory.c:104 ../src/applets/swap.c:104
msgid "Unsupported platform"
msgstr "Plate-forme non supportée"
#: ../src/applets/cpufreq.c:120
#: ../src/applets/cpufreq.c:119
msgid "MHz"
msgstr "MHz"
#: ../src/applets/desktop.c:66
#: ../src/applets/desktop.c:65
msgid "Show desktop"
msgstr "Afficher le bureau"
#: ../src/applets/gps.c:92
#: ../src/applets/gps.c:91
msgid "GPS is enabled"
msgstr "GPS actif"
#: ../src/applets/gsm.c:99
#: ../src/applets/gsm.c:98
msgid "GSM is enabled"
msgstr "GSM actif"
#: ../src/applets/lock.c:77 ../src/applets/main.c:320
#: ../src/applets/lock.c:76 ../src/applets/main.c:319
msgid "Lock screen"
msgstr "Verrouiller l'écran"
#: ../src/applets/logout.c:61
#: ../src/applets/logout.c:60
msgid "Logging out is disabled"
msgstr "Se déconnecter est désactivé"
#: ../src/applets/logout.c:70 ../src/panel.c:856 ../src/panel.c:863
#: ../src/applets/logout.c:69 ../src/panel.c:856 ../src/panel.c:863
#: ../src/panel.c:872
msgid "Logout"
msgstr "Déconnexion"
#: ../src/applets/main.c:136
#: ../src/applets/main.c:135
msgid "Main menu"
msgstr "Menu principal"
#: ../src/applets/main.c:302
#: ../src/applets/main.c:301
msgid "Applications"
msgstr "Programmes"
#: ../src/applets/main.c:308
#: ../src/applets/main.c:307
msgid "Run..."
msgstr "Exécuter..."
#: ../src/applets/main.c:326
#: ../src/applets/main.c:325
msgid "Logout..."
msgstr "Déconnecter..."
#: ../src/applets/main.c:333
#: ../src/applets/main.c:332
msgid "Suspend"
msgstr "Suspendre"
#: ../src/applets/main.c:338
#: ../src/applets/main.c:337
msgid "Shutdown..."
msgstr "Arrêter..."
#: ../src/applets/memory.c:91
#: ../src/applets/memory.c:90
msgid "RAM:"
msgstr "Mémoire :"
#: ../src/applets/swap.c:91
#: ../src/applets/swap.c:90
msgid "Swap:"
msgstr "Échange :"
#: ../src/applets/tasks.c:459 ../src/applets/title.c:230
#: ../src/applets/tasks.c:458 ../src/applets/title.c:229
msgid "(Untitled)"
msgstr "(Sans titre)"
#: ../src/applets/tasks.c:732
#: ../src/applets/tasks.c:731
msgid "Move"
msgstr "Déplacer"
#: ../src/applets/tasks.c:734
#: ../src/applets/tasks.c:733
msgid "Resize"
msgstr "Redimensionner"
#: ../src/applets/tasks.c:736
#: ../src/applets/tasks.c:735
msgid "Minimize"
msgstr "Réduire"
#: ../src/applets/tasks.c:738
#: ../src/applets/tasks.c:737
msgid "Shade"
msgstr "Masquer"
#: ../src/applets/tasks.c:740
#: ../src/applets/tasks.c:739
msgid "Stick"
msgstr "Attacher"
#: ../src/applets/tasks.c:742
#: ../src/applets/tasks.c:741
msgid "Maximize horizontally"
msgstr "Maximiser horizontalement"
#: ../src/applets/tasks.c:744
#: ../src/applets/tasks.c:743
msgid "Maximize vertically"
msgstr "Maximiser verticalement"
#: ../src/applets/tasks.c:748
#: ../src/applets/tasks.c:747
msgid "Change desktop"
msgstr "Déplacer vers le bureau"
#: ../src/applets/tasks.c:785
#: ../src/applets/tasks.c:784
msgid "Maximize"
msgstr "Maximiser"
#: ../src/applets/usb.c:93
#: ../src/applets/usb.c:92
msgid "USB networking device connected"
msgstr "Périphérique réseau USB connecté"

View File

@ -1,4 +1,4 @@
TARGETS = battery.so bluetooth.so clock.so close.so cpu.so cpufreq.so desktop.so gps.so gsm.so keyboard.so lock.so logout.so main.so memory.so pager.so phone.so separator.so swap.so systray.so tasks.so title.so usb.so volume.so wpa_supplicant.so
TARGETS = battery.so bluetooth.so clock.so close.so cpu.so cpufreq.so desktop.so gps.so gsm.so keyboard.so lock.so logout.so main.so memory.so pager.so phone.so separator.so spacer.so swap.so systray.so tasks.so title.so usb.so volume.so wpa_supplicant.so
PREFIX = /usr/local
DESTDIR =
LIBDIR = $(PREFIX)/lib
@ -137,6 +137,13 @@ separator_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
separator.so: $(separator_OBJS)
$(LD) -o separator.so $(separator_OBJS) $(separator_LDFLAGS)
spacer_OBJS = spacer.o
spacer_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
spacer_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
spacer.so: $(spacer_OBJS)
$(LD) -o spacer.so $(spacer_OBJS) $(spacer_LDFLAGS)
swap_OBJS = swap.o
swap_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
swap_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
@ -237,6 +244,9 @@ phone.o: phone.c ../../include/Panel.h
separator.o: separator.c ../../include/Panel.h
$(CC) $(separator_CFLAGS) -c separator.c
spacer.o: spacer.c ../../include/Panel.h
$(CC) $(spacer_CFLAGS) -c spacer.c
swap.o: swap.c ../../include/Panel.h
$(CC) $(swap_CFLAGS) -c swap.c
@ -259,7 +269,7 @@ wpa_supplicant.o: wpa_supplicant.c ../../include/Panel.h
$(CC) $(wpa_supplicant_CFLAGS) -c wpa_supplicant.c
clean:
$(RM) -- $(battery_OBJS) $(bluetooth_OBJS) $(clock_OBJS) $(close_OBJS) $(cpu_OBJS) $(cpufreq_OBJS) $(desktop_OBJS) $(gps_OBJS) $(gsm_OBJS) $(keyboard_OBJS) $(lock_OBJS) $(logout_OBJS) $(main_OBJS) $(memory_OBJS) $(pager_OBJS) $(phone_OBJS) $(separator_OBJS) $(swap_OBJS) $(systray_OBJS) $(tasks_OBJS) $(title_OBJS) $(usb_OBJS) $(volume_OBJS) $(wpa_supplicant_OBJS)
$(RM) -- $(battery_OBJS) $(bluetooth_OBJS) $(clock_OBJS) $(close_OBJS) $(cpu_OBJS) $(cpufreq_OBJS) $(desktop_OBJS) $(gps_OBJS) $(gsm_OBJS) $(keyboard_OBJS) $(lock_OBJS) $(logout_OBJS) $(main_OBJS) $(memory_OBJS) $(pager_OBJS) $(phone_OBJS) $(separator_OBJS) $(spacer_OBJS) $(swap_OBJS) $(systray_OBJS) $(tasks_OBJS) $(title_OBJS) $(usb_OBJS) $(volume_OBJS) $(wpa_supplicant_OBJS)
distclean: clean
$(RM) -- $(TARGETS)
@ -300,6 +310,8 @@ install: $(TARGETS)
$(MKDIR) $(DESTDIR)$(LIBDIR)/Panel/applets
$(INSTALL) -m 0644 -- separator.so $(DESTDIR)$(LIBDIR)/Panel/applets/separator.so
$(MKDIR) $(DESTDIR)$(LIBDIR)/Panel/applets
$(INSTALL) -m 0644 -- spacer.so $(DESTDIR)$(LIBDIR)/Panel/applets/spacer.so
$(MKDIR) $(DESTDIR)$(LIBDIR)/Panel/applets
$(INSTALL) -m 0644 -- swap.so $(DESTDIR)$(LIBDIR)/Panel/applets/swap.so
$(MKDIR) $(DESTDIR)$(LIBDIR)/Panel/applets
$(INSTALL) -m 0644 -- systray.so $(DESTDIR)$(LIBDIR)/Panel/applets/systray.so
@ -332,6 +344,7 @@ uninstall:
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/pager.so
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/phone.so
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/separator.so
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/spacer.so
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/swap.so
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/systray.so
$(RM) -- $(DESTDIR)$(LIBDIR)/Panel/applets/tasks.so

View File

@ -94,7 +94,6 @@ PanelApplet applet =
_battery_init,
_battery_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -71,7 +71,6 @@ PanelApplet applet =
_bluetooth_init,
_bluetooth_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -57,7 +57,6 @@ PanelApplet applet =
_clock_init,
_clock_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -71,7 +71,6 @@ PanelApplet applet =
_close_init,
_close_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -64,7 +64,6 @@ PanelApplet applet =
_cpu_init,
_cpu_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -66,7 +66,6 @@ PanelApplet applet =
_cpufreq_init,
_cpufreq_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -42,7 +42,6 @@ PanelApplet applet =
_desktop_init,
NULL,
NULL,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -63,7 +63,6 @@ PanelApplet applet =
_gps_init,
_gps_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -68,7 +68,6 @@ PanelApplet applet =
_gsm_init,
_gsm_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -71,7 +71,6 @@ PanelApplet applet =
_keyboard_init,
_keyboard_destroy,
_keyboard_settings,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -52,7 +52,6 @@ PanelApplet applet =
_lock_init,
_lock_destroy,
_lock_settings,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -40,7 +40,6 @@ PanelApplet applet =
_logout_init,
NULL,
NULL,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -104,7 +104,6 @@ PanelApplet applet =
_main_init,
_main_destroy,
NULL,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -60,7 +60,6 @@ PanelApplet applet =
_memory_init,
_memory_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -91,7 +91,6 @@ PanelApplet applet =
_pager_init,
_pager_destroy,
NULL,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -53,7 +53,6 @@ PanelApplet applet =
_phone_init,
NULL,
NULL,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -1,4 +1,4 @@
targets=battery,bluetooth,clock,close,cpu,cpufreq,desktop,gps,gsm,keyboard,lock,logout,main,memory,pager,phone,separator,swap,systray,tasks,title,usb,volume,wpa_supplicant
targets=battery,bluetooth,clock,close,cpu,cpufreq,desktop,gps,gsm,keyboard,lock,logout,main,memory,pager,phone,separator,spacer,swap,systray,tasks,title,usb,volume,wpa_supplicant
cppflags_force=-I ../../include
#cppflags=-D EMBEDDED
cflags_force=-W `pkg-config --cflags libSystem gtk+-2.0` -fPIC
@ -142,6 +142,14 @@ install=$(LIBDIR)/Panel/applets
[separator.c]
depends=../../include/Panel.h
[spacer]
type=plugin
sources=spacer.c
install=$(LIBDIR)/Panel/applets
[spacer.c]
depends=../../include/Panel.h
[swap]
type=plugin
sources=swap.c

64
src/applets/spacer.c Normal file
View File

@ -0,0 +1,64 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Panel */
/* 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, version 3 of the License.
*
* 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, see <http://www.gnu.org/licenses/>. */
#include "Panel.h"
/* spacer */
/* private */
/* prototypes */
/* plug-in */
static GtkWidget * _spacer_init(PanelApplet * applet);
static void _spacer_destroy(PanelApplet * applet);
/* public */
/* variables */
PanelApplet applet =
{
NULL,
"Spacer",
NULL,
_spacer_init,
_spacer_destroy,
NULL,
TRUE,
TRUE,
NULL
};
/* private */
/* functions */
static GtkWidget * _spacer_init(PanelApplet * applet)
{
GtkWidget * widget;
widget = gtk_label_new(NULL);
applet->priv = widget;
gtk_widget_show(widget);
return widget;
}
/* spacer_destroy */
static void _spacer_destroy(PanelApplet * applet)
{
GtkWidget * widget = applet->priv;
gtk_widget_destroy(widget);
}

View File

@ -60,7 +60,6 @@ PanelApplet applet =
_swap_init,
_swap_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -66,7 +66,6 @@ PanelApplet applet =
_systray_init,
_systray_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -141,7 +141,6 @@ PanelApplet applet =
_tasks_init,
_tasks_destroy,
NULL,
PANEL_APPLET_POSITION_START,
#ifndef EMBEDDED
TRUE,
#else

View File

@ -75,7 +75,6 @@ PanelApplet applet =
_title_init,
_title_destroy,
NULL,
PANEL_APPLET_POSITION_START,
FALSE,
TRUE,
NULL

View File

@ -66,7 +66,6 @@ PanelApplet applet =
_usb_init,
_usb_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -51,7 +51,6 @@ PanelApplet applet =
_volume_init,
_volume_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -89,7 +89,6 @@ PanelApplet applet =
_wpa_init,
_wpa_destroy,
NULL,
PANEL_APPLET_POSITION_END,
FALSE,
TRUE,
NULL

View File

@ -487,7 +487,7 @@ int panel_load(Panel * panel, PanelPosition position, char const * applet)
plugin_delete(plugin);
return -1;
}
panel_window_append(window, widget, pa->expand, pa->fill, pa->position);
panel_window_append(window, widget, pa->expand, pa->fill);
if(pa->settings != NULL
&& (widget = pa->settings(pa, FALSE, FALSE)) != NULL)
{

View File

@ -150,17 +150,7 @@ int panel_window_get_height(PanelWindow * panel)
/* useful */
void panel_window_append(PanelWindow * panel, GtkWidget * widget,
gboolean expand, gboolean fill, PanelAppletPosition position)
gboolean expand, gboolean fill)
{
switch(position)
{
case PANEL_APPLET_POSITION_END:
gtk_box_pack_end(GTK_BOX(panel->hbox), widget, expand,
fill, 0);
break;
case PANEL_APPLET_POSITION_START:
gtk_box_pack_start(GTK_BOX(panel->hbox), widget, expand,
fill, 0);
break;
}
gtk_box_pack_start(GTK_BOX(panel->hbox), widget, expand, fill, 0);
}

View File

@ -36,6 +36,6 @@ int panel_window_get_height(PanelWindow * panel);
/* useful */
void panel_window_append(PanelWindow * panel, GtkWidget * widget,
gboolean expand, gboolean fill, PanelAppletPosition position);
gboolean expand, gboolean fill);
#endif /* !PANEL_WINDOW_H */