Implementing the plug-in selection in the preferences
This commit is contained in:
parent
e6e8b558ce
commit
17916f5d0d
38
po/fr.po
38
po/fr.po
|
@ -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-09-09 10:08+0200\n"
|
"POT-Creation-Date: 2011-09-09 18:47+0200\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:426 ../src/panel.c:431
|
#: ../src/applets/battery.c:185 ../src/panel.c:431 ../src/panel.c:436
|
||||||
#: ../src/run.c:214 ../src/run.c:220
|
#: ../src/run.c:214 ../src/run.c:220
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr "Erreur"
|
msgstr "Erreur"
|
||||||
|
@ -88,8 +88,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:1032 ../src/panel.c:1039
|
#: ../src/applets/logout.c:69 ../src/panel.c:1242 ../src/panel.c:1249
|
||||||
#: ../src/panel.c:1048
|
#: ../src/panel.c:1258
|
||||||
msgid "Logout"
|
msgid "Logout"
|
||||||
msgstr "Déconnexion"
|
msgstr "Déconnexion"
|
||||||
|
|
||||||
|
@ -183,47 +183,47 @@ 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:106
|
#: ../src/panel.c:111
|
||||||
msgid "Large"
|
msgid "Large"
|
||||||
msgstr "Grande"
|
msgstr "Grande"
|
||||||
|
|
||||||
#: ../src/panel.c:108
|
#: ../src/panel.c:113
|
||||||
msgid "Small"
|
msgid "Small"
|
||||||
msgstr "Petite"
|
msgstr "Petite"
|
||||||
|
|
||||||
#: ../src/panel.c:110
|
#: ../src/panel.c:115
|
||||||
msgid "Smaller"
|
msgid "Smaller"
|
||||||
msgstr "Très petite"
|
msgstr "Très petite"
|
||||||
|
|
||||||
#: ../src/panel.c:534
|
#: ../src/panel.c:548
|
||||||
msgid "Panel preferences"
|
msgid "Panel preferences"
|
||||||
msgstr "Préférences du Panel"
|
msgstr "Préférences du Panel"
|
||||||
|
|
||||||
#: ../src/panel.c:547
|
#: ../src/panel.c:562
|
||||||
msgid "General"
|
msgid "General"
|
||||||
msgstr "Général"
|
msgstr "Général"
|
||||||
|
|
||||||
#: ../src/panel.c:578
|
#: ../src/panel.c:591
|
||||||
msgid "Plug-ins:"
|
msgid "Plug-ins:"
|
||||||
msgstr "Greffons :"
|
msgstr "Greffons :"
|
||||||
|
|
||||||
#: ../src/panel.c:635
|
#: ../src/panel.c:666
|
||||||
msgid "Top panel:"
|
msgid "Top panel:"
|
||||||
msgstr "Panneau supérieur :"
|
msgstr "Panneau supérieur :"
|
||||||
|
|
||||||
#: ../src/panel.c:641 ../src/panel.c:645 ../src/panel.c:675 ../src/panel.c:679
|
#: ../src/panel.c:672 ../src/panel.c:676 ../src/panel.c:707 ../src/panel.c:711
|
||||||
msgid "Default"
|
msgid "Default"
|
||||||
msgstr "Par défaut"
|
msgstr "Par défaut"
|
||||||
|
|
||||||
#: ../src/panel.c:669
|
#: ../src/panel.c:701
|
||||||
msgid "Bottom panel:"
|
msgid "Bottom panel:"
|
||||||
msgstr "Panneau inférieur :"
|
msgstr "Panneau inférieur :"
|
||||||
|
|
||||||
#: ../src/panel.c:975
|
#: ../src/panel.c:1185
|
||||||
msgid "translator-credits"
|
msgid "translator-credits"
|
||||||
msgstr "Pierre Pronchery <khorben@defora.org>"
|
msgstr "Pierre Pronchery <khorben@defora.org>"
|
||||||
|
|
||||||
#: ../src/panel.c:1018
|
#: ../src/panel.c:1228
|
||||||
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"
|
||||||
|
@ -234,7 +234,7 @@ msgstr ""
|
||||||
"sauvegardées.\n"
|
"sauvegardées.\n"
|
||||||
"Voulez-vous continuer?"
|
"Voulez-vous continuer?"
|
||||||
|
|
||||||
#: ../src/panel.c:1134
|
#: ../src/panel.c:1344
|
||||||
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"
|
||||||
|
@ -245,7 +245,7 @@ msgstr ""
|
||||||
"sauvegardées.\n"
|
"sauvegardées.\n"
|
||||||
"Voulez-vous continuer?"
|
"Voulez-vous continuer?"
|
||||||
|
|
||||||
#: ../src/panel.c:1139
|
#: ../src/panel.c:1349
|
||||||
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"
|
||||||
|
@ -256,11 +256,11 @@ msgstr ""
|
||||||
"sauvegardées.\n"
|
"sauvegardées.\n"
|
||||||
"Voulez-vous continuer?"
|
"Voulez-vous continuer?"
|
||||||
|
|
||||||
#: ../src/panel.c:1153 ../src/panel.c:1160 ../src/panel.c:1169
|
#: ../src/panel.c:1363 ../src/panel.c:1370 ../src/panel.c:1379
|
||||||
msgid "Shutdown"
|
msgid "Shutdown"
|
||||||
msgstr "Arrêter"
|
msgstr "Arrêter"
|
||||||
|
|
||||||
#: ../src/panel.c:1159
|
#: ../src/panel.c:1369
|
||||||
msgid "Restart"
|
msgid "Restart"
|
||||||
msgstr "Redémarrer"
|
msgstr "Redémarrer"
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ PanelApplet applet =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"Bluetooth",
|
"Bluetooth",
|
||||||
NULL,
|
"panel-applet-bluetooth",
|
||||||
_bluetooth_init,
|
_bluetooth_init,
|
||||||
_bluetooth_destroy,
|
_bluetooth_destroy,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -60,7 +60,7 @@ PanelApplet applet =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"CPU",
|
"CPU",
|
||||||
NULL,
|
"gnome-monitor",
|
||||||
_cpu_init,
|
_cpu_init,
|
||||||
_cpu_destroy,
|
_cpu_destroy,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -62,7 +62,7 @@ PanelApplet applet =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"CPU frequency",
|
"CPU frequency",
|
||||||
NULL,
|
"gnome-monitor",
|
||||||
_cpufreq_init,
|
_cpufreq_init,
|
||||||
_cpufreq_destroy,
|
_cpufreq_destroy,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -56,7 +56,7 @@ PanelApplet applet =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"Memory",
|
"Memory",
|
||||||
NULL,
|
"gnome-monitor",
|
||||||
_memory_init,
|
_memory_init,
|
||||||
_memory_destroy,
|
_memory_destroy,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -56,7 +56,7 @@ PanelApplet applet =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"Swap",
|
"Swap",
|
||||||
NULL,
|
"gnome-monitor",
|
||||||
_swap_init,
|
_swap_init,
|
||||||
_swap_destroy,
|
_swap_destroy,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
292
src/panel.c
292
src/panel.c
|
@ -13,6 +13,8 @@ static char const _license[] =
|
||||||
"\n"
|
"\n"
|
||||||
"You should have received a copy of the GNU General Public License\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/>.";
|
"along with this program. If not, see <http://www.gnu.org/licenses/>.";
|
||||||
|
/* TODO:
|
||||||
|
* - get rid of the code duplication in the preferences callbacks */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,10 +73,13 @@ struct _Panel
|
||||||
GtkWidget * pr_window;
|
GtkWidget * pr_window;
|
||||||
GtkWidget * pr_notebook;
|
GtkWidget * pr_notebook;
|
||||||
GtkListStore * pr_store;
|
GtkListStore * pr_store;
|
||||||
|
GtkWidget * pr_view;
|
||||||
GtkWidget * pr_bottom_size;
|
GtkWidget * pr_bottom_size;
|
||||||
GtkListStore * pr_bottom_store;
|
GtkListStore * pr_bottom_store;
|
||||||
|
GtkWidget * pr_bottom_view;
|
||||||
GtkWidget * pr_top_size;
|
GtkWidget * pr_top_size;
|
||||||
GtkListStore * pr_top_store;
|
GtkListStore * pr_top_store;
|
||||||
|
GtkWidget * pr_top_view;
|
||||||
|
|
||||||
/* dialogs */
|
/* dialogs */
|
||||||
GtkWidget * ab_window;
|
GtkWidget * ab_window;
|
||||||
|
@ -506,15 +511,24 @@ int panel_load(Panel * panel, PanelPosition position, char const * applet)
|
||||||
/* panel_show_preferences */
|
/* panel_show_preferences */
|
||||||
static void _show_preferences_window(Panel * panel);
|
static void _show_preferences_window(Panel * panel);
|
||||||
static GtkWidget * _preferences_window_general(Panel * panel);
|
static GtkWidget * _preferences_window_general(Panel * panel);
|
||||||
static GtkListStore * _preferences_window_general_model(Panel * panel);
|
static GtkListStore * _preferences_window_general_model(void);
|
||||||
static GtkWidget * _preferences_window_general_view(Panel * panel,
|
static GtkWidget * _preferences_window_general_view(GtkListStore * store);
|
||||||
GtkListStore * store);
|
static void _preferences_window_general_plugin_add(GtkListStore * store,
|
||||||
|
char const * name);
|
||||||
|
static void _preferences_on_bottom_add(gpointer data);
|
||||||
|
static void _preferences_on_bottom_down(gpointer data);
|
||||||
|
static void _preferences_on_bottom_remove(gpointer data);
|
||||||
|
static void _preferences_on_bottom_up(gpointer data);
|
||||||
static gboolean _preferences_on_closex(gpointer data);
|
static gboolean _preferences_on_closex(gpointer data);
|
||||||
static void _preferences_on_response(GtkWidget * widget, gint response,
|
static void _preferences_on_response(GtkWidget * widget, gint response,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void _preferences_on_cancel(gpointer data);
|
static void _preferences_on_cancel(gpointer data);
|
||||||
static void _cancel_plugins(Panel * panel);
|
static void _cancel_plugins(Panel * panel);
|
||||||
static void _preferences_on_ok(gpointer data);
|
static void _preferences_on_ok(gpointer data);
|
||||||
|
static void _preferences_on_top_add(gpointer data);
|
||||||
|
static void _preferences_on_top_down(gpointer data);
|
||||||
|
static void _preferences_on_top_remove(gpointer data);
|
||||||
|
static void _preferences_on_top_up(gpointer data);
|
||||||
|
|
||||||
void panel_show_preferences(Panel * panel, gboolean show)
|
void panel_show_preferences(Panel * panel, gboolean show)
|
||||||
{
|
{
|
||||||
|
@ -535,6 +549,7 @@ static void _show_preferences_window(Panel * panel)
|
||||||
NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
|
NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
|
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
|
||||||
|
gtk_window_set_default_size(GTK_WINDOW(panel->pr_window), 400, 300);
|
||||||
g_signal_connect_swapped(G_OBJECT(panel->pr_window), "delete-event",
|
g_signal_connect_swapped(G_OBJECT(panel->pr_window), "delete-event",
|
||||||
G_CALLBACK(_preferences_on_closex), panel);
|
G_CALLBACK(_preferences_on_closex), panel);
|
||||||
g_signal_connect(G_OBJECT(panel->pr_window), "response",
|
g_signal_connect(G_OBJECT(panel->pr_window), "response",
|
||||||
|
@ -563,9 +578,7 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
GtkWidget * vbox2;
|
GtkWidget * vbox2;
|
||||||
GtkWidget * vbox3;
|
GtkWidget * vbox3;
|
||||||
GtkWidget * hbox;
|
GtkWidget * hbox;
|
||||||
GtkWidget * hbox2;
|
|
||||||
GtkWidget * frame;
|
GtkWidget * frame;
|
||||||
GtkWidget * view;
|
|
||||||
GtkWidget * widget;
|
GtkWidget * widget;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
@ -582,9 +595,11 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
|
||||||
GTK_SHADOW_ETCHED_IN);
|
GTK_SHADOW_ETCHED_IN);
|
||||||
panel->pr_store = _preferences_window_general_model(panel);
|
panel->pr_store = _preferences_window_general_model();
|
||||||
view = _preferences_window_general_view(panel, panel->pr_store);
|
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(panel->pr_store),
|
||||||
gtk_container_add(GTK_CONTAINER(widget), view);
|
2, GTK_SORT_ASCENDING);
|
||||||
|
panel->pr_view = _preferences_window_general_view(panel->pr_store);
|
||||||
|
gtk_container_add(GTK_CONTAINER(widget), panel->pr_view);
|
||||||
gtk_container_add(GTK_CONTAINER(frame), widget);
|
gtk_container_add(GTK_CONTAINER(frame), widget);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
|
||||||
/* controls */
|
/* controls */
|
||||||
|
@ -594,18 +609,26 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_top_add), panel);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_top_up), panel);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_top_down), panel);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_top_remove), panel);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_label_new(NULL);
|
widget = gtk_label_new(NULL);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), widget, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), widget, TRUE, TRUE, 0);
|
||||||
|
@ -616,18 +639,26 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_bottom_remove), panel);
|
||||||
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_bottom_down), panel);
|
||||||
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_bottom_up), panel);
|
||||||
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
widget = gtk_button_new();
|
widget = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
gtk_button_set_image(GTK_BUTTON(widget), gtk_image_new_from_stock(
|
||||||
GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON));
|
GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_signal_connect_swapped(widget, "clicked", G_CALLBACK(
|
||||||
|
_preferences_on_bottom_add), panel);
|
||||||
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
gtk_box_pack_end(GTK_BOX(vbox2), widget, FALSE, TRUE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, TRUE, 0);
|
||||||
vbox2 = gtk_vbox_new(FALSE, 4);
|
vbox2 = gtk_vbox_new(FALSE, 4);
|
||||||
|
@ -659,9 +690,10 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
|
||||||
GTK_SHADOW_ETCHED_IN);
|
GTK_SHADOW_ETCHED_IN);
|
||||||
panel->pr_top_store = _preferences_window_general_model(panel);
|
panel->pr_top_store = _preferences_window_general_model();
|
||||||
view = _preferences_window_general_view(panel, panel->pr_top_store);
|
panel->pr_top_view = _preferences_window_general_view(
|
||||||
gtk_container_add(GTK_CONTAINER(widget), view);
|
panel->pr_top_store);
|
||||||
|
gtk_container_add(GTK_CONTAINER(widget), panel->pr_top_view);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox3), widget, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox3), widget, TRUE, TRUE, 0);
|
||||||
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
|
||||||
|
@ -694,9 +726,10 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
|
||||||
GTK_SHADOW_ETCHED_IN);
|
GTK_SHADOW_ETCHED_IN);
|
||||||
panel->pr_bottom_store = _preferences_window_general_model(panel);
|
panel->pr_bottom_store = _preferences_window_general_model();
|
||||||
view = _preferences_window_general_view(panel, panel->pr_bottom_store);
|
panel->pr_bottom_view = _preferences_window_general_view(
|
||||||
gtk_container_add(GTK_CONTAINER(widget), view);
|
panel->pr_bottom_store);
|
||||||
|
gtk_container_add(GTK_CONTAINER(widget), panel->pr_bottom_view);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox3), widget, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox3), widget, TRUE, TRUE, 0);
|
||||||
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
|
||||||
|
@ -705,7 +738,7 @@ static GtkWidget * _preferences_window_general(Panel * panel)
|
||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkListStore * _preferences_window_general_model(Panel * panel)
|
static GtkListStore * _preferences_window_general_model(void)
|
||||||
{
|
{
|
||||||
GtkListStore * store;
|
GtkListStore * store;
|
||||||
|
|
||||||
|
@ -714,15 +747,17 @@ static GtkListStore * _preferences_window_general_model(Panel * panel)
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget * _preferences_window_general_view(Panel * panel,
|
static GtkWidget * _preferences_window_general_view(GtkListStore * store)
|
||||||
GtkListStore * store)
|
|
||||||
{
|
{
|
||||||
GtkWidget * view;
|
GtkWidget * view;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
GtkCellRenderer * renderer;
|
GtkCellRenderer * renderer;
|
||||||
GtkTreeViewColumn * column;
|
GtkTreeViewColumn * column;
|
||||||
|
|
||||||
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
|
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
|
||||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
|
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
|
||||||
|
gtk_tree_selection_set_mode(treesel, GTK_SELECTION_SINGLE);
|
||||||
renderer = gtk_cell_renderer_pixbuf_new();
|
renderer = gtk_cell_renderer_pixbuf_new();
|
||||||
column = gtk_tree_view_column_new_with_attributes("", renderer,
|
column = gtk_tree_view_column_new_with_attributes("", renderer,
|
||||||
"pixbuf", 1, NULL);
|
"pixbuf", 1, NULL);
|
||||||
|
@ -734,6 +769,100 @@ static GtkWidget * _preferences_window_general_view(Panel * panel,
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _preferences_window_general_plugin_add(GtkListStore * store,
|
||||||
|
char const * name)
|
||||||
|
{
|
||||||
|
Plugin * p;
|
||||||
|
PanelApplet * pa;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkIconTheme * theme;
|
||||||
|
GdkPixbuf * pixbuf;
|
||||||
|
|
||||||
|
if((p = plugin_new(LIBDIR, PACKAGE, "applets", name)) == NULL)
|
||||||
|
return;
|
||||||
|
if((pa = plugin_lookup(p, "applet")) == NULL)
|
||||||
|
{
|
||||||
|
plugin_delete(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
theme = gtk_icon_theme_get_default();
|
||||||
|
pixbuf = (pa->icon != NULL) ? gtk_icon_theme_load_icon(theme, pa->icon,
|
||||||
|
24, 0, NULL) : NULL;
|
||||||
|
if(pixbuf == NULL)
|
||||||
|
pixbuf = gtk_icon_theme_load_icon(theme, "gnome-settings", 24,
|
||||||
|
0, NULL);
|
||||||
|
gtk_list_store_append(store, &iter);
|
||||||
|
gtk_list_store_set(store, &iter, 0, name, 1, pixbuf, 2, pa->name, -1);
|
||||||
|
plugin_delete(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_bottom_add(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
gchar * p;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(panel->pr_view));
|
||||||
|
if(!gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
return;
|
||||||
|
gtk_tree_model_get(model, &iter, 0, &p, -1);
|
||||||
|
_preferences_window_general_plugin_add(panel->pr_bottom_store, p);
|
||||||
|
g_free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_bottom_down(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeIter iter2;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||||
|
panel->pr_bottom_view));
|
||||||
|
if(!gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
return;
|
||||||
|
iter2 = iter;
|
||||||
|
if(!gtk_tree_model_iter_next(model, &iter))
|
||||||
|
return;
|
||||||
|
gtk_list_store_swap(panel->pr_bottom_store, &iter, &iter2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_bottom_remove(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||||
|
panel->pr_bottom_view));
|
||||||
|
if(gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_bottom_up(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeIter iter2;
|
||||||
|
GtkTreePath * path;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||||
|
panel->pr_bottom_view));
|
||||||
|
if(!gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
return;
|
||||||
|
path = gtk_tree_model_get_path(model, &iter);
|
||||||
|
gtk_tree_path_prev(path);
|
||||||
|
gtk_tree_model_get_iter(model, &iter2, path);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
gtk_list_store_swap(panel->pr_bottom_store, &iter, &iter2);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean _preferences_on_closex(gpointer data)
|
static gboolean _preferences_on_closex(gpointer data)
|
||||||
{
|
{
|
||||||
Panel * panel = data;
|
Panel * panel = data;
|
||||||
|
@ -805,20 +934,19 @@ static void _cancel_plugins(Panel * panel)
|
||||||
{
|
{
|
||||||
DIR * dir;
|
DIR * dir;
|
||||||
struct dirent * de;
|
struct dirent * de;
|
||||||
GtkIconTheme * theme;
|
|
||||||
char const ext[] = ".so";
|
char const ext[] = ".so";
|
||||||
size_t len;
|
size_t len;
|
||||||
Plugin * p;
|
char * q;
|
||||||
PanelApplet * pa;
|
char const * r;
|
||||||
GtkTreeIter iter;
|
char c;
|
||||||
GdkPixbuf * pixbuf;
|
size_t i;
|
||||||
|
|
||||||
gtk_list_store_clear(panel->pr_store);
|
gtk_list_store_clear(panel->pr_store);
|
||||||
gtk_list_store_clear(panel->pr_bottom_store);
|
gtk_list_store_clear(panel->pr_bottom_store);
|
||||||
gtk_list_store_clear(panel->pr_top_store);
|
gtk_list_store_clear(panel->pr_top_store);
|
||||||
if((dir = opendir(LIBDIR "/" PACKAGE "/applets")) == NULL)
|
if((dir = opendir(LIBDIR "/" PACKAGE "/applets")) == NULL)
|
||||||
return;
|
return;
|
||||||
theme = gtk_icon_theme_get_default();
|
/* plug-ins */
|
||||||
while((de = readdir(dir)) != NULL)
|
while((de = readdir(dir)) != NULL)
|
||||||
{
|
{
|
||||||
if((len = strlen(de->d_name)) < sizeof(ext))
|
if((len = strlen(de->d_name)) < sizeof(ext))
|
||||||
|
@ -829,26 +957,41 @@ static void _cancel_plugins(Panel * panel)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, de->d_name);
|
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, de->d_name);
|
||||||
#endif
|
#endif
|
||||||
if((p = plugin_new(LIBDIR, PACKAGE, "applets", de->d_name))
|
_preferences_window_general_plugin_add(panel->pr_store,
|
||||||
== NULL)
|
de->d_name);
|
||||||
continue;
|
|
||||||
if((pa = plugin_lookup(p, "applet")) == NULL)
|
|
||||||
{
|
|
||||||
plugin_delete(p);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(pa->icon == NULL)
|
|
||||||
pixbuf = gtk_icon_theme_load_icon(theme,
|
|
||||||
"gnome-settings", 24, 0, NULL);
|
|
||||||
else
|
|
||||||
pixbuf = gtk_icon_theme_load_icon(theme, pa->icon, 24,
|
|
||||||
0, NULL);
|
|
||||||
gtk_list_store_append(panel->pr_store, &iter);
|
|
||||||
gtk_list_store_set(panel->pr_store, &iter, 0, de->d_name,
|
|
||||||
1, pixbuf, 2, pa->name, -1);
|
|
||||||
plugin_delete(p);
|
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
/* top panel */
|
||||||
|
r = config_get(panel->config, NULL, "top");
|
||||||
|
q = (r != NULL) ? strdup(r) : NULL;
|
||||||
|
for(i = 0, r = q; q != NULL; i++)
|
||||||
|
{
|
||||||
|
if(q[i] != '\0' && q[i] != ',')
|
||||||
|
continue;
|
||||||
|
c = q[i];
|
||||||
|
q[i] = '\0';
|
||||||
|
_preferences_window_general_plugin_add(panel->pr_top_store, r);
|
||||||
|
if(c == '\0')
|
||||||
|
break;
|
||||||
|
r = &q[i + 1];
|
||||||
|
}
|
||||||
|
free(q);
|
||||||
|
/* bottom panel */
|
||||||
|
r = config_get(panel->config, NULL, "bottom");
|
||||||
|
q = (r != NULL) ? strdup(r) : NULL;
|
||||||
|
for(i = 0, r = q; q != NULL; i++)
|
||||||
|
{
|
||||||
|
if(q[i] != '\0' && q[i] != ',')
|
||||||
|
continue;
|
||||||
|
c = q[i];
|
||||||
|
q[i] = '\0';
|
||||||
|
_preferences_window_general_plugin_add(panel->pr_bottom_store,
|
||||||
|
r);
|
||||||
|
if(c == '\0')
|
||||||
|
break;
|
||||||
|
r = &q[i + 1];
|
||||||
|
}
|
||||||
|
free(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _preferences_on_ok(gpointer data)
|
static void _preferences_on_ok(gpointer data)
|
||||||
|
@ -885,6 +1028,73 @@ static void _preferences_on_ok(gpointer data)
|
||||||
free(filename);
|
free(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_top_add(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
gchar * p;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(panel->pr_view));
|
||||||
|
if(!gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
return;
|
||||||
|
gtk_tree_model_get(model, &iter, 0, &p, -1);
|
||||||
|
_preferences_window_general_plugin_add(panel->pr_top_store, p);
|
||||||
|
g_free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_top_down(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeIter iter2;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||||
|
panel->pr_top_view));
|
||||||
|
if(!gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
return;
|
||||||
|
iter2 = iter;
|
||||||
|
if(!gtk_tree_model_iter_next(model, &iter))
|
||||||
|
return;
|
||||||
|
gtk_list_store_swap(panel->pr_top_store, &iter, &iter2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_top_remove(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||||
|
panel->pr_top_view));
|
||||||
|
if(gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _preferences_on_top_up(gpointer data)
|
||||||
|
{
|
||||||
|
Panel * panel = data;
|
||||||
|
GtkTreeModel * model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeIter iter2;
|
||||||
|
GtkTreePath * path;
|
||||||
|
GtkTreeSelection * treesel;
|
||||||
|
|
||||||
|
treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||||
|
panel->pr_top_view));
|
||||||
|
if(!gtk_tree_selection_get_selected(treesel, &model, &iter))
|
||||||
|
return;
|
||||||
|
path = gtk_tree_model_get_path(model, &iter);
|
||||||
|
gtk_tree_path_prev(path);
|
||||||
|
gtk_tree_model_get_iter(model, &iter2, path);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
gtk_list_store_swap(panel->pr_top_store, &iter, &iter2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* private */
|
/* private */
|
||||||
/* functions */
|
/* functions */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user