Link to common.la and not common.a.

2002-03-19  Richard Hestilow  <hestilow@ximian.com>

	* configure.in (COMMON_LIBS): Link to common.la and not common.a.
This commit is contained in:
Richard Hestilow 2002-03-20 03:30:11 +00:00 committed by Rachel Hestilow
parent a63409393b
commit be50597a25
21 changed files with 1261 additions and 561 deletions

View file

@ -1,3 +1,7 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* configure.in (COMMON_LIBS): Link to common.la and not common.a.
Sun Mar 17 23:26:02 2002 Jonathan Blandford <jrb@gnome.org>
* capplets/keybindings/eggcellrendererkeys.[ch]: sync to CVS.

View file

@ -1,3 +1,19 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* background-properties-capplet.c:
(everywhere): Use an ApplierSet instead of passing around
BGPreferences.
(real_realize_cb): Call applier_set_redraw.
(peditor_value_changed): Merge entry in set->prefs,
and call applier_set_redraw if realized. Also, hide the second
color option if shading type is solid.
(setup_dialog): Set data for the second color selector.
Also, update peditors for new UI.
(create_dialog): Add previews and labels to radio buttons.
(main): Create applier set. Also, connect to DnD signals.
* background-properties.glade: Implement seth's new UI.
2002-03-17 Jonathan Blandford <set EMAIL_ADDRESS environment variable>
reviewed by: <delete if not using a buddy>

View file

