Added an about dialog

This commit is contained in:
Pierre Pronchery 2011-02-05 03:02:00 +00:00
parent 13770ff490
commit ecd4c53795
6 changed files with 108 additions and 59 deletions

View File

@ -36,6 +36,7 @@ typedef struct _PanelAppletHelper
int (*config_set)(Panel * panel, char const * section,
char const * variable, char const * value);
int (*error)(Panel * panel, char const * message, int ret);
void (*about_dialog)(Panel * panel);
int (*logout_dialog)(void);
void (*position_menu)(GtkMenu * menu, gint * x, gint * y,
gboolean * push_in, gpointer data);

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-02-05 03:41+0100\n"
"POT-Creation-Date: 2011-02-05 04:00+0100\n"
"PO-Revision-Date: 2010-04-22 12:45+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -20,7 +20,7 @@ msgstr ""
msgid "Unknown"
msgstr "Inconnu"
#: ../src/applets/battery.c:186 ../src/panel.c:359 ../src/panel.c:363
#: ../src/applets/battery.c:186 ../src/panel.c:374 ../src/panel.c:378
#: ../src/run.c:200 ../src/run.c:206
msgid "Error"
msgstr "Erreur"
@ -75,7 +75,7 @@ msgstr "GPS actif"
msgid "GSM is enabled"
msgstr "GSM actif"
#: ../src/applets/lock.c:63 ../src/applets/main.c:307
#: ../src/applets/lock.c:63 ../src/applets/main.c:315
msgid "Lock screen"
msgstr "Verrouiller l'écran"
@ -83,8 +83,8 @@ msgstr "Verrouiller l'écran"
msgid "Logging out is disabled"
msgstr "Se déconnecter est désactivé"
#: ../src/applets/logout.c:70 ../src/panel.c:617 ../src/panel.c:624
#: ../src/panel.c:632
#: ../src/applets/logout.c:70 ../src/panel.c:664 ../src/panel.c:671
#: ../src/panel.c:679
msgid "Logout"
msgstr "Déconnexion"
@ -92,19 +92,19 @@ msgstr "Déconnexion"
msgid "Main menu"
msgstr "Menu principal"
#: ../src/applets/main.c:288
#: ../src/applets/main.c:297
msgid "Applications"
msgstr "Programmes"
#: ../src/applets/main.c:294
#: ../src/applets/main.c:303
msgid "Run..."
msgstr "Exécuter..."
#: ../src/applets/main.c:313
#: ../src/applets/main.c:321
msgid "Logout..."
msgstr "Déconnecter..."
#: ../src/applets/main.c:318
#: ../src/applets/main.c:326
msgid "Shutdown..."
msgstr "Arrêter..."
@ -168,35 +168,35 @@ msgid ""
" -x\tUse icons the size of menus\n"
msgstr ""
#: ../src/panel.c:76
#: ../src/panel.c:88
msgid "large"
msgstr "grande"
#: ../src/panel.c:77
#: ../src/panel.c:89
msgid "small"
msgstr "petite"
#: ../src/panel.c:78
#: ../src/panel.c:90
msgid "smaller"
msgstr "très petite"
#: ../src/panel.c:442
#: ../src/panel.c:457
msgid "Panel preferences"
msgstr "Préférences du Panel"
#: ../src/panel.c:457
#: ../src/panel.c:472
msgid "Top size:"
msgstr "Taille du haut :"
#: ../src/panel.c:468
#: ../src/panel.c:483
msgid "Bottom size:"
msgstr "Taille du bas :"
#: ../src/panel.c:479
#: ../src/panel.c:494
msgid "General"
msgstr "Générales"
#: ../src/panel.c:607
#: ../src/panel.c:654
msgid ""
"This will log you out of the current session, therefore closing any "
"application currently opened and losing any unsaved data.\n"
@ -207,7 +207,7 @@ msgstr ""
"sauvegardées.\n"
"Voulez-vous continuer?"
#: ../src/panel.c:701
#: ../src/panel.c:748
msgid ""
"This will shutdown your device, therefore closing any application currently "
"opened and losing any unsaved data.\n"
@ -218,7 +218,7 @@ msgstr ""
"sauvegardées.\n"
"Voulez-vous continuer?"
#: ../src/panel.c:706
#: ../src/panel.c:753
msgid ""
"This will shutdown your computer, therefore closing any application "
"currently opened and losing any unsaved data.\n"
@ -229,11 +229,11 @@ msgstr ""
"sauvegardées.\n"
"Voulez-vous continuer?"
#: ../src/panel.c:723 ../src/panel.c:728 ../src/panel.c:735
#: ../src/panel.c:770 ../src/panel.c:775 ../src/panel.c:782
msgid "Shutdown"
msgstr "Arrêter"
#: ../src/panel.c:727
#: ../src/panel.c:774
msgid "Restart"
msgstr "Redémarrer"

