Commit 47d48d0f authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Arturo Espinosa

Added fit_pixmap_bg field.

1998-05-29  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* panel-widget.h (struct _PanelWidget): Added fit_pixmap_bg field.

	* panel-widget.c (panel_try_to_set_pixmap): Added optional pixmap
	scaling for the background of the panel.

	* main.c (init_user_panels): Load the panel fit pixmap flag.

	* panel.c (save_panel_configuration): Save the panel fit pixmap flag.

	* panel_config.c (pixmap_page): Added configuration option for
	fit_pixmap_bg.
parent 12055a13
1998-05-29 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel-widget.h (struct _PanelWidget): Added fit_pixmap_bg field.
* panel-widget.c (panel_try_to_set_pixmap): Added optional pixmap
scaling for the background of the panel.
* main.c (init_user_panels): Load the panel fit pixmap flag.
* panel.c (save_panel_configuration): Save the panel fit pixmap flag.
* panel_config.c (pixmap_page): Added configuration option for
fit_pixmap_bg.
Tue May 26 02:56:50 1998 George Lebl <jirka@5z.com>
* panel.c: fix to exit for the times when we aren't connected
......
1998-05-29 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel-widget.h (struct _PanelWidget): Added fit_pixmap_bg field.
* panel-widget.c (panel_try_to_set_pixmap): Added optional pixmap
scaling for the background of the panel.
* main.c (init_user_panels): Load the panel fit pixmap flag.
* panel.c (save_panel_configuration): Save the panel fit pixmap flag.
* panel_config.c (pixmap_page): Added configuration option for
fit_pixmap_bg.
Tue May 26 02:56:50 1998 George Lebl <jirka@5z.com>
* panel.c: fix to exit for the times when we aren't connected
......
......@@ -173,6 +173,7 @@ create_empty_drawer_applet(PanelOrientType orient)
PANEL_VERTICAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_LEFT, NULL, NULL),
......@@ -182,6 +183,7 @@ create_empty_drawer_applet(PanelOrientType orient)
PANEL_VERTICAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_RIGHT, NULL, NULL),
......@@ -191,6 +193,7 @@ create_empty_drawer_applet(PanelOrientType orient)
PANEL_HORIZONTAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_LEFT, NULL, NULL),
......@@ -200,6 +203,7 @@ create_empty_drawer_applet(PanelOrientType orient)
PANEL_HORIZONTAL,
PANEL_DRAWER,
PANEL_EXPLICIT_HIDE,
TRUE,
PANEL_SHOWN,
0, 0,
DROP_ZONE_RIGHT, NULL, NULL),
......
......@@ -931,6 +931,8 @@ init_user_panels(void)
g_snprintf(buf,256,"mode=%d", PANEL_EXPLICIT_HIDE);
config.mode=gnome_config_get_int(buf);
config.fit_pixmap_bg = gnome_config_get_bool ("fit_pixmap_bg=TRUE");
g_snprintf(buf,256,"state=%d", PANEL_SHOWN);
state=gnome_config_get_int(buf);
......@@ -955,6 +957,7 @@ init_user_panels(void)
config.orient,
config.snapped,
config.mode,
config.fit_pixmap_bg,
state,
x,
y,
......
......@@ -90,6 +90,7 @@ config_apply (GtkWidget *widget, int page, gpointer data)
panel_config_struct.orient,
panel_config_struct.snapped,
panel_config_struct.mode,
panel_config_struct.fit_pixmap_bg,
panel->state,
panel->drawer_drop_zone_pos,
back_pixmap);
......@@ -224,7 +225,14 @@ set_pixmap_enable (GtkWidget *widget, gpointer data)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static void
set_fit_pixmap_bg (GtkToggleButton *toggle, gpointer data)
{
panel_config_struct.fit_pixmap_bg = toggle->active;
if (panel_config_struct.config_box)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static GtkWidget *
pixmap_page (PanelWidget *panel)
......@@ -244,6 +252,17 @@ pixmap_page (PanelWidget *panel)
box = gtk_vbox_new (0, 0);
gtk_container_border_width(GTK_CONTAINER (box), CONFIG_PADDING_SIZE);
gtk_container_add (GTK_CONTAINER (f), box);
w = gtk_check_button_new_with_label (_("Enable Background Image"));
/*always set to true, because in the beginning we don't have
any pixmap so it's not gonna be set by default anyhow*/
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_pixmap_enable),
file_entry);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
file_entry = gnome_file_entry_new ("pixmap", _("Browse"));
t = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (file_entry));
gtk_signal_connect (GTK_OBJECT (t), "changed",
......@@ -254,16 +273,14 @@ pixmap_page (PanelWidget *panel)
gtk_entry_set_text (GTK_ENTRY (t), panel->back_pixmap ?
panel->back_pixmap : "");
w = gtk_check_button_new_with_label (_("Enable Background Image"));
/*always set to true, because in the beginning we don't have
any pixmap so it's not gonna be set by default anyhow*/
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_pixmap_enable),
file_entry);
w = gtk_check_button_new_with_label (_("Scale image to fit panel"));
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), panel->fit_pixmap_bg);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_fit_pixmap_bg),
NULL);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
return vbox;
}
......
......@@ -1685,7 +1685,6 @@ panel_widget_fixed_size_allocate(GtkWidget *widget, GtkAllocation *allocation,
gpointer data)
{
PanelWidget *panel = data;
GList *list;
if(panel_widget_inhibit_allocates)
return FALSE;
......@@ -1849,7 +1848,27 @@ panel_try_to_set_pixmap (PanelWidget *panel, char *pixmap)
if (!im)
return 0;
gdk_imlib_render (im, im->rgb_width, im->rgb_height);
if (panel->fit_pixmap_bg) {
int w, h;
w = im->rgb_width;
h = im->rgb_height;
switch (panel->orient) {
case PANEL_HORIZONTAL:
gdk_imlib_render (im, w * 48 / h, 48);
break;
case PANEL_VERTICAL:
gdk_imlib_render (im, 48, h * 48 / w);
break;
default:
g_assert_not_reached ();
}
} else
gdk_imlib_render (im, im->rgb_width, im->rgb_height);
p = gdk_imlib_move_image (im);
ns = gtk_style_copy(panel->fixed->style);
......@@ -1908,6 +1927,7 @@ panel_widget_new (gint size,
PanelOrientation orient,
PanelSnapped snapped,
PanelMode mode,
gboolean fit_pixmap_bg,
PanelState state,
gint pos_x,
gint pos_y,
......@@ -2000,6 +2020,7 @@ panel_widget_new (gint size,
panel->snapped = snapped;
panel->orient = orient;
panel->mode = mode;
panel->fit_pixmap_bg = fit_pixmap_bg;
panel->state = state;
panel->master_widget = NULL;
......@@ -3068,6 +3089,7 @@ panel_widget_change_params(PanelWidget *panel,
PanelOrientation orient,
PanelSnapped snapped,
PanelMode mode,
gboolean fit_pixmap_bg,
PanelState state,
DrawerDropZonePos drop_zone_pos,
char *pixmap)
......@@ -3134,6 +3156,8 @@ panel_widget_change_params(PanelWidget *panel,
if(panel->mode == PANEL_AUTO_HIDE)
panel_widget_pop_down(panel);
panel->fit_pixmap_bg = fit_pixmap_bg;
if (panel_try_to_set_pixmap (panel, pixmap)){
if (panel->back_pixmap)
g_free (panel->back_pixmap);
......@@ -3149,6 +3173,7 @@ panel_widget_change_orient(PanelWidget *panel,
orient,
panel->snapped,
panel->mode,
panel->fit_pixmap_bg,
panel->state,
panel->drawer_drop_zone_pos,
panel->back_pixmap);
......@@ -3162,6 +3187,7 @@ panel_widget_change_drop_zone_pos(PanelWidget *panel,
panel->orient,
panel->snapped,
panel->mode,
panel->fit_pixmap_bg,
panel->state,
drop_zone_pos,
panel->back_pixmap);
......
......@@ -96,6 +96,7 @@ struct _PanelWidget
PanelSnapped snapped;
PanelMode mode;
PanelState state;
gboolean fit_pixmap_bg;
gint leave_notify_timer_tag;
......@@ -142,11 +143,11 @@ GtkWidget* panel_widget_new (gint size,
PanelOrientation orient,
PanelSnapped snapped,
PanelMode mode,
gboolean fit_pixmap_bg,
PanelState state,
gint pos_x,
gint pos_y,
DrawerDropZonePos
drop_zone_pos,
DrawerDropZonePos drop_zone_pos,
char *back_pixmap,
GdkColor *back_color);
......@@ -209,6 +210,7 @@ void panel_widget_change_params (PanelWidget *panel,
PanelOrientation orient,
PanelSnapped snapped,
PanelMode mode,
gboolean fit_pixmap_bg,
PanelState state,
DrawerDropZonePos
drop_zone_pos,
......
......@@ -190,6 +190,7 @@ save_panel_configuration(gpointer data, gpointer user_data)
gnome_config_set_int("orient",panel->orient);
gnome_config_set_int("snapped", panel->snapped);
gnome_config_set_int("mode", panel->mode);
gnome_config_set_bool("fit_pixmap_bg", panel->fit_pixmap_bg);
gnome_config_set_int("state", panel->state);
gnome_config_set_int("size", panel->size);
......
......@@ -35,6 +35,7 @@ typedef struct {
PanelSnapped snapped;
PanelMode mode;
gint pixmap_enable;
gboolean fit_pixmap_bg;
GtkWidget *config_box;
} PanelConfig;
......
......@@ -90,6 +90,7 @@ config_apply (GtkWidget *widget, int page, gpointer data)
panel_config_struct.orient,
panel_config_struct.snapped,
panel_config_struct.mode,
panel_config_struct.fit_pixmap_bg,
panel->state,
panel->drawer_drop_zone_pos,
back_pixmap);
......@@ -224,7 +225,14 @@ set_pixmap_enable (GtkWidget *widget, gpointer data)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static void
set_fit_pixmap_bg (GtkToggleButton *toggle, gpointer data)
{
panel_config_struct.fit_pixmap_bg = toggle->active;
if (panel_config_struct.config_box)
gnome_property_box_changed (GNOME_PROPERTY_BOX (panel_config_struct.config_box));
}
static GtkWidget *
pixmap_page (PanelWidget *panel)
......@@ -244,6 +252,17 @@ pixmap_page (PanelWidget *panel)
box = gtk_vbox_new (0, 0);
gtk_container_border_width(GTK_CONTAINER (box), CONFIG_PADDING_SIZE);
gtk_container_add (GTK_CONTAINER (f), box);
w = gtk_check_button_new_with_label (_("Enable Background Image"));
/*always set to true, because in the beginning we don't have
any pixmap so it's not gonna be set by default anyhow*/
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_pixmap_enable),
file_entry);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
file_entry = gnome_file_entry_new ("pixmap", _("Browse"));
t = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (file_entry));
gtk_signal_connect (GTK_OBJECT (t), "changed",
......@@ -254,16 +273,14 @@ pixmap_page (PanelWidget *panel)
gtk_entry_set_text (GTK_ENTRY (t), panel->back_pixmap ?
panel->back_pixmap : "");
w = gtk_check_button_new_with_label (_("Enable Background Image"));
/*always set to true, because in the beginning we don't have
any pixmap so it's not gonna be set by default anyhow*/
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_pixmap_enable),
file_entry);
w = gtk_check_button_new_with_label (_("Scale image to fit panel"));
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), panel->fit_pixmap_bg);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (set_fit_pixmap_bg),
NULL);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,
CONFIG_PADDING_SIZE);
return vbox;
}
......
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