Commit d62e415a authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

when types are changed change the type notebook of the panel properties if

Tue Jan 25 01:13:49 2000  George Lebl <jirka@5z.com>

	* menu.c,panel_config.[ch]: when types are changed change the
	  type notebook of the panel properties if it exists.  Also
	  use GtkFrame instead of GtkViewport for the empty space in the
	  position widget to avoid blackness

	* panel.c: small cleanup, and add a commented out binding of
	  the type_change signal

	* basep-widget.[ch]: comment out the type_change signal as it
	  is never in fact even emitted, but perhaps it should
parent 56505e29
Tue Jan 25 01:13:49 2000 George Lebl <jirka@5z.com>
* menu.c,panel_config.[ch]: when types are changed change the
type notebook of the panel properties if it exists. Also
use GtkFrame instead of GtkViewport for the empty space in the
position widget to avoid blackness
* panel.c: small cleanup, and add a commented out binding of
the type_change signal
* basep-widget.[ch]: comment out the type_change signal as it
is never in fact even emitted, but perhaps it should
Mon Jan 24 15:11:05 2000 George Lebl <jirka@5z.com>
* menu.c: set menu_panel for each menu when shown. Also correctly
......
Tue Jan 25 01:13:49 2000 George Lebl <jirka@5z.com>
* menu.c,panel_config.[ch]: when types are changed change the
type notebook of the panel properties if it exists. Also
use GtkFrame instead of GtkViewport for the empty space in the
position widget to avoid blackness
* panel.c: small cleanup, and add a commented out binding of
the type_change signal
* basep-widget.[ch]: comment out the type_change signal as it
is never in fact even emitted, but perhaps it should
Mon Jan 24 15:11:05 2000 George Lebl <jirka@5z.com>
* menu.c: set menu_panel for each menu when shown. Also correctly
......
......@@ -74,7 +74,7 @@ basep_widget_get_type ()
}
enum {
TYPE_CHANGE_SIGNAL,
/*TYPE_CHANGE_SIGNAL,*/
MODE_CHANGE_SIGNAL,
STATE_CHANGE_SIGNAL,
WIDGET_LAST_SIGNAL
......@@ -249,7 +249,7 @@ basep_widget_class_init (BasePWidgetClass *klass)
basep_widget_parent_class = gtk_type_class (gtk_window_get_type ());
basep_widget_signals[TYPE_CHANGE_SIGNAL] =
/*basep_widget_signals[TYPE_CHANGE_SIGNAL] =
gtk_signal_new("type_change",
GTK_RUN_LAST,
object_class->type,
......@@ -257,7 +257,7 @@ basep_widget_class_init (BasePWidgetClass *klass)
type_change),
gtk_marshal_NONE__ENUM,
GTK_TYPE_NONE,
1, GTK_TYPE_ENUM);
1, GTK_TYPE_ENUM);*/
basep_widget_signals[MODE_CHANGE_SIGNAL] =
gtk_signal_new("mode_change",
......
......@@ -85,8 +85,11 @@ struct _BasePWidgetClass
GtkWindowClass parent_class;
/* signals */
void (*type_change) (BasePWidget *basep,
PanelType type);
/*FIXME: perhaps the type_change signal should be implemented
so that we don't have to handle the update_config_type in menu.c
but in panel.c along with the other update stuff */
/*void (*type_change) (BasePWidget *basep,
PanelType type);*/
void (*mode_change) (BasePWidget *basep,
BasePMode mode);
......
......@@ -2456,6 +2456,7 @@ convert_setup (BasePWidget *basep, GtkType type)
basep->pos->basep = basep;
basep_widget_pre_convert_hook (basep);
basep_pos_connect_signals (basep);
update_config_type (basep);
}
static void
......
......@@ -57,6 +57,8 @@ static void
update_position_toggles (PerPanelConfig *ppc)
{
GtkWidget *toggle = ppc->toggle[ppc->edge][ppc->align];
/* this could happen during type changes */
if(!toggle) return;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE);
}
......@@ -220,6 +222,7 @@ update_config_align (BasePWidget *w)
update_position_toggles (ppc);
}
static void
config_destroy(GtkWidget *widget, gpointer data)
{
......@@ -538,7 +541,8 @@ make_position_widget (PerPanelConfig *ppc, int aligns)
update_position_toggles (ppc);
w = gtk_viewport_new (NULL, NULL);
w = gtk_frame_new (NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w), GTK_SHADOW_IN);
gtk_table_attach (GTK_TABLE (table), w,
1, 1 + aligns,
1, 1 + aligns,
......@@ -1151,6 +1155,54 @@ background_page (PerPanelConfig *ppc)
return vbox;
}
void
update_config_type (BasePWidget *w)
{
PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w));
int i,j;
GtkWidget *page;
if (!ppc)
return;
g_return_if_fail(ppc->type_tab);
ppc->register_changes = FALSE;
gtk_widget_destroy(GTK_BIN(ppc->type_tab)->child);
/*FIXME: magic numbers */
for(i=0;i<4;i++)
for(j=0;j<3;j++)
ppc->toggle[i][j] = NULL;
if(IS_EDGE_WIDGET(w)) {
/* edge notebook page */
page = edge_notebook_page(ppc);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Edge panel"));
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
} else if(IS_ALIGNED_WIDGET(w)) {
/* aligned notebook page */
page = aligned_notebook_page(ppc);
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Aligned panel"));
} else if(IS_SLIDING_WIDGET(w)) {
/* sliding notebook page */
page = sliding_notebook_page(ppc);
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Sliding panel"));
} else if(IS_FLOATING_WIDGET(w)) {
/* floating notebook page */
page = floating_notebook_page(ppc);
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Floating panel"));
}
gtk_widget_show_all(ppc->type_tab);
ppc->register_changes = TRUE;
}
static void
panelcfg_help(void)
{
......@@ -1238,34 +1290,49 @@ panel_config(GtkWidget *panel)
if(IS_EDGE_WIDGET(panel)) {
/* edge notebook page */
page = edge_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK(prop_nbook),
page,
gtk_label_new (_("Edge panel")));
page = edge_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Edge panel"));
gtk_notebook_append_page(GTK_NOTEBOOK(prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_ALIGNED_WIDGET(panel)) {
/* aligned notebook page */
page = aligned_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK(prop_nbook),
page,
gtk_label_new (_("Aligned panel")));
}else if (IS_SLIDING_WIDGET (panel)) {
page = aligned_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Aligned panel"));
gtk_notebook_append_page(GTK_NOTEBOOK(prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_SLIDING_WIDGET(panel)) {
/* sliding notebook page */
page = sliding_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK (prop_nbook),
page,
gtk_label_new (_("Sliding panel")));
} else if (IS_FLOATING_WIDGET (panel)) {
page = sliding_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Sliding panel"));
gtk_notebook_append_page(GTK_NOTEBOOK (prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_FLOATING_WIDGET(panel)) {
/* floating notebook page */
page = floating_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK (prop_nbook),
page,
gtk_label_new (_("Floating panel")));
page = floating_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Floating panel"));
gtk_notebook_append_page(GTK_NOTEBOOK (prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_DRAWER_WIDGET(panel)) {
BasePWidget *basep = BASEP_WIDGET(panel);
GtkWidget *applet = PANEL_WIDGET(basep->panel)->master_widget;
AppletInfo *info =
gtk_object_get_data(GTK_OBJECT(applet), "applet_info");
add_drawer_properties_page(ppc, info->data);
/* we can't change to/from drawers anyhow */
ppc->type_tab = NULL;
}
/* Backing configuration */
......
......@@ -40,8 +40,15 @@ struct _PerPanelConfig {
char *back_pixmap;
GdkColor back_color;
int register_changes; /*used for startup*/
gboolean register_changes; /*used for startup*/
GtkWidget *config_window;
GtkWidget *type_tab; /* the type specific tab of
the notebook, this is just
an eventbox, which we will
be able to change contents
of */
GtkWidget *type_tab_label;
GtkWidget *pix_entry;
/*size*/
......@@ -70,14 +77,15 @@ struct _PerPanelConfig {
GtkObject *offset_adj;
};
void panel_config(GtkWidget *panel);
void update_config_size(GtkWidget *panel);
void update_config_back(PanelWidget *panel);
void panel_config (GtkWidget *panel);
void update_config_size (GtkWidget *panel);
void update_config_back (PanelWidget *panel);
void update_config_edge (BasePWidget *w);
void update_config_anchor (BasePWidget *w);
void update_config_offset (BasePWidget *w);
void update_config_align (BasePWidget *w);
void update_config_floating_pos (BasePWidget *w);
void update_config_floating_orient (BasePWidget *w);
void kill_config_dialog(GtkWidget *panel);
void update_config_type (BasePWidget *w);
void kill_config_dialog (GtkWidget *panel);
#endif /* PANEL_CONFIG_H */
......@@ -461,23 +461,29 @@ queue_resize_foreach(GtkWidget *w, gpointer data)
}
}
static int
basep_state_change(GtkWidget *widget,
static void
basep_state_change(BasePWidget *basep,
BasePState state,
gpointer data)
{
BasePWidget *basep = BASEP_WIDGET(widget);
gtk_container_foreach (GTK_CONTAINER (basep->panel),
(state == BASEP_SHOWN)
? state_restore_foreach
: state_hide_foreach,
(gpointer)widget);
(gpointer)basep);
panels_to_sync = TRUE;
return TRUE;
}
/*static void
basep_type_change(BasePWidget *basep,
PanelType type,
gpointer data)
{
update_config_type(basep);
panels_to_sync = TRUE;
}*/
static void
panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
{
......@@ -1133,6 +1139,10 @@ panel_setup(GtkWidget *panelw)
"state_change",
GTK_SIGNAL_FUNC (basep_state_change),
NULL);
/*gtk_signal_connect (GTK_OBJECT (basep),
"type_change",
GTK_SIGNAL_FUNC (basep_type_change),
NULL);*/
basep_pos_connect_signals (basep);
......@@ -1169,7 +1179,7 @@ send_state_change(void)
for(list = panel_list; list != NULL; list = g_slist_next(list)) {
PanelData *pd = list->data;
if(!IS_DRAWER_WIDGET(pd->panel))
basep_state_change(pd->panel,
basep_state_change(BASEP_WIDGET(pd->panel),
BASEP_WIDGET(pd->panel)->state,
NULL);
}
......
......@@ -57,6 +57,8 @@ static void
update_position_toggles (PerPanelConfig *ppc)
{
GtkWidget *toggle = ppc->toggle[ppc->edge][ppc->align];
/* this could happen during type changes */
if(!toggle) return;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE);
}
......@@ -220,6 +222,7 @@ update_config_align (BasePWidget *w)
update_position_toggles (ppc);
}
static void
config_destroy(GtkWidget *widget, gpointer data)
{
......@@ -538,7 +541,8 @@ make_position_widget (PerPanelConfig *ppc, int aligns)
update_position_toggles (ppc);
w = gtk_viewport_new (NULL, NULL);
w = gtk_frame_new (NULL);
gtk_frame_set_shadow_type(GTK_FRAME(w), GTK_SHADOW_IN);
gtk_table_attach (GTK_TABLE (table), w,
1, 1 + aligns,
1, 1 + aligns,
......@@ -1151,6 +1155,54 @@ background_page (PerPanelConfig *ppc)
return vbox;
}
void
update_config_type (BasePWidget *w)
{
PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w));
int i,j;
GtkWidget *page;
if (!ppc)
return;
g_return_if_fail(ppc->type_tab);
ppc->register_changes = FALSE;
gtk_widget_destroy(GTK_BIN(ppc->type_tab)->child);
/*FIXME: magic numbers */
for(i=0;i<4;i++)
for(j=0;j<3;j++)
ppc->toggle[i][j] = NULL;
if(IS_EDGE_WIDGET(w)) {
/* edge notebook page */
page = edge_notebook_page(ppc);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Edge panel"));
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
} else if(IS_ALIGNED_WIDGET(w)) {
/* aligned notebook page */
page = aligned_notebook_page(ppc);
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Aligned panel"));
} else if(IS_SLIDING_WIDGET(w)) {
/* sliding notebook page */
page = sliding_notebook_page(ppc);
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Sliding panel"));
} else if(IS_FLOATING_WIDGET(w)) {
/* floating notebook page */
page = floating_notebook_page(ppc);
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
gtk_label_set(GTK_LABEL(ppc->type_tab_label),
_("Floating panel"));
}
gtk_widget_show_all(ppc->type_tab);
ppc->register_changes = TRUE;
}
static void
panelcfg_help(void)
{
......@@ -1238,34 +1290,49 @@ panel_config(GtkWidget *panel)
if(IS_EDGE_WIDGET(panel)) {
/* edge notebook page */
page = edge_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK(prop_nbook),
page,
gtk_label_new (_("Edge panel")));
page = edge_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Edge panel"));
gtk_notebook_append_page(GTK_NOTEBOOK(prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_ALIGNED_WIDGET(panel)) {
/* aligned notebook page */
page = aligned_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK(prop_nbook),
page,
gtk_label_new (_("Aligned panel")));
}else if (IS_SLIDING_WIDGET (panel)) {
page = aligned_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Aligned panel"));
gtk_notebook_append_page(GTK_NOTEBOOK(prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_SLIDING_WIDGET(panel)) {
/* sliding notebook page */
page = sliding_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK (prop_nbook),
page,
gtk_label_new (_("Sliding panel")));
} else if (IS_FLOATING_WIDGET (panel)) {
page = sliding_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Sliding panel"));
gtk_notebook_append_page(GTK_NOTEBOOK (prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_FLOATING_WIDGET(panel)) {
/* floating notebook page */
page = floating_notebook_page (ppc);
gtk_notebook_append_page (GTK_NOTEBOOK (prop_nbook),
page,
gtk_label_new (_("Floating panel")));
page = floating_notebook_page(ppc);
ppc->type_tab = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(ppc->type_tab), page);
ppc->type_tab_label = gtk_label_new (_("Floating panel"));
gtk_notebook_append_page(GTK_NOTEBOOK (prop_nbook),
ppc->type_tab,
ppc->type_tab_label);
} else if(IS_DRAWER_WIDGET(panel)) {
BasePWidget *basep = BASEP_WIDGET(panel);
GtkWidget *applet = PANEL_WIDGET(basep->panel)->master_widget;
AppletInfo *info =
gtk_object_get_data(GTK_OBJECT(applet), "applet_info");
add_drawer_properties_page(ppc, info->data);
/* we can't change to/from drawers anyhow */
ppc->type_tab = NULL;
}
/* Backing configuration */
......
......@@ -40,8 +40,15 @@ struct _PerPanelConfig {
char *back_pixmap;
GdkColor back_color;
int register_changes; /*used for startup*/
gboolean register_changes; /*used for startup*/
GtkWidget *config_window;
GtkWidget *type_tab; /* the type specific tab of
the notebook, this is just
an eventbox, which we will
be able to change contents
of */
GtkWidget *type_tab_label;
GtkWidget *pix_entry;
/*size*/
......@@ -70,14 +77,15 @@ struct _PerPanelConfig {
GtkObject *offset_adj;
};
void panel_config(GtkWidget *panel);
void update_config_size(GtkWidget *panel);
void update_config_back(PanelWidget *panel);
void panel_config (GtkWidget *panel);
void update_config_size (GtkWidget *panel);
void update_config_back (PanelWidget *panel);
void update_config_edge (BasePWidget *w);
void update_config_anchor (BasePWidget *w);
void update_config_offset (BasePWidget *w);
void update_config_align (BasePWidget *w);
void update_config_floating_pos (BasePWidget *w);
void update_config_floating_orient (BasePWidget *w);
void kill_config_dialog(GtkWidget *panel);
void update_config_type (BasePWidget *w);
void kill_config_dialog (GtkWidget *panel);
#endif /* PANEL_CONFIG_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment