Using a dedicated section for each panel
This commit is contained in:
parent
30280c4f6d
commit
a784285f40
50
src/panel.c
50
src/panel.c
|
@ -126,7 +126,7 @@ static const struct
|
||||||
/* accessors */
|
/* accessors */
|
||||||
static gboolean _panel_can_suspend(void);
|
static gboolean _panel_can_suspend(void);
|
||||||
|
|
||||||
static char const * _panel_get_plugins(Panel * panel, PanelPosition position);
|
static char const * _panel_get_applets(Panel * panel, PanelPosition position);
|
||||||
|
|
||||||
/* useful */
|
/* useful */
|
||||||
static void _panel_reset(Panel * panel, GdkRectangle * rect);
|
static void _panel_reset(Panel * panel, GdkRectangle * rect);
|
||||||
|
@ -233,7 +233,7 @@ Panel * panel_new(PanelPrefs const * prefs)
|
||||||
|| strcmp(p, "1") == 0) ? TRUE : FALSE;
|
|| strcmp(p, "1") == 0) ? TRUE : FALSE;
|
||||||
panel->source = 0;
|
panel->source = 0;
|
||||||
/* top panel */
|
/* top panel */
|
||||||
if(panel_get_config(panel, NULL, "top") != NULL)
|
if(panel_get_config(panel, "top", "applets") != NULL)
|
||||||
{
|
{
|
||||||
panel->top = panel_window_new(PANEL_WINDOW_POSITION_TOP,
|
panel->top = panel_window_new(PANEL_WINDOW_POSITION_TOP,
|
||||||
&panel->top_helper, &rect);
|
&panel->top_helper, &rect);
|
||||||
|
@ -241,8 +241,8 @@ Panel * panel_new(PanelPrefs const * prefs)
|
||||||
panel_window_set_keep_above(panel->top, above);
|
panel_window_set_keep_above(panel->top, above);
|
||||||
}
|
}
|
||||||
/* bottom panel */
|
/* bottom panel */
|
||||||
if(panel_get_config(panel, NULL, "bottom") != NULL
|
if(panel_get_config(panel, "bottom", "applets") != NULL
|
||||||
|| panel_get_config(panel, NULL, "top") == NULL)
|
|| panel_get_config(panel, "top", "applets") == NULL)
|
||||||
{
|
{
|
||||||
panel->bottom = panel_window_new(PANEL_WINDOW_POSITION_BOTTOM,
|
panel->bottom = panel_window_new(PANEL_WINDOW_POSITION_BOTTOM,
|
||||||
&panel->bottom_helper, &rect);
|
&panel->bottom_helper, &rect);
|
||||||
|
@ -1051,7 +1051,7 @@ static void _preferences_on_response_apply(gpointer data)
|
||||||
sep = ",";
|
sep = ",";
|
||||||
g_free(p);
|
g_free(p);
|
||||||
}
|
}
|
||||||
config_set(panel->config, NULL, "top", value);
|
config_set(panel->config, "top", "applets", value);
|
||||||
string_delete(value);
|
string_delete(value);
|
||||||
/* bottom panel */
|
/* bottom panel */
|
||||||
if((i = gtk_combo_box_get_active(GTK_COMBO_BOX(panel->pr_bottom_size)))
|
if((i = gtk_combo_box_get_active(GTK_COMBO_BOX(panel->pr_bottom_size)))
|
||||||
|
@ -1070,7 +1070,7 @@ static void _preferences_on_response_apply(gpointer data)
|
||||||
sep = ",";
|
sep = ",";
|
||||||
g_free(p);
|
g_free(p);
|
||||||
}
|
}
|
||||||
config_set(panel->config, NULL, "bottom", value);
|
config_set(panel->config, "bottom", "applets", value);
|
||||||
string_delete(value);
|
string_delete(value);
|
||||||
/* XXX applets should be known from Panel already */
|
/* XXX applets should be known from Panel already */
|
||||||
cnt = gtk_notebook_get_n_pages(GTK_NOTEBOOK(panel->pr_notebook));
|
cnt = gtk_notebook_get_n_pages(GTK_NOTEBOOK(panel->pr_notebook));
|
||||||
|
@ -1203,7 +1203,7 @@ static void _cancel_applets(Panel * panel)
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
/* top panel */
|
/* top panel */
|
||||||
r = _panel_get_plugins(panel, PANEL_POSITION_TOP);
|
r = _panel_get_applets(panel, PANEL_POSITION_TOP);
|
||||||
q = (r != NULL) ? strdup(r) : NULL;
|
q = (r != NULL) ? strdup(r) : NULL;
|
||||||
for(i = 0, r = q; q != NULL; i++)
|
for(i = 0, r = q; q != NULL; i++)
|
||||||
{
|
{
|
||||||
|
@ -1218,7 +1218,7 @@ static void _cancel_applets(Panel * panel)
|
||||||
}
|
}
|
||||||
free(q);
|
free(q);
|
||||||
/* bottom panel */
|
/* bottom panel */
|
||||||
r = _panel_get_plugins(panel, PANEL_POSITION_BOTTOM);
|
r = _panel_get_applets(panel, PANEL_POSITION_BOTTOM);
|
||||||
q = (r != NULL) ? strdup(r) : NULL;
|
q = (r != NULL) ? strdup(r) : NULL;
|
||||||
for(i = 0, r = q; q != NULL; i++)
|
for(i = 0, r = q; q != NULL; i++)
|
||||||
{
|
{
|
||||||
|
@ -1360,26 +1360,38 @@ static gboolean _panel_can_suspend(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* panel_get_plugins */
|
/* panel_get_applets */
|
||||||
static char const * _panel_get_plugins(Panel * panel, PanelPosition position)
|
static char const * _panel_get_applets(Panel * panel, PanelPosition position)
|
||||||
{
|
{
|
||||||
#ifndef EMBEDDED
|
#ifndef EMBEDDED
|
||||||
char const * plugins = "main,desktop,lock,logout,pager,tasks"
|
char const * applets = "main,desktop,lock,logout,pager,tasks"
|
||||||
",gsm,gps,bluetooth,battery,cpufreq,volume,embed,systray,clock";
|
",gsm,gps,bluetooth,battery,cpufreq,volume,embed,systray,clock";
|
||||||
#else /* EMBEDDED */
|
#else /* EMBEDDED */
|
||||||
char const * plugins = "main,desktop,keyboard,tasks,spacer"
|
char const * applets = "main,desktop,keyboard,tasks,spacer"
|
||||||
",gsm,gps,bluetooth,battery,cpufreq,volume,embed,systray,clock"
|
",gsm,gps,bluetooth,battery,cpufreq,volume,embed,systray,clock"
|
||||||
",close";
|
",close";
|
||||||
#endif
|
#endif
|
||||||
char const * p = NULL;
|
char const * p = NULL;
|
||||||
|
|
||||||
if(position == PANEL_POSITION_TOP)
|
switch(position)
|
||||||
p = panel_get_config(panel, NULL, "top");
|
{
|
||||||
if(position == PANEL_POSITION_BOTTOM)
|
case PANEL_POSITION_TOP:
|
||||||
p = panel_get_config(panel, NULL, "bottom");
|
p = panel_get_config(panel, "top", "applets");
|
||||||
if(p == NULL && position == PANEL_POSITION_BOTTOM)
|
break;
|
||||||
if((p = panel_get_config(panel, NULL, "plugins")) == NULL)
|
case PANEL_POSITION_BOTTOM:
|
||||||
p = plugins;
|
p = panel_get_config(panel, "bottom", "applets");
|
||||||
|
if(p == NULL)
|
||||||
|
p = panel_get_config(panel, NULL, "applets");
|
||||||
|
if(p == NULL)
|
||||||
|
p = applets;
|
||||||
|
break;
|
||||||
|
case PANEL_POSITION_LEFT:
|
||||||
|
p = panel_get_config(panel, "left", "applets");
|
||||||
|
break;
|
||||||
|
case PANEL_POSITION_RIGHT:
|
||||||
|
p = panel_get_config(panel, "right", "applets");
|
||||||
|
break;
|
||||||
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user