View File

@ -6,10 +6,8 @@ BINDIR = $(PREFIX)/bin
CC = cc
CPPFLAGSF= -I ../include
CPPFLAGS=
CFLAGSF = -W `pkg-config --cflags libSystem gtk+-2.0`
CFLAGSF = -W
CFLAGS = -Wall -g -O2 -pedantic
LDFLAGSF= `pkg-config --libs libSystem gtk+-2.0`
LDFLAGS =
RM = rm -f
LN = ln -f
MKDIR = mkdir -p
@ -22,22 +20,22 @@ subdirs:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done
panel_OBJS = panel.o window.o main.o
panel_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) -D PREFIX=\"$(PREFIX)\" $(CFLAGSF) $(CFLAGS)
panel_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
panel_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) -D PREFIX=\"$(PREFIX)\" $(CFLAGSF) $(CFLAGS) `pkg-config --cflags libSystem libDesktop`
panel_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs libSystem libDesktop`
panel: $(panel_OBJS)
$(CC) -o panel $(panel_OBJS) $(panel_LDFLAGS)
panel-settings_OBJS = settings.o
panel-settings_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
panel-settings_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
panel-settings_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) `pkg-config --cflags gtk+-2.0`
panel-settings_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs gtk+-2.0`
panel-settings: $(panel-settings_OBJS)
$(CC) -o panel-settings $(panel-settings_OBJS) $(panel-settings_LDFLAGS)
run_OBJS = run.o
run_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) -D PREFIX=\"$(PREFIX)\" $(CFLAGSF) $(CFLAGS)
run_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
run_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) -D PREFIX=\"$(PREFIX)\" $(CFLAGSF) $(CFLAGS) `pkg-config --cflags libSystem gtk+-2.0`
run_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs libSystem gtk+-2.0`
run: $(run_OBJS)
$(CC) -o run $(run_OBJS) $(run_LDFLAGS)

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* 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
@ -82,12 +82,12 @@ static GtkWidget * _main_image(char const * name);
static GtkWidget * _main_menuitem(char const * label, char const * stock);
/* callbacks */
static void _on_about(gpointer data);
static void _on_clicked(gpointer data);
static gboolean _on_idle(gpointer data);
static void _on_lock(gpointer data);
static void _on_logout(gpointer data);
static void _on_run(void);
static void _on_preferences(gpointer data);
static void _on_shutdown(gpointer data);
static gboolean _on_timeout(gpointer data);
@ -277,6 +277,15 @@ static GtkWidget * _main_menuitem(char const * label, char const * stock)
/* callbacks */
/* on_about */
static void _on_about(gpointer data)
{
Main * main = data;
main->helper->about_dialog(main->helper->panel);
}
/* on_clicked */
static void _on_clicked(gpointer data)
{
@ -297,10 +306,9 @@ static void _on_clicked(gpointer data)
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES,
NULL);
menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL);
g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(
_on_preferences), main);
_on_about), main);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
@ -444,15 +452,6 @@ static void _on_logout(gpointer data)
}
/* on_preferences */
static void _on_preferences(gpointer data)
{
Main * main = data;
main->helper->preferences_dialog(main->helper->panel);
}
/* on_run */
static void _on_run(void)
{

View File

@ -1,21 +1,24 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
static char _copyright[] =
"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/>. */
static char const _license[] =
"This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation, version 3 of the License.\n"
"\n"
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see <http://www.gnu.org/licenses/>.";
#include <System.h>
#include <Desktop.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@ -61,12 +64,21 @@ struct _Panel
GtkWidget * pr_notebook;
GtkWidget * pr_bottom_size;
GtkWidget * pr_top_size;
/* about */
GtkWidget * ab_window;
};
/* constants */
#define PANEL_CONFIG_FILE ".panel"
static char const * _authors[] =
{
"Pierre Pronchery <khorben@defora.org>",
NULL
};
static struct
{
char const * alias;
@ -86,6 +98,7 @@ static char const * _panel_helper_config_get(Panel * panel,
static int _panel_helper_config_set(Panel * panel, char const * section,
char const * variable, char const * value);
static int _panel_helper_error(Panel * panel, char const * message, int ret);
static void _panel_helper_about_dialog(Panel * panel);
#ifndef EMBEDDED
static int _panel_helper_logout_dialog(void);
#endif
@ -128,6 +141,7 @@ Panel * panel_new(PanelPrefs const * prefs)
panel->top_helper.config_set = _panel_helper_config_set;
panel->top_helper.error = _panel_helper_error;
panel->top_helper.icon_size = PANEL_ICON_SIZE_UNSET;
panel->top_helper.about_dialog = _panel_helper_about_dialog;
#ifndef EMBEDDED
panel->top_helper.logout_dialog = _panel_helper_logout_dialog;
#else
@ -157,6 +171,7 @@ Panel * panel_new(PanelPrefs const * prefs)
break;
}
panel->pr_window = NULL;
panel->ab_window = NULL;
if(panel->config == NULL)
{
panel_error(NULL, error_get(), 0); /* XXX put up a dialog box */
@ -599,6 +614,38 @@ static int _panel_helper_error(Panel * panel, char const * message, int ret)
}
/* panel_helper_about_dialog */
static gboolean _about_on_closex(gpointer data);
static void _panel_helper_about_dialog(Panel * panel)
{
if(panel->ab_window != NULL)
{
gtk_window_present(GTK_WINDOW(panel->ab_window));
return;
}
panel->ab_window = desktop_about_dialog_new();
desktop_about_dialog_set_authors(panel->ab_window, _authors);
desktop_about_dialog_set_copyright(panel->ab_window, _copyright);
desktop_about_dialog_set_logo_icon_name(panel->ab_window,
"panel-settings"); /* XXX */
desktop_about_dialog_set_license(panel->ab_window, _license);
desktop_about_dialog_set_name(panel->ab_window, PACKAGE);
desktop_about_dialog_set_version(panel->ab_window, VERSION);
g_signal_connect_swapped(G_OBJECT(panel->ab_window), "delete-event",
G_CALLBACK(_about_on_closex), panel);
gtk_widget_show(panel->ab_window);
}
static gboolean _about_on_closex(gpointer data)
{
Panel * panel = data;
gtk_widget_hide(panel->ab_window);
return TRUE;
}
#ifndef EMBEDDED
/* panel_helper_logout_dialog */
static int _panel_helper_logout_dialog(void)

View File

@ -2,16 +2,16 @@ subdirs=applets
targets=panel,panel-settings,run
cppflags_force=-I ../include
#cppflags=-D EMBEDDED
cflags_force=-W `pkg-config --cflags libSystem gtk+-2.0`
cflags_force=-W
cflags=-Wall -g -O2 -pedantic
ldflags_force=`pkg-config --libs libSystem gtk+-2.0`
ldflags=
dist=Makefile,common.h,window.h
[panel]
type=binary
sources=panel.c,window.c,main.c
cppflags=-D PREFIX=\"$(PREFIX)\"
cflags=`pkg-config --cflags libSystem libDesktop`
ldflags=`pkg-config --libs libSystem libDesktop`
install=$(BINDIR)
[main.c]
@ -26,10 +26,14 @@ depends=common.h,window.h
[panel-settings]
type=binary
sources=settings.c
cflags=`pkg-config --cflags gtk+-2.0`
ldflags=`pkg-config --libs gtk+-2.0`
install=$(BINDIR)
[run]
type=binary
sources=run.c
cppflags=-D PREFIX=\"$(PREFIX)\"
cflags=`pkg-config --cflags libSystem gtk+-2.0`
ldflags=`pkg-config --libs libSystem gtk+-2.0`
install=$(BINDIR)