[Goodies-commits] r4530 - ristretto/trunk/src
Stephan Arts
stephan at xfce.org
Mon Apr 7 20:37:12 CEST 2008
Author: stephan
Date: 2008-04-07 18:37:12 +0000 (Mon, 07 Apr 2008)
New Revision: 4530
Modified:
ristretto/trunk/src/main.c
ristretto/trunk/src/main_window.c
ristretto/trunk/src/main_window.h
Log:
Improve wallpaper-changing
Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c 2008-04-06 23:10:48 UTC (rev 4529)
+++ ristretto/trunk/src/main.c 2008-04-07 18:37:12 UTC (rev 4530)
@@ -259,6 +259,13 @@
gboolean override_bg_color = xfce_rc_read_bool_entry (xfce_rc, "OverrideBgColor", FALSE);
gboolean scale_to_100 = xfce_rc_read_bool_entry (xfce_rc, "ScaleTo100", FALSE);
+ /**
+ * 0 = No desktop
+ * 1 = Xfce >= 4.5
+ *
+ */
+ gint set_wallpaper = xfce_rc_read_int_entry(xfce_rc, "SetWallpaperDesktop", 0);
+
if (override_bg_color)
{
const gchar *color = xfce_rc_read_entry(xfce_rc, "BgColor", "#000000000000");
@@ -279,6 +286,7 @@
rstto_main_window_set_max_cache_size(RSTTO_MAIN_WINDOW(window), max_cache);
rstto_main_window_set_slideshow_timeout(RSTTO_MAIN_WINDOW(window), (gdouble)slideshow_timeout);
rstto_main_window_set_scale_to_100(RSTTO_MAIN_WINDOW(window), scale_to_100);
+ rstto_main_window_set_desktop(RSTTO_MAIN_WINDOW(window), set_wallpaper);
GtkRecentManager *recent_manager = rstto_main_window_get_recent_manager(RSTTO_MAIN_WINDOW(window));
rstto_navigator_set_timeout(navigator, slideshow_timeout);
@@ -354,6 +362,7 @@
}
xfce_rc_write_int_entry(xfce_rc, "MaxImagesCacheSize", rstto_main_window_get_max_cache_size(RSTTO_MAIN_WINDOW(window)));
xfce_rc_write_int_entry(xfce_rc, "SlideShowTimeout", (gint)rstto_main_window_get_slideshow_timeout(RSTTO_MAIN_WINDOW(window)));
+ xfce_rc_write_int_entry(xfce_rc, "SetWallpaperDesktop", (gint)rstto_main_window_get_desktop(RSTTO_MAIN_WINDOW(window)));
xfce_rc_flush(xfce_rc);
xfce_rc_close(xfce_rc);
gtk_widget_unref(window);
@@ -423,6 +432,7 @@
cb_rstto_open_files (RsttoOpenFiles *rof)
{
gchar *path_dir = NULL;
+ GError *error = NULL;
RsttoNavigator *navigator = rof->navigator;
RsttoMainWindow *window = rof->main_window;
@@ -453,11 +463,15 @@
if(g_file_test(path_dir, G_FILE_TEST_IS_DIR))
{
- if(rstto_navigator_open_folder (navigator, path_dir, TRUE, NULL) == TRUE)
+ if(rstto_navigator_open_folder (navigator, path_dir, TRUE, &error) == TRUE)
{
rstto_navigator_jump_first(navigator);
gtk_statusbar_remove(bar, context_id, message_id);
}
+ else
+ {
+
+ }
}
else
{
Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c 2008-04-06 23:10:48 UTC (rev 4529)
+++ ristretto/trunk/src/main_window.c 2008-04-07 18:37:12 UTC (rev 4530)
@@ -34,12 +34,7 @@
#include "picture_viewer.h"
#include "main_window.h"
-typedef enum {
- RSTTO_DESKTOP_NONE,
- RSTTO_DESKTOP_XFCE
-} RsttoDesktop;
-
struct _RsttoMainWindowPriv
{
RsttoNavigator *navigator;
@@ -1102,10 +1097,11 @@
case RSTTO_DESKTOP_XFCE:
{
XfconfChannel *xfdesktop_channel = xfconf_channel_new("xfdesktop");
- if(xfconf_channel_set_string(xfdesktop_channel, "image_path_0_0", path) == FALSE)
+ if(xfconf_channel_set_string(xfdesktop_channel, "/image_path_0_0", path) == FALSE)
{
/** FAILED */
}
+ g_object_unref(xfdesktop_channel);
}
break;
#endif
@@ -1260,6 +1256,8 @@
GtkWidget *resize_to_content_vbox, *resize_to_content_frame;
GtkWidget *resize_on_maximize_check;
+ GtkWidget *set_wallpaper_vbox, *set_wallpaper_frame;
+ GtkWidget *set_wallpaper_label, *set_wallpaper_combo;
GtkWidget *bg_color_vbox;
GtkWidget *bg_color_hbox;
@@ -1317,6 +1315,37 @@
gtk_container_set_border_width (GTK_CONTAINER (resize_to_content_frame), 8);
gtk_box_pack_start(GTK_BOX(behaviour_main_vbox), resize_to_content_frame, FALSE, TRUE, 0);
+ set_wallpaper_vbox = gtk_vbox_new(FALSE, 0);
+ set_wallpaper_frame = xfce_create_framebox_with_content(_("Set wallpaper"), set_wallpaper_vbox);
+
+ set_wallpaper_label = gtk_label_new_with_mnemonic(_("Please choose which application you use to manage your desktop"));
+ set_wallpaper_combo = gtk_combo_box_new_text();
+ gtk_box_pack_start(GTK_BOX(set_wallpaper_vbox), set_wallpaper_label, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(set_wallpaper_vbox), set_wallpaper_combo, FALSE, TRUE, 0);
+
+ gtk_combo_box_append_text(GTK_COMBO_BOX(set_wallpaper_combo), _("None"));
+#ifdef WITH_DESKTOP_WALLPAPER
+#ifdef HAVE_XFCONF
+ gtk_combo_box_append_text(GTK_COMBO_BOX(set_wallpaper_combo), _("Xfce"));
+#endif
+#endif
+ switch (window->priv->settings.desktop)
+ {
+#ifdef WITH_DESKTOP_WALLPAPER
+#ifdef HAVE_XFCONF
+ case RSTTO_DESKTOP_XFCE:
+ gtk_combo_box_set_active(GTK_COMBO_BOX(set_wallpaper_combo), RSTTO_DESKTOP_XFCE);
+ break;
+#endif
+#endif
+ default:
+ gtk_combo_box_set_active(GTK_COMBO_BOX(set_wallpaper_combo), RSTTO_DESKTOP_NONE);
+ break;
+ }
+
+ gtk_container_set_border_width (GTK_CONTAINER (set_wallpaper_frame), 8);
+ gtk_box_pack_start(GTK_BOX(behaviour_main_vbox), set_wallpaper_frame, FALSE, TRUE, 0);
+
/** Add content for display page */
bg_color_vbox = gtk_vbox_new(FALSE, 0);
bg_color_frame = xfce_create_framebox_with_content (_("Background Color"), bg_color_vbox);
@@ -1422,6 +1451,29 @@
rstto_main_window_set_max_cache_size(window, GTK_ADJUSTMENT(cache_adjustment)->value);
window->priv->settings.scale_to_100 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resize_on_maximize_check));
+ switch (gtk_combo_box_get_active(GTK_COMBO_BOX(set_wallpaper_combo)))
+ {
+ case RSTTO_DESKTOP_XFCE:
+#ifdef WITH_DESKTOP_WALLPAPER
+#ifdef HAVE_XFCONF
+ window->priv->settings.desktop = RSTTO_DESKTOP_XFCE;
+#endif
+#else
+ window->priv->settings.desktop = RSTTO_DESKTOP_NONE;
+#endif
+ break;
+ default:
+ window->priv->settings.desktop = RSTTO_DESKTOP_NONE;
+ break;
+ }
+ if ((window->priv->settings.desktop > 0) && (rstto_navigator_get_position(window->priv->navigator) >= 0))
+ {
+ gtk_widget_set_sensitive(window->priv->menus.view.menu_item_set_wallpaper, TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(window->priv->menus.view.menu_item_set_wallpaper, FALSE);
+ }
default:
break;
}
@@ -1667,7 +1719,14 @@
gtk_widget_set_sensitive(window->priv->menus.go.menu_item_pause, TRUE);
#ifdef WITH_DESKTOP_WALLPAPER
- gtk_widget_set_sensitive(window->priv->menus.view.menu_item_set_wallpaper, TRUE);
+ if (window->priv->settings.desktop > 0)
+ {
+ gtk_widget_set_sensitive(window->priv->menus.view.menu_item_set_wallpaper, TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(window->priv->menus.view.menu_item_set_wallpaper, FALSE);
+ }
#endif
gtk_widget_set_sensitive(GTK_WIDGET(window->priv->toolbar.tool_item_next), TRUE);
@@ -1768,6 +1827,7 @@
else
{
gtk_widget_set_sensitive(window->priv->menus.file.menu_item_close, FALSE);
+ gtk_widget_set_sensitive(window->priv->menus.view.menu_item_set_wallpaper, FALSE);
gtk_window_set_title(GTK_WINDOW(window), PACKAGE_STRING);
if (rstto_navigator_get_n_files(window->priv->navigator) == 0)
{
@@ -2005,3 +2065,27 @@
{
return GTK_STATUSBAR(window->priv->statusbar);
}
+
+gint
+rstto_main_window_get_desktop(RsttoMainWindow *window)
+{
+ return window->priv->settings.desktop;
+}
+
+gint
+rstto_main_window_set_desktop(RsttoMainWindow *window, RsttoDesktop desktop)
+{
+ switch(desktop)
+ {
+#ifdef WITH_DESKTOP_WALLPAPER
+#ifdef HAVE_XFCONF
+ case RSTTO_DESKTOP_XFCE:
+ window->priv->settings.desktop = desktop;
+ break;
+#endif
+#endif
+ default:
+ window->priv->settings.desktop = RSTTO_DESKTOP_NONE;
+ break;
+ }
+}
Modified: ristretto/trunk/src/main_window.h
===================================================================
--- ristretto/trunk/src/main_window.h 2008-04-06 23:10:48 UTC (rev 4529)
+++ ristretto/trunk/src/main_window.h 2008-04-07 18:37:12 UTC (rev 4530)
@@ -58,6 +58,12 @@
GtkWindowClass parent_class;
};
+typedef enum {
+ RSTTO_DESKTOP_NONE,
+ RSTTO_DESKTOP_XFCE
+} RsttoDesktop;
+
+
GType rstto_main_window_get_type();
GtkWidget *rstto_main_window_new();
@@ -100,6 +106,10 @@
GtkStatusbar *
rstto_main_window_get_statusbar(RsttoMainWindow *window);
+gint
+rstto_main_window_get_desktop(RsttoMainWindow *window);
+gint
+rstto_main_window_set_desktop(RsttoMainWindow *window, RsttoDesktop desktop);
G_END_DECLS
More information about the Goodies-commits
mailing list