@ -31,6 +31,7 @@
#include <gnome.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
#include <libgnomevfs/gnome-vfs.h>
#include "capplet-util.h"
#include "gconf-property-editor.h"
@ -38,6 +39,75 @@
#include "preview-file-selection.h"
#include "activate-settings-daemon.h"
enum
{
TARGET_URI_LIST
};
static GtkTargetEntry drop_types[] =
{
{"text/uri-list", 0, TARGET_URI_LIST}
};
static gint n_drop_types = sizeof (drop_types) / sizeof (GtkTargetEntry);
static const int n_enum_vals = WPTYPE_NONE + 1;
typedef struct
{
BGApplier** appliers;
BGPreferences *prefs;
} ApplierSet;
/* Create a new set of appliers, and load the default preferences */
static ApplierSet*
applier_set_new (void)
{
int i;
ApplierSet *set = g_new0 (ApplierSet, 1);
set->appliers = g_new0 (BGApplier*, n_enum_vals);
for (i = 0; i < n_enum_vals; i++)
set->appliers[i] = BG_APPLIER (bg_applier_new (BG_APPLIER_PREVIEW));
set->prefs = BG_PREFERENCES (bg_preferences_new ());
bg_preferences_load (set->prefs);
return set;
}
/* Destroy all prefs/appliers in set, and free structure */
static void
applier_set_free (ApplierSet *set)
{
int i;
g_return_if_fail (set != NULL);
for (i = 0; i < n_enum_vals; i++)
g_object_unref (G_OBJECT (set->appliers[i]));
g_free (set->appliers);
g_object_unref (G_OBJECT (set->prefs));
}
/* Trigger a redraw in each applier in the set */
static void
applier_set_redraw (ApplierSet *set)
{
int i;
g_return_if_fail (set != NULL);
for (i = 0; i < n_enum_vals; i++)
{
set->prefs->wallpaper_enabled = TRUE;
set->prefs->wallpaper_type = i;
bg_applier_apply_prefs (set->appliers[i], set->prefs);
}
}
/* Retrieve legacy gnome_config settings and store them in the GConf
* database. This involves some translation of the settings' meanings.
*/
@ -117,6 +187,26 @@ get_legacy_settings (void)
gnome_config_pop_prefix ();
}
/* Show/hide the secondary color options if needed */
static void
update_secondary_color_visibility (ApplierSet *set, const gchar *value_str)
{
gboolean enable;
GtkWidget *color_frame;
g_return_if_fail (set != NULL);
g_return_if_fail (value_str != NULL);
enable = strcmp (value_str, "solid");
color_frame = g_object_get_data (G_OBJECT (set->prefs), "color2-box");
if (enable)
gtk_widget_show (color_frame);
else
gtk_widget_hide (color_frame);
}
/* Initial apply to the preview, and setting of the color frame's sensitivity.
*
* We use a double-delay mechanism: first waiting 100 ms, then working in an
@ -126,38 +216,35 @@ get_legacy_settings (void)
*/
static gboolean
real_realize_cb (BGPreferences *prefs)
real_realize_cb (ApplierSet *set)
{
GtkWidget *color_frame;
BGApplier *bg_applier;
g_return_val_if_fail (prefs != NULL, TRUE);
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), TRUE);
g_return_val_if_fail (set != NULL, TRUE);
if (G_OBJECT (prefs)->ref_count == 0)
if (G_OBJECT (set->prefs)->ref_count == 0)
return FALSE;
bg_applier = g_object_get_data (G_OBJECT (prefs), "applier");
color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame");
bg_applier_apply_prefs (bg_applier, prefs);
gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (bg_applier, prefs));
color_frame = g_object_get_data (G_OBJECT (set->prefs), "color-frame");
applier_set_redraw (set);
gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (set->appliers[0], set->prefs));
return FALSE;
}
static gboolean
realize_2_cb (BGPreferences *prefs)
realize_2_cb (ApplierSet *set)
{
gtk_idle_add ((GtkFunction) real_realize_cb, prefs);
gtk_idle_add ((GtkFunction) real_realize_cb, set);
return FALSE;
}
static void
realize_cb (GtkWidget *widget, BGPreferences *prefs)
realize_cb (GtkWidget *widget, ApplierSet *set)
{
gtk_timeout_add (100, (GtkFunction) realize_2_cb, prefs);
gtk_idle_add ((GtkFunction) real_realize_cb, set);
gtk_timeout_add (100, (GtkFunction) realize_2_cb, set);
}
/* Callback issued when some value changes in a property editor. This merges the
@ -169,35 +256,28 @@ realize_cb (GtkWidget *widget, BGPreferences *prefs)
*/
static void
peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, BGPreferences *prefs)
peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, ApplierSet *set)
{
GConfEntry *entry;
BGApplier *bg_applier;
GtkWidget *color_frame;
entry = gconf_entry_new (key, value);
bg_preferences_merge_entry (prefs, entry);
bg_preferences_merge_entry (set->prefs, entry);
gconf_entry_free (entry);
bg_applier = g_object_get_data (G_OBJECT (prefs), "applier");
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (bg_applier)))
bg_applier_apply_prefs (bg_applier, BG_PREFERENCES (prefs));
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (set->appliers[n_enum_vals - 1])))
applier_set_redraw (set);
if (!strcmp (key, BG_PREFERENCES_PICTURE_FILENAME) ||
!strcmp (key, BG_PREFERENCES_PICTURE_OPTIONS))
{
color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame");
gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (bg_applier, prefs));
color_frame = g_object_get_data (G_OBJECT (set->prefs), "color-frame");
gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (set->appliers[0], set->prefs));
}
else if (!strcmp (key, BG_PREFERENCES_COLOR_SHADING_TYPE))
{
update_secondary_color_visibility (set, gconf_value_get_string (value));
}
}
/* Returns the wallpaper enum set before we disabled it */
static int
get_val_true_cb (GConfPropertyEditor *peditor, gpointer data)
{
BGPreferences *prefs = (BGPreferences*) data;
return prefs->wallpaper_type;
}
/* Set up the property editors in the dialog. This also loads the preferences
@ -205,85 +285,97 @@ get_val_true_cb (GConfPropertyEditor *peditor, gpointer data)
*/
static void
setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, BGApplier *bg_applier)
setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, ApplierSet *set)
{
GObject *prefs;
GObject *peditor;
GConfClient *client;
gchar *color_option;
/* Override the enabled setting to make sure background is enabled */
client = gconf_client_get_default ();
gconf_client_set_bool (client, BG_PREFERENCES_DRAW_BACKGROUND, TRUE, NULL);
/* Load preferences */
prefs = bg_preferences_new ();
bg_preferences_load (BG_PREFERENCES (prefs));
/* We need to be able to retrieve the applier and the color frame in
/* We need to be able to retrieve the color frame in
callbacks */
g_object_set_data (prefs, "color-frame", WID ("color_frame"));
g_object_set_data (prefs, "applier", bg_applier);
g_object_set_data (G_OBJECT (set->prefs), "color-frame", WID ("color_vbox"));
g_object_set_data (G_OBJECT (set->prefs), "color2-box", WID ("color2_box"));
peditor = gconf_peditor_new_select_menu_with_enum
(changeset, BG_PREFERENCES_COLOR_SHADING_TYPE, WID ("color_option"), bg_preferences_orientation_get_type (), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
(changeset, BG_PREFERENCES_COLOR_SHADING_TYPE, WID ("border_shading"), bg_preferences_orientation_get_type (), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, set);
peditor = gconf_peditor_new_color
(changeset, BG_PREFERENCES_PRIMARY_COLOR, WID ("colorpicker1"), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
(changeset, BG_PREFERENCES_PRIMARY_COLOR, WID ("color1"), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, set);
peditor = gconf_peditor_new_color
(changeset, BG_PREFERENCES_SECONDARY_COLOR, WID ("colorpicker2"), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
peditor = gconf_peditor_new_filename
(changeset, BG_PREFERENCES_PICTURE_FILENAME, WID ("image_fileentry"), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
peditor = gconf_peditor_new_select_menu_with_enum
(changeset, BG_PREFERENCES_PICTURE_OPTIONS, WID ("image_option"), bg_preferences_wptype_get_type (), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
peditor = gconf_peditor_new_enum_toggle
(changeset, BG_PREFERENCES_PICTURE_OPTIONS, WID ("picture_enabled_check"), bg_preferences_wptype_get_type (), get_val_true_cb, WPTYPE_NONE, prefs, NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("picture_frame"));
(changeset, BG_PREFERENCES_SECONDARY_COLOR, WID ("color2"), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, set);
peditor = gconf_peditor_new_image
(changeset, BG_PREFERENCES_PICTURE_FILENAME, WID ("background_image_button"), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, set);
peditor = gconf_peditor_new_select_radio_with_enum
(changeset, BG_PREFERENCES_PICTURE_OPTIONS, gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("radiobutton1"))), bg_preferences_wptype_get_type (), NULL);
g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, set);
/* Make sure preferences get applied to the preview */
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (bg_applier)))
bg_applier_apply_prefs (bg_applier, BG_PREFERENCES (prefs));
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (set->appliers[n_enum_vals - 1])))
applier_set_redraw (set);
else
g_signal_connect_after (G_OBJECT (bg_applier_get_preview_widget (bg_applier)), "realize",
(GCallback) realize_cb, prefs);
preview_file_selection_hookup_file_entry (GNOME_FILE_ENTRY (WID ("image_fileentry")), _("Please select a background image"));
/* Make sure the preferences object gets destroyed when the dialog is
closed */
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, prefs);
g_signal_connect_after (G_OBJECT (bg_applier_get_preview_widget (set->appliers[n_enum_vals - 1])),
"realize", (GCallback) realize_cb, set);
color_option = gconf_client_get_string (gconf_client_get_default (),
BG_PREFERENCES_COLOR_SHADING_TYPE,
NULL);
update_secondary_color_visibility (set, color_option);
g_free (color_option);
}
/* Construct the dialog */
static GladeXML *
create_dialog (BGApplier *bg_applier)
create_dialog (ApplierSet *set)
{
GtkWidget *holder;
GtkWidget *widget;
GladeXML *dialog;
GSList *group;
int i;
const gchar *labels[] = { N_("Wallpaper"), N_("Centered"), N_("Scaled"), N_("Stretched"), N_("No Picture") };
/* FIXME: What the hell is domain? */
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/background-properties.glade", "prefs_widget", NULL);
widget = glade_xml_get_widget (dialog, "prefs_widget");
/* Minor GUI addition */
holder = WID ("prefs_widget");
gtk_box_pack_start (GTK_BOX (holder), bg_applier_get_preview_widget (bg_applier), TRUE, TRUE, 0);
gtk_widget_show_all (holder);
g_object_weak_ref (G_OBJECT (widget), (GWeakNotify) g_object_unref, dialog);
/* Set up the applier buttons */
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("radiobutton1")));
group = g_slist_copy (group);
group = g_slist_reverse (group);
for (i = 0; group && i < n_enum_vals; i++, group = group->next)
{
GtkWidget *w = GTK_WIDGET (group->data);
GtkWidget *vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_widget_destroy (GTK_BIN (w)->child);
gtk_container_add (GTK_CONTAINER (w), vbox);
gtk_box_pack_start (GTK_BOX (vbox),
bg_applier_get_preview_widget (set->appliers[i]),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new (gettext (labels[i])),
FALSE, FALSE, 0);
gtk_widget_show_all (vbox);
}
g_slist_free (group);
return dialog;
}
@ -299,14 +391,75 @@ dialog_button_clicked_cb (GtkDialog *dialog, gint response_id, GConfChangeSet *c
}
}
/* Callback issued during drag movements */
static gboolean
drag_motion_cb (GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time, gpointer data)
{
return FALSE;
}
/* Callback issued during drag leaves */
static void
drag_leave_cb (GtkWidget *widget, GdkDragContext *context,
guint time, gpointer data)
{
gtk_widget_queue_draw (widget);
}
/* Callback issued on actual drops. Attempts to load the file dropped. */
static void
drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
gint x, gint y,
GtkSelectionData *selection_data,
guint info, guint time, gpointer data)
{
GList *list;
GList *uris;
ApplierSet *set = (ApplierSet*) data;
if (info != TARGET_URI_LIST)
return;
uris = gnome_vfs_uri_list_parse ((gchar *) selection_data->
data);
for (list = uris; list; list = list->next)
{
GnomeVFSURI *uri = (GnomeVFSURI *) list->data;
GConfEntry *entry;
GConfValue *value = gconf_value_new (GCONF_VALUE_STRING);
GConfClient *client = gconf_client_get_default ();
gconf_value_set_string (value, gnome_vfs_uri_get_path (uri));
/* Hmm, should we bother with changeset here? */
gconf_client_set (client, BG_PREFERENCES_PICTURE_FILENAME, value, NULL);
gconf_client_suggest_sync (client, NULL);
/* this isn't emitted by the peditors,
* so we have to manually update */
entry = gconf_entry_new (BG_PREFERENCES_PICTURE_FILENAME, value);
bg_preferences_merge_entry (set->prefs, entry);
gconf_entry_free (entry);
gconf_value_free (value);
}
if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (set->appliers[n_enum_vals - 1])))
applier_set_redraw (set);
gnome_vfs_uri_list_free (uris);
}
int
main (int argc, char **argv)
{
GConfClient *client;
GConfChangeSet *changeset;
GladeXML *dialog;
GtkWidget *dialog_win;
GObject *bg_applier;
ApplierSet *set;
static gboolean get_legacy;
static struct poptOption cap_options[] = {
@ -331,9 +484,9 @@ main (int argc, char **argv)
if (get_legacy) {
get_legacy_settings ();
} else {
bg_applier = bg_applier_new (BG_APPLIER_PREVIEW);
dialog = create_dialog (BG_APPLIER (bg_applier));
setup_dialog (dialog, NULL, BG_APPLIER (bg_applier));
set = applier_set_new ();
dialog = create_dialog (set);
setup_dialog (dialog, NULL, set);
dialog_win = gtk_dialog_new_with_buttons
(_("Background properties"), NULL, -1,
@ -342,12 +495,22 @@ main (int argc, char **argv)
g_signal_connect (G_OBJECT (dialog_win), "response", (GCallback) dialog_button_clicked_cb, NULL);
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) g_object_unref, bg_applier);
gtk_drag_dest_set (dialog_win, GTK_DEST_DEFAULT_ALL,
drop_types, n_drop_types,
GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE);
g_signal_connect (G_OBJECT (dialog_win), "drag-motion",
G_CALLBACK (drag_motion_cb), NULL);
g_signal_connect (G_OBJECT (dialog_win), "drag-leave",
G_CALLBACK (drag_leave_cb), NULL);
g_signal_connect (G_OBJECT (dialog_win), "drag-data-received",
G_CALLBACK (drag_data_received_cb),
set);
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) applier_set_free, set);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
gtk_widget_show_all (dialog_win);
gtk_widget_show (dialog_win);
gtk_main ();
gconf_change_set_unref (changeset);
}
return 0;

