Let the default monitor be set in the configuration file

This commit is contained in:
Pierre Pronchery 2012-01-04 00:24:59 +00:00
parent 26453a43dc
commit d474cc19cd
2 changed files with 36 additions and 27 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Panel 0.0.5\n" "Project-Id-Version: Panel 0.0.5\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-12-31 19:56+0100\n" "POT-Creation-Date: 2012-01-04 01:22+0100\n"
"PO-Revision-Date: 2010-04-22 12:45+0200\n" "PO-Revision-Date: 2010-04-22 12:45+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n" "Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n" "Language-Team: French\n"
@ -21,7 +21,7 @@ msgstr ""
msgid "Unknown" msgid "Unknown"
msgstr "Inconnu" msgstr "Inconnu"
#: ../src/applets/battery.c:185 ../src/panel.c:479 ../src/panel.c:484 #: ../src/applets/battery.c:185 ../src/panel.c:488 ../src/panel.c:493
#: ../src/run.c:214 ../src/run.c:220 #: ../src/run.c:214 ../src/run.c:220
msgid "Error" msgid "Error"
msgstr "Erreur" msgstr "Erreur"
@ -112,8 +112,8 @@ msgstr "Verrouiller l'écran"
msgid "Logging out is disabled" msgid "Logging out is disabled"
msgstr "Se déconnecter est désactivé" msgstr "Se déconnecter est désactivé"
#: ../src/applets/logout.c:69 ../src/panel.c:1398 ../src/panel.c:1405 #: ../src/applets/logout.c:69 ../src/panel.c:1407 ../src/panel.c:1414
#: ../src/panel.c:1414 #: ../src/panel.c:1423
msgid "Logout" msgid "Logout"
msgstr "Déconnexion" msgstr "Déconnexion"
@ -207,59 +207,59 @@ msgstr ""
" -s\tIcônes de la taille d'une petite barre d'outils\n" " -s\tIcônes de la taille d'une petite barre d'outils\n"
" -x\tIcônes de la taille de menus\n" " -x\tIcônes de la taille de menus\n"
#: ../src/panel.c:113 #: ../src/panel.c:114
msgid "Large" msgid "Large"
msgstr "Grande" msgstr "Grande"
#: ../src/panel.c:115 #: ../src/panel.c:116
msgid "Small" msgid "Small"
msgstr "Petite" msgstr "Petite"
#: ../src/panel.c:117 #: ../src/panel.c:118
msgid "Smaller" msgid "Smaller"
msgstr "Très petite" msgstr "Très petite"
#: ../src/panel.c:599 #: ../src/panel.c:608
msgid "Panel preferences" msgid "Panel preferences"
msgstr "Préférences du Panel" msgstr "Préférences du Panel"
#: ../src/panel.c:613 #: ../src/panel.c:622
msgid "General" msgid "General"
msgstr "Général" msgstr "Général"
#: ../src/panel.c:617 #: ../src/panel.c:626
msgid "Applets" msgid "Applets"
msgstr "Greffons" msgstr "Greffons"
#: ../src/panel.c:646 #: ../src/panel.c:655
msgid "Applets:" msgid "Applets:"
msgstr "Greffons :" msgstr "Greffons :"
#: ../src/panel.c:726 #: ../src/panel.c:735
msgid "Top panel:" msgid "Top panel:"
msgstr "Panneau supérieur :" msgstr "Panneau supérieur :"
#: ../src/panel.c:732 ../src/panel.c:736 ../src/panel.c:767 ../src/panel.c:771 #: ../src/panel.c:741 ../src/panel.c:745 ../src/panel.c:776 ../src/panel.c:780
msgid "Default" msgid "Default"
msgstr "Par défaut" msgstr "Par défaut"
#: ../src/panel.c:761 #: ../src/panel.c:770
msgid "Bottom panel:" msgid "Bottom panel:"
msgstr "Panneau inférieur :" msgstr "Panneau inférieur :"
#: ../src/panel.c:867 #: ../src/panel.c:876
msgid "Accept focus" msgid "Accept focus"
msgstr "Autoriser le focus" msgstr "Autoriser le focus"
#: ../src/panel.c:871 #: ../src/panel.c:880
msgid "Keep above other windows" msgid "Keep above other windows"
msgstr "Conserver au dessus des fenêtres" msgstr "Conserver au dessus des fenêtres"
#: ../src/panel.c:1337 #: ../src/panel.c:1346
msgid "translator-credits" msgid "translator-credits"
msgstr "Pierre Pronchery <khorben@defora.org>" msgstr "Pierre Pronchery <khorben@defora.org>"
#: ../src/panel.c:1384 #: ../src/panel.c:1393
msgid "" msgid ""
"This will log you out of the current session, therefore closing any " "This will log you out of the current session, therefore closing any "
"application currently opened and losing any unsaved data.\n" "application currently opened and losing any unsaved data.\n"
@ -270,7 +270,7 @@ msgstr ""
"sauvegardées.\n" "sauvegardées.\n"
"Voulez-vous continuer?" "Voulez-vous continuer?"
#: ../src/panel.c:1500 #: ../src/panel.c:1509
msgid "" msgid ""
"This will shutdown your device, therefore closing any application currently " "This will shutdown your device, therefore closing any application currently "
"opened and losing any unsaved data.\n" "opened and losing any unsaved data.\n"
@ -281,7 +281,7 @@ msgstr ""
"sauvegardées.\n" "sauvegardées.\n"
"Voulez-vous continuer?" "Voulez-vous continuer?"
#: ../src/panel.c:1505 #: ../src/panel.c:1514
msgid "" msgid ""
"This will shutdown your computer, therefore closing any application " "This will shutdown your computer, therefore closing any application "
"currently opened and losing any unsaved data.\n" "currently opened and losing any unsaved data.\n"
@ -292,11 +292,11 @@ msgstr ""
"sauvegardées.\n" "sauvegardées.\n"
"Voulez-vous continuer?" "Voulez-vous continuer?"
#: ../src/panel.c:1519 ../src/panel.c:1526 ../src/panel.c:1535 #: ../src/panel.c:1528 ../src/panel.c:1535 ../src/panel.c:1544
msgid "Shutdown" msgid "Shutdown"
msgstr "Arrêter" msgstr "Arrêter"
#: ../src/panel.c:1525 #: ../src/panel.c:1534
msgid "Restart" msgid "Restart"
msgstr "Redémarrer" msgstr "Redémarrer"

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Panel */ /* This file is part of DeforaOS Desktop Panel */
static char const _license[] = static char const _license[] =
"This program is free software: you can redistribute it and/or modify\n" "This program is free software: you can redistribute it and/or modify\n"
@ -32,6 +32,7 @@ static char const _license[] =
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include <errno.h> #include <errno.h>
#include <libintl.h> #include <libintl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -152,7 +153,7 @@ static char * _config_get_filename(void);
/* public */ /* public */
/* panel_new */ /* panel_new */
static int _new_config(Panel * panel); static int _new_config(Panel * panel);
static void _new_prefs(GdkScreen * screen, PanelPrefs * prefs, static void _new_prefs(Config * config, GdkScreen * screen, PanelPrefs * prefs,
PanelPrefs const * user); PanelPrefs const * user);
static GtkIconSize _new_size(Panel * panel, PanelPosition position); static GtkIconSize _new_size(Panel * panel, PanelPosition position);
static gboolean _on_idle(gpointer data); static gboolean _on_idle(gpointer data);
@ -176,9 +177,9 @@ Panel * panel_new(PanelPrefs const * prefs)
if((panel = object_new(sizeof(*panel))) == NULL) if((panel = object_new(sizeof(*panel))) == NULL)
return NULL; return NULL;
_new_config(panel);
panel->screen = gdk_screen_get_default(); panel->screen = gdk_screen_get_default();
_new_prefs(panel->screen, &panel->prefs, prefs); if(_new_config(panel) == 0)
_new_prefs(panel->config, panel->screen, &panel->prefs, prefs);
panel->top_helper.panel = panel; panel->top_helper.panel = panel;
panel->top_helper.config_get = _panel_helper_config_get; panel->top_helper.config_get = _panel_helper_config_get;
panel->top_helper.config_set = _panel_helper_config_set; panel->top_helper.config_set = _panel_helper_config_set;
@ -276,12 +277,14 @@ static int _new_config(Panel * panel)
return 0; return 0;
} }
static void _new_prefs(GdkScreen * screen, PanelPrefs * prefs, static void _new_prefs(Config * config, GdkScreen * screen, PanelPrefs * prefs,
PanelPrefs const * user) PanelPrefs const * user)
{ {
size_t i; size_t i;
gint width; gint width;
gint height; gint height;
char const * p;
char * q;
for(i = 0; i < sizeof(_panel_sizes) / sizeof(*_panel_sizes); i++) for(i = 0; i < sizeof(_panel_sizes) / sizeof(*_panel_sizes); i++)
{ {
@ -300,6 +303,12 @@ static void _new_prefs(GdkScreen * screen, PanelPrefs * prefs,
prefs->iconsize = PANEL_ICON_SIZE_DEFAULT; prefs->iconsize = PANEL_ICON_SIZE_DEFAULT;
prefs->monitor = -1; prefs->monitor = -1;
} }
if((p = config_get(config, NULL, "monitor")) != NULL)
{
prefs->monitor = strtol(p, &q, 0);
if(p[0] == '\0' || *q != '\0')
prefs->monitor = -1;
}
#if GTK_CHECK_VERSION(2, 20, 0) #if GTK_CHECK_VERSION(2, 20, 0)
if(prefs->monitor == -1) if(prefs->monitor == -1)
prefs->monitor = gdk_screen_get_primary_monitor(screen); prefs->monitor = gdk_screen_get_primary_monitor(screen);