Backdrop settings interface
Benedikt Meurer
Benedikt.Meurer at unix-ag.uni-siegen.de
Wed Jun 4 12:09:03 CEST 2003
Hello,
I've made two small improvements to the "Backdrop settings" dialog.
1) Use an option menu instead of the radio buttons
2) Make the image frame insensitive, if the "Use color only" box
is checked
Here are two screenshots:
http://www.home.unix-ag.org/bmeurer/tmp/backdrop1.jpg
http://www.home.unix-ag.org/bmeurer/tmp/backdrop2.jpg
I'd like to commit the stuff, if nobody complains. The patch is quite
simple, and does not break any translations.
regards,
Benedikt
--
NetBSD Operating system: http://www.NetBSD.org/
pkgsrc "Work in progress": http://pkgsrc-wip.sf.net/
XFce desktop environment: http://www.xfce.org/
German Unix-AG Association: http://www.unix-ag.org/
-------------- next part --------------
Index: backdrop_settings.c
===================================================================
RCS file: /cvsroot/xfce/xfce-devel/xfdesktop/settings/backdrop_settings.c,v
retrieving revision 1.27
diff -u -r1.27 backdrop_settings.c
--- backdrop_settings.c 3 Jun 2003 19:59:53 -0000 1.27
+++ backdrop_settings.c 4 Jun 2003 10:08:31 -0000
@@ -84,6 +84,7 @@
GdkColor color;
GtkWidget *color_box;
GtkWidget *color_only_checkbox;
+ GtkWidget *image_frame;
GtkWidget *file_entry;
GtkWidget *edit_list_button;
@@ -408,6 +409,8 @@
{
showimage = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b)) ? 0 : 1;
+ gtk_widget_set_sensitive(bd->image_frame, showimage);
+
update_showimage(bd);
}
@@ -772,7 +775,7 @@
BackdropDialog *bd)
{
GtkWidget *hbox, *label, *rb_tiled, *rb_scaled, *rb_centered, *rb_auto;
- GtkRadioButton *rb;
+ GtkWidget *menu, *omenu;
hbox = gtk_hbox_new(FALSE, BORDER);
gtk_widget_show(hbox);
@@ -784,61 +787,39 @@
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- rb_tiled = gtk_radio_button_new_with_mnemonic (NULL, _("_Tiled"));
+ menu = gtk_menu_new();
+
+ rb_tiled = gtk_menu_item_new_with_mnemonic(_("_Tiled"));
gtk_widget_show(rb_tiled);
- gtk_box_pack_start (GTK_BOX (hbox), rb_tiled, FALSE, FALSE, 0);
-
- rb = GTK_RADIO_BUTTON(rb_tiled);
-
- rb_scaled = gtk_radio_button_new_with_mnemonic_from_widget(rb,
- _("_Scaled"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), rb_tiled);
+ g_signal_connect_swapped(rb_tiled, "activate",
+ G_CALLBACK(set_tiled), bd);
+
+ rb_scaled = gtk_menu_item_new_with_mnemonic(_("_Scaled"));
gtk_widget_show(rb_scaled);
- gtk_box_pack_start (GTK_BOX (hbox), rb_scaled, FALSE, FALSE, 0);
-
- rb_centered =
- gtk_radio_button_new_with_mnemonic_from_widget(rb, _("_Centered"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), rb_scaled);
+ g_signal_connect_swapped(rb_scaled, "activate",
+ G_CALLBACK(set_scaled), bd);
+
+ rb_centered = gtk_menu_item_new_with_mnemonic(_("_Centered"));
gtk_widget_show(rb_centered);
- gtk_box_pack_start (GTK_BOX (hbox), rb_centered, FALSE, FALSE, 0);
-
- rb_auto = gtk_radio_button_new_with_mnemonic_from_widget(rb,
- _("_Automatic"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), rb_centered);
+ g_signal_connect_swapped(rb_centered, "activate",
+ G_CALLBACK(set_centered), bd);
+
+ rb_auto = gtk_menu_item_new_with_mnemonic(_("_Auto"));
gtk_widget_show(rb_auto);
- gtk_box_pack_start (GTK_BOX (hbox), rb_auto, FALSE, FALSE, 0);
-
- bd->style_rb_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(rb_tiled));
-
- g_signal_connect_swapped(rb_tiled, "toggled",
- G_CALLBACK(set_tiled), bd);
- g_signal_connect_swapped(rb_scaled, "toggled",
- G_CALLBACK(set_scaled), bd);
- g_signal_connect_swapped(rb_centered, "toggled",
- G_CALLBACK(set_centered), bd);
- g_signal_connect_swapped(rb_auto, "toggled",
- G_CALLBACK(set_auto), bd);
-
- switch (backdrop_style)
- {
- case TILED:
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_tiled), TRUE);
- break;
- case SCALED:
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_scaled), TRUE);
- break;
- case CENTERED:
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_centered), TRUE);
- break;
- default:
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_auto), TRUE);
- }
-
- if (is_backdrop_list(backdrop_path))
- {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_auto), TRUE);
- gtk_widget_set_sensitive(rb_auto, FALSE);
- gtk_widget_set_sensitive(rb_tiled, FALSE);
- gtk_widget_set_sensitive(rb_scaled, FALSE);
- gtk_widget_set_sensitive(rb_centered, FALSE);
- }
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), rb_auto);
+ g_signal_connect_swapped(rb_auto, "activate",
+ G_CALLBACK(set_auto), bd);
+
+ omenu = gtk_option_menu_new();
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), backdrop_style);
+
+ gtk_widget_show(menu);
+ gtk_widget_show(omenu);
+ gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 0);
}
/* the dialog */
@@ -888,15 +869,16 @@
add_color_button(vbox, bd);
/* image vbox */
- frame = gtk_frame_new(_("Image"));
- gtk_container_set_border_width(GTK_CONTAINER(frame), BORDER);
- gtk_widget_show(frame);
- gtk_box_pack_start(GTK_BOX(mainvbox), frame, TRUE, TRUE, 0);
+ bd->image_frame = gtk_frame_new(_("Image"));
+ gtk_container_set_border_width(GTK_CONTAINER(bd->image_frame), BORDER);
+ gtk_widget_set_sensitive(bd->image_frame, showimage);
+ gtk_widget_show(bd->image_frame);
+ gtk_box_pack_start(GTK_BOX(mainvbox), bd->image_frame, TRUE, TRUE, 0);
- vbox = gtk_vbox_new(FALSE, BORDER);
+ vbox = gtk_vbox_new(FALSE, 2 * BORDER);
gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER);
gtk_widget_show(vbox);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
+ gtk_container_add(GTK_CONTAINER(bd->image_frame), vbox);
/* file entry and style radio buttons */
sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
More information about the Xfce4-dev
mailing list