View file

@ -1,382 +1,597 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd" >
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome" />
<requires lib="gnome"/>
<widget class="GtkWindow" id="window1">
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="modal">no</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">yes</property>
<property name="visible">no</property>
<property name="window-position">GTK_WIN_POS_NONE</property>
<widget class="GtkWindow" id="background_preference_window">
<property name="title" translatable="yes">Background Properties</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<child>
<widget class="GtkVBox" id="prefs_widget">
<property name="border_width">4</property>
<property name="homogeneous">no</property>
<property name="spacing">0</property>
<property name="visible">yes</property>
<child>
<widget class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">True</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="tab_hborder">2</property>
<property name="tab_vborder">2</property>
<property name="enable_popup">False</property>
<child>
<widget class="GtkFrame" id="picture_frame">
<property name="border_width">4</property>
<property name="label" translatable="yes">Background picture</property>
<property name="label_xalign">0</property>
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
<property name="visible">yes</property>
<child>
<widget class="GtkVBox" id="prefs_widget">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table1">
<property name="border_width">10</property>
<property name="homogeneous">no</property>
<property name="row_spacing">10</property>
<property name="column_spacing">3</property>
<property name="n-rows">2</property>
<property name="n-columns">2</property>
<property name="visible">yes</property>
<child>
<widget class="GtkVBox" id="vbox9">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label14">
<property name="label" translatable="yes">Image:</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">no</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="visible">yes</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">15</property>
<child>
<widget class="GtkLabel" id="label15">
<property name="label" translatable="yes">Style:</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">no</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="visible">yes</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame6">
<property name="visible">True</property>
<property name="label" translatable="yes">Picture:</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="xalign">7.45058e-09</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">1</property>
<property name="visible">yes</property>
<child>
<widget class="GtkButton" id="background_image_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<child>
<widget class="GtkOptionMenu" id="image_option">
<property name="can_focus">yes</property>
<property name="history">0</property>
<property name="visible">yes</property>
<child>
<widget class="GtkVBox" id="vbox21">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">yes</property>
<child>
<widget class="GtkImage" id="background_image_preview">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget2">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="image_filename_label">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkAccelLabel" id="convertwidget6">
<property name="label" translatable="yes">Tiled</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget2</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkVBox" id="vbox15">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkMenuItem" id="convertwidget3">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="label39">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAccelLabel" id="convertwidget7">
<property name="label" translatable="yes">Centered</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget3</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="label" translatable="yes">You can drag image files
into the window to set the
background picture.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget4">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="label38">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkAccelLabel" id="convertwidget8">
<property name="label" translatable="yes">Scaled (keep aspect ratio)</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget4</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkVBox" id="color_vbox">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkMenuItem" id="convertwidget5">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="border_shading_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Border the picture with a:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">7.45058e-09</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAccelLabel" id="convertwidget9">
<property name="label" translatable="yes">Stretched</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget5</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GnomeFileEntry" id="image_fileentry">
<property name="modal">no</property>
<property name="directory_entry">no</property>
<property name="visible">yes</property>
<child>
<widget class="GtkVBox" id="vbox23">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="entry">
<widget class="GtkEntry" id="entry1">
<property name="can_focus">yes</property>
<property name="editable">yes</property>
<property name="text" translatable="yes"></property>
<property name="max-length">0</property>
<property name="visibility">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="border_shading">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child>
<widget class="GtkFrame" id="color_frame">
<property name="border_width">4</property>
<property name="label" translatable="yes">Background colors</property>
<property name="label_xalign">0</property>
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
<property name="visible">yes</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">True</property>
<child>
<widget class="GtkHBox" id="hbox4">
<property name="border_width">10</property>
<property name="homogeneous">no</property>
<property name="spacing">8</property>
<property name="visible">yes</property>
<child>
<widget class="GtkMenuItem" id="convertwidget2">
<property name="visible">True</property>
<property name="label" translatable="yes">Solid color</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label19">
<property name="label" translatable="yes">Style:</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">no</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="visible">yes</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
</packing>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget3">
<property name="visible">True</property>
<property name="label" translatable="yes">Horizontal gradient</property>
</widget>
</child>
<child>
<widget class="GtkOptionMenu" id="color_option">
<property name="can_focus">yes</property>
<property name="history">0</property>
<property name="visible">yes</property>
<child>
<widget class="GtkMenuItem" id="convertwidget4">
<property name="visible">True</property>
<property name="label" translatable="yes">Vertical gradient</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget10">
<property name="visible">yes</property>
<child>
<widget class="GtkHBox" id="color_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkMenuItem" id="convertwidget11">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="label40">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAccelLabel" id="convertwidget14">
<property name="label" translatable="yes">Solid color</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget11</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkHBox" id="color1_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">3</property>
<child>
<widget class="GtkMenuItem" id="convertwidget12">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="color1_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Primary Color</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAccelLabel" id="convertwidget15">
<property name="label" translatable="yes">Horizontal gradient</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget12</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GnomeColorPicker" id="color1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget13">
<property name="visible">yes</property>
<child>
<widget class="GtkHBox" id="color2_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">3</property>
<child>
<widget class="GtkAccelLabel" id="convertwidget16">
<property name="label" translatable="yes">Vertical gradient</property>
<property name="xalign">0.0</property>
<property name="accel-widget">convertwidget13</property>
<property name="use-underline">yes</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="color2_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Secondary Color</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GnomeColorPicker" id="colorpicker1">
<property name="can_focus">yes</property>
<property name="dither">yes</property>
<property name="use_alpha">no</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="visible">yes</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
</packing>
</child>
<child>
<widget class="GnomeColorPicker" id="color2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GnomeColorPicker" id="colorpicker2">
<property name="can_focus">yes</property>
<property name="dither">yes</property>
<property name="use_alpha">no</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="visible">yes</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame5">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Picture Options:</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkVBox" id="vbox14">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkHBox" id="hbox16">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkRadioButton" id="radiobutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">radiobutton1</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">radiobutton2</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">False</property>
<property name="group">radiobutton1</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">radiobutton3</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">False</property>
<property name="group">radiobutton1</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">radiobutton4</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">False</property>
<property name="group">radiobutton1</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">radiobutton5</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">False</property>
<property name="group">radiobutton1</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="label" translatable="yes">E-Mail</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
</child>
</widget>
<child>
<widget class="GtkCheckButton" id="picture_enabled_check">
<property name="can_focus">yes</property>
<property name="label" translatable="yes">Use a picture for the background</property>
<property name="active">no</property>
<property name="draw_indicator">yes</property>
<property name="visible">yes</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -1,3 +1,17 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* Makefile.am: Include libbackground (used for preview-file-selector).
Change into a libtool library so we can link against libbackground.
* gconf-property-editor.c:
(peditor_enum_int_from_string): Added argument use_nick; set to true
if the string was a nick.
(peditor_enum_string_from_int): Use nick only if use_nick is true.
(gconf_peditor_new_image): Added.
(gconf_peditor_new_select_radio_with_enum): Added.
(peditor_select_radio_value_changed): Reverse radio group.
(peditor_select_radio_widget_changed): Reverse radio group.
2002-03-17 Kjartan Maraas <kmaraas@gnome.org>
* activate-settings-daemon.c: Mark a string. #include <config.h>

View file

@ -5,13 +5,17 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DG_LOG_DOMAIN=\"capplet-common\" \
-I$(top_srcdir)/ \
-I$(top_srcdir)/libbackground \
@CAPPLET_CFLAGS@
noinst_LIBRARIES = libcommon.a
noinst_LTLIBRARIES = libcommon.la
libcommon_a_SOURCES = \
libcommon_la_SOURCES = \
activate-settings-daemon.c activate-settings-daemon.h \
capplet-util.c capplet-util.h \
gconf-property-editor.c gconf-property-editor.h \
gconf-property-editor-marshal.c gconf-property-editor-marshal.h \
theme-common.c theme-common.h
libcommon_la_LIBADD = $(top_builddir)/libbackground/libbackground.la

View file

@ -31,6 +31,8 @@
#include "gconf-property-editor.h"
#include "gconf-property-editor-marshal.h"
#include "preview-file-selection.h"
enum {
VALUE_CHANGED,
LAST_SIGNAL
@ -71,6 +73,7 @@ typedef struct
GConfPEditorGetValueFn enum_val_true_fn;
gpointer enum_val_true_fn_data;
guint enum_val_false;
gboolean use_nick;
} GConfPropertyEditorEnumData;
static guint peditor_signals[LAST_SIGNAL];
@ -660,16 +663,23 @@ gconf_peditor_new_color (GConfChangeSet *changeset,
}
static int
peditor_enum_int_from_string (GType type, const gchar *str)
peditor_enum_int_from_string (GType type, const gchar *str, gboolean *use_nick)
{
GEnumClass *klass;
GEnumValue *val;
int ret = -1;
if (use_nick)
*use_nick = FALSE;
klass = g_type_class_ref (type);
val = g_enum_get_value_by_name (klass, str);
if (!val)
{
val = g_enum_get_value_by_nick (klass, str);
if (use_nick)
*use_nick = TRUE;
}
if (val)
ret = val->value;
@ -679,7 +689,7 @@ peditor_enum_int_from_string (GType type, const gchar *str)
}
static gchar*
peditor_enum_string_from_int (GType type, const int index)
peditor_enum_string_from_int (GType type, const int index, gboolean use_nick)
{
GEnumClass *klass;
GEnumValue *val;
@ -689,10 +699,10 @@ peditor_enum_string_from_int (GType type, const int index)
val = g_enum_get_value (klass, index);
if (val)
{
if (val->value_name)
ret = g_strdup (val->value_name);
else
if (val->value_nick && use_nick)
ret = g_strdup (val->value_nick);
else
ret = g_strdup (val->value_name);
}
g_type_class_unref (klass);
@ -714,7 +724,8 @@ peditor_enum_conv_to_widget (GConfPropertyEditor *peditor,
ret = gconf_value_new (GCONF_VALUE_INT);
index = peditor_enum_int_from_string (data->enum_type,
gconf_value_get_string (value));
gconf_value_get_string (value),
&data->use_nick);
gconf_value_set_int (ret, index);
@ -734,7 +745,8 @@ peditor_enum_conv_from_widget (GConfPropertyEditor *peditor,
ret = gconf_value_new (GCONF_VALUE_STRING);
str = peditor_enum_string_from_int (data->enum_type,
gconf_value_get_int (value));
gconf_value_get_int (value),
data->use_nick);
gconf_value_set_string (ret, str);
g_free (str);
@ -864,7 +876,7 @@ peditor_select_radio_value_changed (GConfClient *client,
GConfEntry *entry,
GConfPropertyEditor *peditor)
{
GSList *group;
GSList *group, *link;
GConfValue *value, *value_wid;
if (peditor->p->changeset != NULL)
@ -874,11 +886,13 @@ peditor_select_radio_value_changed (GConfClient *client,
if (value != NULL) {
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control));
group = g_slist_nth (group, gconf_value_get_int (value_wid));
if (group && group->data)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group->data), TRUE);
group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
group = g_slist_reverse (group);
link = g_slist_nth (group, gconf_value_get_int (value_wid));
if (link && link->data)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (link->data), TRUE);
gconf_value_free (value_wid);
g_slist_free (group);
}
}
@ -893,7 +907,9 @@ peditor_select_radio_widget_changed (GConfPropertyEditor *peditor,
if (!tb->active) return;
value_wid = gconf_value_new (GCONF_VALUE_INT);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control));
group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
group = g_slist_reverse (group);
gconf_value_set_int (value_wid, g_slist_index (group, tb));
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
@ -902,6 +918,7 @@ peditor_select_radio_widget_changed (GConfPropertyEditor *peditor,
gconf_value_free (value_wid);
gconf_value_free (value);
g_slist_free (group);
}
GObject *
@ -1021,7 +1038,7 @@ guard_get_bool (GConfPropertyEditor *peditor, const GConfValue *value)
else
{
GConfPropertyEditorEnumData *data = peditor->p->data;
int index = peditor_enum_int_from_string (data->enum_type, gconf_value_get_string (value));
int index = peditor_enum_int_from_string (data->enum_type, gconf_value_get_string (value), &data->use_nick);
return (index != data->enum_val_false);
}
}
@ -1187,7 +1204,8 @@ peditor_enum_toggle_conv_to_widget (GConfPropertyEditor *peditor,
ret = gconf_value_new (GCONF_VALUE_BOOL);
index = peditor_enum_int_from_string (data->enum_type,
gconf_value_get_string (value));
gconf_value_get_string (value),
&data->use_nick);
gconf_value_set_bool (ret, (index != data->enum_val_false));
return ret;
@ -1211,7 +1229,7 @@ peditor_enum_toggle_conv_from_widget (GConfPropertyEditor *peditor,
else
index = data->enum_val_false;
str = peditor_enum_string_from_int (data->enum_type, index);
str = peditor_enum_string_from_int (data->enum_type, index, data->use_nick);
gconf_value_set_string (ret, str);
g_free (str);
@ -1271,3 +1289,259 @@ gconf_peditor_new_enum_toggle (GConfChangeSet *changeset,
return G_OBJECT (peditor);
}
gboolean
peditor_image_set_filename (GConfPropertyEditor *peditor, const gchar *filename)
{
GdkPixbuf *pixbuf = NULL;
GdkPixbuf *scaled;
GtkImage *image = NULL;
const int scale = 100;
gchar *message = NULL;
GList *l;
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
{
message = g_strdup_printf (_("Couldn't find the file '%s'.\n\nPlease make "
"sure it exists and try again, "
"or choose a different background picture."),
filename);
}
else if (!(pixbuf = gdk_pixbuf_new_from_file (filename, NULL)))
{
message = g_strdup_printf (_("I don't know how to open the file '%s'.\n"
"Perhaps it's "
"a kind of picture that is not yet supported.\n\n"
"Please select a different picture instead."),
filename);
}
if (message)
{
GtkWidget *box;
box = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
message);
gtk_dialog_run (GTK_DIALOG (box));
gtk_widget_destroy (box);
g_free (message);
return FALSE;
}
scaled = preview_file_selection_intelligent_scale (pixbuf,
scale);
if (GTK_IS_IMAGE (GTK_BIN (peditor->p->ui_control)->child))
image = GTK_IMAGE (GTK_BIN (peditor->p->ui_control)->child);
else
{
for (l = gtk_container_get_children (GTK_CONTAINER (GTK_BIN (peditor->p->ui_control)->child)); l != NULL; l = l->next)
{
if (GTK_IS_IMAGE (l->data))
image = GTK_IMAGE (l->data);
else if (GTK_IS_LABEL (l->data))
{
gchar *base = g_path_get_basename (filename);
gtk_label_set_text (GTK_LABEL (l->data), base);
g_free (base);
}
}
}
gtk_image_set_from_pixbuf (image, scaled);
g_object_unref (G_OBJECT (pixbuf));
g_object_unref (G_OBJECT (scaled));
return TRUE;
}
void
peditor_image_fsel_ok_cb (GtkFileSelection *fsel, gpointer data)
{
GConfValue *value, *value_wid;
GConfPropertyEditor *peditor;
const gchar *filename;
peditor = g_object_get_data (G_OBJECT (fsel), "peditor");
if (!peditor->p->inited)
return;
filename = gtk_file_selection_get_filename (fsel);
if (!(filename && peditor_image_set_filename (peditor, filename)))
return;
value_wid = gconf_value_new (GCONF_VALUE_STRING);
gconf_value_set_string (value_wid, gtk_file_selection_get_filename (fsel));
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
peditor_set_gconf_value (peditor, peditor->p->key, value);
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
gconf_value_free (value_wid);
gconf_value_free (value);
gtk_widget_destroy (GTK_WIDGET (fsel));
}
void
peditor_image_clicked_cb (GConfPropertyEditor *peditor, GtkButton *button)
{
GConfValue *value = NULL, *value_wid;
const gchar *filename;
GtkWidget *fsel;
fsel = preview_file_selection_new (_("Please select an image."), TRUE);
/* need the current filename */
if (peditor->p->changeset)
gconf_change_set_check_value (peditor->p->changeset, peditor->p->key, &value);
if (value)
{
/* the one we got is not a copy */
value = gconf_value_copy (value);
}
else
{
GConfClient *client = gconf_client_get_default ();
value = gconf_client_get (client, peditor->p->key, NULL);
}
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
filename = gconf_value_get_string (value_wid);
if (filename && strcmp (filename, ""))
gtk_file_selection_set_filename (GTK_FILE_SELECTION (fsel), filename);
g_object_set_data (G_OBJECT (fsel), "peditor", peditor);
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (fsel)->ok_button),
"clicked",
(GCallback) peditor_image_fsel_ok_cb,
fsel);
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (fsel)->cancel_button),
"clicked",
(GCallback) gtk_widget_destroy,
fsel);
if (gtk_grab_get_current ())
gtk_grab_add (fsel);
gtk_widget_show (fsel);
gconf_value_free (value);
gconf_value_free (value_wid);
}
static void
peditor_image_value_changed (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
GConfPropertyEditor *peditor)
{
GConfValue *value, *value_wid;
if (peditor->p->changeset != NULL)
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
value = gconf_entry_get_value (entry);
if (value != NULL) {
const gchar *filename;
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
filename = gconf_value_get_string (value_wid);
peditor_image_set_filename (peditor, filename);
gconf_value_free (value_wid);
}
}
GObject *
gconf_peditor_new_image (GConfChangeSet *changeset,
gchar *key,
GtkWidget *button,
gchar *first_property_name,
...)
{
GObject *peditor;
va_list var_args;
g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (button != NULL, NULL);
g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
va_start (var_args, first_property_name);
peditor = gconf_peditor_new
(key,
(GConfClientNotifyFunc) peditor_image_value_changed,
changeset,
G_OBJECT (button),
first_property_name,
var_args, NULL);
va_end (var_args);
g_signal_connect_swapped (G_OBJECT (button), "clicked",
(GCallback) peditor_image_clicked_cb, peditor);
return peditor;
}
GObject *
gconf_peditor_new_select_radio_with_enum (GConfChangeSet *changeset,
gchar *key,
GSList *radio_group,
GType enum_type,
gchar *first_property_name,
...)
{
GConfPropertyEditor *peditor;
GConfPropertyEditorEnumData *enum_data;
GtkRadioButton *first_button;
GSList *item;
va_list var_args;
g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (radio_group != NULL, NULL);
g_return_val_if_fail (radio_group->data != NULL, NULL);
g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_group->data), NULL);
enum_data = g_new0 (GConfPropertyEditorEnumData, 1);
enum_data->enum_type = enum_type;
first_button = GTK_RADIO_BUTTON (radio_group->data);
va_start (var_args, first_property_name);
peditor = GCONF_PROPERTY_EDITOR (
gconf_peditor_new
(key,
(GConfClientNotifyFunc) peditor_select_radio_value_changed,
changeset,
G_OBJECT (first_button),
first_property_name,
var_args,
"conv-to-widget-cb",
peditor_enum_conv_to_widget,
"conv-from-widget-cb",
peditor_enum_conv_from_widget,
"data",
enum_data,
"data-free-cb",
g_free,
NULL));
va_end (var_args);
for (item = radio_group; item != NULL; item = item->next)
g_signal_connect_swapped (G_OBJECT (item->data), "toggled",
(GCallback) peditor_select_radio_widget_changed, peditor);
return G_OBJECT (peditor);
}

View file

@ -110,6 +110,14 @@ GObject *gconf_peditor_new_select_radio (GConfChangeSet *changeset,
GSList *radio_group,
gchar *first_property_name,
...);
GObject *gconf_peditor_new_select_radio_with_enum (GConfChangeSet *changeset,
gchar *key,
GSList *radio_group,
GType enum_type,
gchar *first_property_name,
...);
GObject *gconf_peditor_new_numeric_range (GConfChangeSet *changeset,
gchar *key,
GtkWidget *range,
@ -121,6 +129,12 @@ GObject *gconf_peditor_new_font (GConfChangeSet *changeset,
gchar *first_property_name,
...);
GObject *gconf_peditor_new_image (GConfChangeSet *changeset,
gchar *key,
GtkWidget *button,
gchar *first_property,
...);
void gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor,
GtkWidget *widget);

View file

@ -1,3 +1,12 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* gnome-keyboard-properties.c (bell_enums): Swap around. This
was initially reversed because of a bug in gconf-peditor.
Ideally this code should use the new enum functions, but
the existing stuff works so I so no immediate need to rewrite
it.
(*_to/from_widget): Convert to new signature.
2002-03-19 Lauris Kaplinski <lauris@ximian.com>
* gnome-keyboard-properties.c (bell_to_widget): Check that

View file

@ -53,7 +53,7 @@ create_dialog (void)
}
static GConfValue *
rate_to_widget (GConfValue *value)
rate_to_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
int rate;
@ -75,7 +75,7 @@ rate_to_widget (GConfValue *value)
}
static GConfValue *
rate_from_widget (GConfValue *value)
rate_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
static int rates[] = {
255, 192, 64, 1
@ -90,7 +90,7 @@ rate_from_widget (GConfValue *value)
}
static GConfValue *
delay_to_widget (GConfValue *value)
delay_to_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
int delay;
@ -112,7 +112,7 @@ delay_to_widget (GConfValue *value)
}
static GConfValue *
delay_from_widget (GConfValue *value)
delay_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
static int delays[] = {
1000, 700, 300, 0
@ -126,13 +126,13 @@ delay_from_widget (GConfValue *value)
}
static GConfEnumStringPair bell_enums[] = {
{ 0, "custom" },
{ 0, "off" },
{ 1, "on" },
{ 2, "off" }
{ 2, "custom" }
};
static GConfValue *
bell_from_widget (GConfValue *value)
bell_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
@ -144,7 +144,7 @@ bell_from_widget (GConfValue *value)
}
static GConfValue *
bell_to_widget (GConfValue *value)
bell_to_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
gint val = 2;
@ -162,7 +162,7 @@ bell_to_widget (GConfValue *value)
static GConfValue *
blink_from_widget (GConfValue *value)
blink_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
@ -173,7 +173,7 @@ blink_from_widget (GConfValue *value)
}
static GConfValue *
blink_to_widget (GConfValue *value)
blink_to_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
gint current_rate;

View file

@ -1,3 +1,7 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* gnome-ui-properties.c (*_to/from_widget): Convert to new signature.
2002-02-27 Kjartan Maraas <kmaraas@gnome.org>
* main.c: s/PACKAGE/GETTEXT_PACKAGE/g

View file

@ -43,7 +43,7 @@ static GConfEnumStringPair toolbar_style_enums[] = {
};
static GConfValue *
toolbar_from_widget (GConfValue *value)
toolbar_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
@ -55,7 +55,7 @@ toolbar_from_widget (GConfValue *value)
}
static GConfValue *
toolbar_to_widget (GConfValue *value)
toolbar_to_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
GConfValue *new_value;
gint val = 2;

View file

@ -92,7 +92,7 @@ dnl ==============================================
dnl Define the main variables
dnl ==============================================
COMMON_CFLAGS="-I\$(top_srcdir)/capplets/common"
COMMON_LIBS="\$(top_builddir)/capplets/common/libcommon.a"
COMMON_LIBS="\$(top_builddir)/capplets/common/libcommon.la"
EXTRA_CFLAGS="-I\$(top_srcdir)/ -DG_LOG_DOMAIN=\"\\\"\$(cappletname)-properties\\\"\" -DGNOMELOCALEDIR=\"\\\"${datadir}/locale\\\"\""

View file

@ -1,3 +1,23 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* preferences.h (wallpaper_type_t): Remove EMBOSSED since we
don't support it.
* preferences.c:
(_bg_wptype_values, _bg_orientation_values): Move name values
to nick, change name to "correct" form.
(read_wptype_from_string, bg_preferences_get_wptype_as_string):
Remove EMBOSSSED option.
* preview-file-selection.[ch]: Add function
preview_file_selection_intelligent_scale.
* applier.c: Change MONITOR_CONTENTS_WIDTH/HEIGHT to 64/48
(correct monitor ratio).
(bg_applier_apply_prefs): Disable wallpaper if WPTYPE_NONE.
(bg_applier_get_preview_widget): Create to WIDTH/HEIGHT.
(get_geometry): Remove reference to EMBOSSED.
2002-03-17 Darin Adler <darin@bentspoon.com>
* preferences.c: (bg_preferences_merge_entry):

View file

@ -38,10 +38,10 @@
#include "applier.h"
#define MONITOR_CONTENTS_X 20
#define MONITOR_CONTENTS_Y 10
#define MONITOR_CONTENTS_WIDTH 157
#define MONITOR_CONTENTS_HEIGHT 111
#define MONITOR_CONTENTS_X 0
#define MONITOR_CONTENTS_Y 0
#define MONITOR_CONTENTS_WIDTH 64
#define MONITOR_CONTENTS_HEIGHT 48
enum {
PROP_0,
@ -370,6 +370,12 @@ bg_applier_apply_prefs (BGApplier *bg_applier,
new_prefs = BG_PREFERENCES (bg_preferences_clone (prefs));
if (new_prefs->wallpaper_type == WPTYPE_NONE)
{
new_prefs->wallpaper_enabled = FALSE;
new_prefs->wallpaper_type = WPTYPE_CENTERED;
}
if (bg_applier->p->type == BG_APPLIER_ROOT && bg_applier->p->nautilus_running)
set_root_pixmap ((GdkPixmap *) -1);
@ -432,65 +438,13 @@ bg_applier_render_color_p (const BGApplier *bg_applier, const BGPreferences *pre
GtkWidget *
bg_applier_get_preview_widget (BGApplier *bg_applier)
{
GdkPixbuf *pixbuf;
GdkPixmap *pixmap;
GdkBitmap *mask;
GdkVisual *visual;
GdkColormap *colormap;
gchar *filename;
GdkGC *gc;
g_return_val_if_fail (bg_applier != NULL, NULL);
g_return_val_if_fail (IS_BG_APPLIER (bg_applier), NULL);
if (bg_applier->p->type != BG_APPLIER_PREVIEW)
return NULL;
if (bg_applier->p->preview_widget != NULL)
return bg_applier->p->preview_widget;
filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, "monitor.png", TRUE, NULL);
visual = gdk_drawable_get_visual (gdk_get_default_root_window ());
colormap = gdk_drawable_get_colormap (gdk_get_default_root_window ());
gtk_widget_push_colormap (colormap);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
if (pixbuf == NULL) return NULL;
pixmap = gdk_pixmap_new (gdk_get_default_root_window (),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
visual->depth);
mask = gdk_pixmap_new (gdk_get_default_root_window (),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
1);
gc = gdk_gc_new (gdk_get_default_root_window ());
gdk_pixbuf_render_threshold_alpha (pixbuf, mask,
0, 0, 0, 0,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
1);
gdk_gc_set_clip_mask (gc, mask);
gdk_pixbuf_render_to_drawable (pixbuf, pixmap, gc,
0, 0, 0, 0,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
GDK_RGB_DITHER_MAX, 0, 0);
bg_applier->p->preview_widget = gtk_image_new_from_pixmap (pixmap, mask);
gtk_widget_show (bg_applier->p->preview_widget);
g_object_unref (G_OBJECT (pixbuf));
g_free (filename);
gtk_widget_pop_colormap ();
if (bg_applier->p->preview_widget == NULL)
{
GdkPixmap *pixmap;
pixmap = gdk_pixmap_new (gdk_get_default_root_window (), MONITOR_CONTENTS_WIDTH, MONITOR_CONTENTS_HEIGHT, -1);
bg_applier->p->preview_widget = gtk_image_new_from_pixmap (pixmap, NULL);
}
return bg_applier->p->preview_widget;
}

View file

@ -45,19 +45,18 @@ static orientation_t read_orientation_from_string (gchar *string);
static wallpaper_type_t read_wptype_from_string (gchar *string);
static GEnumValue _bg_wptype_values[] = {
{ WPTYPE_TILED, "wallpaper", N_("Tiled") },
{ WPTYPE_CENTERED, "centered", N_("Centered") },
{ WPTYPE_SCALED, "scaled", N_("Scaled") },
{ WPTYPE_STRETCHED, "stretched", N_("Stretched") },
{ WPTYPE_EMBOSSED, "embossed", N_("Embossed") },
{ WPTYPE_NONE, "none", N_("None") },
{ WPTYPE_TILED, "WPTYPE_TILED", "wallpaper"},
{ WPTYPE_CENTERED, "WPTYPE_CENTERED", "centered"},
{ WPTYPE_SCALED, "WPTYPE_SCALED", "scaled"},
{ WPTYPE_STRETCHED, "WPTYPE_STRETCHED", "stretched"},
{ WPTYPE_NONE, "WPTYPE_NONE", "none"},
{ 0, NULL, NULL }
};
static GEnumValue _bg_orientation_values[] = {
{ ORIENTATION_SOLID, "solid", N_("Solid") },
{ ORIENTATION_HORIZ, "horizontal-gradient", N_("Horizontal Gradient") },
{ ORIENTATION_VERT, "vertical-gradient", N_("Vertical Gradient") },
{ ORIENTATION_SOLID, "ORIENTATION_SOLID", "solid"},
{ ORIENTATION_HORIZ, "ORIENTATION_HORIZ", "horizontal-gradient"},
{ ORIENTATION_VERT, "ORIENTATION_VERT", "vertical-gradient"},
{ 0, NULL, NULL }
};
@ -326,8 +325,6 @@ read_wptype_from_string (gchar *string)
type = WPTYPE_SCALED;
} else if (!strncmp (string, "stretched", sizeof ("stretched"))) {
type = WPTYPE_STRETCHED;
} else if (!strncmp (string, "embossed", sizeof ("embossed"))) {
type = WPTYPE_EMBOSSED;
}
g_free (string);
}
@ -384,8 +381,6 @@ bg_preferences_get_wptype_as_string (wallpaper_type_t wp)
return "scaled";
case WPTYPE_STRETCHED:
return "stretched";
case WPTYPE_EMBOSSED:
return "embossed";
case WPTYPE_NONE:
return "none";
case WPTYPE_UNSET:

View file

@ -52,7 +52,7 @@ typedef enum _orientation_t {
typedef enum _wallpaper_type_t {
WPTYPE_TILED = 0, WPTYPE_CENTERED, WPTYPE_SCALED,
WPTYPE_STRETCHED, WPTYPE_EMBOSSED, WPTYPE_NONE,
WPTYPE_STRETCHED, WPTYPE_NONE,
WPTYPE_UNSET
} wallpaper_type_t;

View file

@ -127,6 +127,35 @@ preview_file_selection_new (const gchar *title, gboolean do_preview)
NULL));
}
GdkPixbuf*
preview_file_selection_intelligent_scale (GdkPixbuf *buf, guint scale)
{
GdkPixbuf *scaled;
int w, h;
int ow = gdk_pixbuf_get_width (buf);
int oh = gdk_pixbuf_get_height (buf);
if (ow <= scale && oh <= scale)
scaled = gdk_pixbuf_ref (buf);
else
{
if (ow > oh)
{
w = scale;
h = scale * (((double)oh)/(double)ow);
}
else
{
h = scale;
w = scale * (((double)ow)/(double)ow);
}
scaled = gdk_pixbuf_scale_simple (buf, w, h, GDK_INTERP_BILINEAR);
}
return scaled;
}
static void
preview_file_selection_update (PreviewFileSelection *fsel, gpointer data)
{
@ -138,29 +167,7 @@ preview_file_selection_update (PreviewFileSelection *fsel, gpointer data)
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fsel));
if (filename && (buf = gdk_pixbuf_new_from_file (filename, NULL)))
{
GdkPixbuf *scaled;
int w, h;
int ow = gdk_pixbuf_get_width (buf);
int oh = gdk_pixbuf_get_height (buf);
if (ow <= SCALE && oh <= SCALE)
scaled = gdk_pixbuf_ref (buf);
else
{
if (ow > oh)
{
w = SCALE;
h = SCALE * (((double)oh)/(double)ow);
}
else
{
h = SCALE;
w = SCALE * (((double)ow)/(double)ow);
}
scaled = gdk_pixbuf_scale_simple (buf, w, h, GDK_INTERP_BILINEAR);
}
GdkPixbuf *scaled = preview_file_selection_intelligent_scale (buf, SCALE);
gtk_image_set_from_pixbuf (GTK_IMAGE (fsel->priv->preview),
scaled);
g_object_unref (scaled);

View file

@ -56,6 +56,8 @@ GtkWidget *preview_file_selection_new (const gchar *title, gboolean do_preview);
void preview_file_selection_hookup_file_entry (GnomeFileEntry *entry, const gchar *title);
GdkPixbuf* preview_file_selection_intelligent_scale (GdkPixbuf *pixbuf, guint scale);
G_END_DECLS
#endif /* __PREVIEW_FILE_SELECTION_H__ */

View file

@ -1,3 +1,7 @@
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* POTFILES.in: Add activate-settings-daemon.c.
2002-03-19 Ole Laursen <olau@hardworking.dk>
* da.po: Updated Danish translation.

View file

@ -4,6 +4,7 @@ capplets/background/background-properties-capplet.c
capplets/background/background-properties.glade
capplets/common/capplet-util.c
capplets/common/gconf-property-editor.c
capplets/common/activate-settings-daemon.c
capplets/default-applications/default-applications.desktop.in
capplets/default-applications/gnome-default-applications-properties.c
capplets/default-applications/gnome-default-applications-properties.glade