[Xfce4-commits] Respond to monitors-changed events

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to bcd164f4e460f1cdaff1db4287a1109518f895e5 (commit)
   from 9ca8aea6d217d72f95287b9750d152eca734a3eb (commit)

commit bcd164f4e460f1cdaff1db4287a1109518f895e5
Author: Eric Koegel 
Date:   Sat Mar 30 09:03:43 2013 +0300

Respond to monitors-changed events

 settings/main.c |   23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index d10dec2..fab16f9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -1052,6 +1052,7 @@ cb_update_background_tab(WnckWindow *wnck_window,
 {
 AppearancePanel *panel = user_data;
 gint screen_num, monitor_num, workspace_num;
+gchar *monitor_name = NULL;
 WnckWorkspace *wnck_workspace = NULL;
 GdkScreen *screen;
 
@@ -1062,11 +1063,13 @@ cb_update_background_tab(WnckWindow *wnck_window,
 screen_num = gdk_screen_get_number(screen);
 monitor_num = gdk_screen_get_monitor_at_window(screen,

gtk_widget_get_window(panel->image_iconview));
+monitor_name = gdk_screen_get_monitor_plug_name(screen, monitor_num);
 
 /* Check to see if something changed */
 if(panel->workspace == workspace_num &&
panel->screen == screen_num &&
-   panel->monitor == monitor_num) {
+   panel->monitor_name != NULL &&
+   g_strcmp0(panel->monitor_name, monitor_name) == 0) {
return;
 }
 
@@ -1108,17 +,27 @@ cb_update_background_tab(WnckWindow *wnck_window,
 
 static void
 cb_workspace_changed(WnckScreen *screen,
-   WnckWorkspace *workspace,
-   gpointer user_data)
+ WnckWorkspace *workspace,
+ gpointer user_data)
 {
 AppearancePanel *panel = user_data;
 
-/* Call update background because the single workspace mode may have
+/* Update background because the single workspace mode may have
  * changed due to the addition/removal of a workspace */
 cb_update_background_tab(panel->wnck_window, user_data);
 }
 
 static void
+cb_monitor_changed(GdkScreen *gscreen,
+   gpointer user_data)
+{
+AppearancePanel *panel = user_data;
+
+/* Update background because the monitor we're on may have changed */
+cb_update_background_tab(panel->wnck_window, user_data);
+}
+
+static void
 cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
   gpointer user_data)
 {
@@ -1252,6 +1265,8 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  G_CALLBACK(cb_workspace_changed), panel);
 g_signal_connect(wnck_screen, "workspace-destroyed",
  G_CALLBACK(cb_workspace_changed), panel);
+g_signal_connect(G_OBJECT(screen), "monitors-changed",
+ G_CALLBACK(cb_monitor_changed), panel);
 
 /* send invalid numbers so that the update_background_tab will update 
everything */
 panel->monitor = -1;
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Apply wallpaper to all workspaces option

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to f51d49ec663ae59c3c5c357eedd9c378a1fdfd13 (commit)
   from c4a10cc1524490d35a6afd7aa67cdd57c59729b8 (commit)

commit f51d49ec663ae59c3c5c357eedd9c378a1fdfd13
Author: Eric Koegel 
Date:   Sun Mar 10 11:31:45 2013 +0300

Apply wallpaper to all workspaces option

 common/xfdesktop-common.h  |3 +
 settings/main.c|   83 ++--
 .../xfdesktop-settings-appearance-frame-ui.glade   |   15 +++
 src/xfce-desktop.c |  132 ++--
 4 files changed, 214 insertions(+), 19 deletions(-)

diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index 5334ba8..b34d7b5 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -49,6 +49,9 @@
 #define ARRANGE_MESSAGE"arrange"
 #define QUIT_MESSAGE   "quit"
 
+#define SINGLE_WORKSPACE_MODE "/backdrop/single-workspace-mode"
+#define SINGLE_WORKSPACE_NUMBER   "/backdrop/single-workspace-number"
+
 /**
  * File information namespaces queried for #GFileInfo objects.
  */
diff --git a/settings/main.c b/settings/main.c
index f82bd7c..95ced14 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -96,6 +96,8 @@ typedef struct
 gchar *monitor_name;
 gulong image_list_loaded:1;
 
+WnckWindow *wnck_window;
+
 GtkWidget *frame_image_list;
 GtkWidget *image_iconview;
 GtkWidget *btn_folder;
@@ -674,6 +676,35 @@ cb_image_selection_changed(GtkIconView *icon_view,
 g_free(buf);
 }
 
+static gint
+xfdesktop_settings_get_active_workspace(AppearancePanel *panel,
+WnckWindow *wnck_window)
+{
+WnckWorkspace *wnck_workspace;
+gboolean single_workspace;
+gint workspace_num, active_workspace;
+
+wnck_workspace = wnck_window_get_workspace(wnck_window);
+
+workspace_num = wnck_workspace_get_number(wnck_workspace);
+
+single_workspace = xfconf_channel_get_bool(panel->channel,
+   SINGLE_WORKSPACE_MODE,
+   TRUE);
+
+/* If we're in single_workspace mode we need to return the workspace that
+ * it was set to, otherwise return the current workspace */
+if(single_workspace) {
+active_workspace = xfconf_channel_get_int(panel->channel,
+  SINGLE_WORKSPACE_NUMBER,
+  0);
+} else {
+active_workspace = workspace_num;
+}
+
+return active_workspace;
+}
+
 static void
 cb_xfdesktop_chk_custom_font_size_toggled(GtkCheckButton *button,
   gpointer user_data)
@@ -1013,7 +1044,7 @@ cb_update_background_tab(WnckWindow *wnck_window,
 screen = gtk_widget_get_screen(panel->image_iconview);
 wnck_workspace = wnck_window_get_workspace(wnck_window);
 
-workspace_num = wnck_workspace_get_number(wnck_workspace);
+workspace_num = xfdesktop_settings_get_active_workspace(panel, 
wnck_window);
 screen_num = gdk_screen_get_number(screen);
 monitor_num = gdk_screen_get_monitor_at_window(screen,

gtk_widget_get_window(panel->image_iconview));
@@ -1062,6 +1093,29 @@ cb_update_background_tab(WnckWindow *wnck_window,
 }
 
 static void
+cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
+  gpointer user_data)
+{
+AppearancePanel *panel = user_data;
+gboolean active;
+active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+
+TRACE("entering");
+
+xfconf_channel_set_bool(panel->channel,
+SINGLE_WORKSPACE_MODE,
+active);
+
+if(active) {
+xfconf_channel_set_int(panel->channel,
+   SINGLE_WORKSPACE_NUMBER,
+   panel->workspace);
+} else {
+cb_update_background_tab(panel->wnck_window, panel);
+}
+}
+
+static void
 xfdesktop_settings_setup_image_iconview(AppearancePanel *panel)
 {
 GtkIconView *iconview = GTK_ICON_VIEW(panel->image_iconview);
@@ -1093,13 +1147,12 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 GtkWidget *appearance_container, *chk_custom_font_size,
   *spin_font_size, *w, *box, *spin_icon_size,
   *chk_show_thumbnails, *chk_single_click, *appearance_settings,
-  *bnt_exit;
+  *bnt_exit, *chk_apply_to_all;
 GtkBuilder *appearance_gxml;
 AppearancePanel *panel = g_new0(AppearancePanel, 1);
 GError *error = NULL;
 GtkFileFilter *filter;
 WnckScreen *wnck_screen;
-WnckWindow *wnck_window = NULL;
 
 TRACE("entering");
 
@@ -1156,16 +1209,16 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
   

[Xfce4-commits] Change thumbnail and padding in the settings app

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 8e38b064c7c09c787d7af78efff4eaa59c235510 (commit)
   from f51d49ec663ae59c3c5c357eedd9c378a1fdfd13 (commit)

commit 8e38b064c7c09c787d7af78efff4eaa59c235510
Author: Eric Koegel 
Date:   Sat Mar 16 13:30:32 2013 +0300

Change thumbnail and padding in the settings app

Increase the thumbnail size and lower the padding between individual
thumbnails in xfdesktop-settings.

 settings/main.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 95ced14..71f917f 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -54,9 +54,8 @@
 #include "xfdesktop-settings-ui.h"
 #include "xfdesktop-settings-appearance-frame-ui.h"
 
-#define PREVIEW_HEIGHT  48
-#define MAX_ASPECT_RATIO 3.0f
-#define PREVIEW_WIDTH 128
+#define PREVIEW_HEIGHT  96
+#define MAX_ASPECT_RATIO 2.0f
 
 #define SHOW_DESKTOP_MENU_PROP   "/desktop-menu/show"
 #define DESKTOP_MENU_SHOW_ICONS_PROP "/desktop-menu/show-icons"
@@ -1126,9 +1125,11 @@ xfdesktop_settings_setup_image_iconview(AppearancePanel 
*panel)
 
 g_object_set(G_OBJECT(iconview),
 "pixbuf-column", COL_PIX,
-"item-width", PREVIEW_WIDTH,
 "tooltip-column", COL_NAME,
 "selection-mode", GTK_SELECTION_BROWSE,
+"column-spacing", 2,
+"item-padding", 2,
+"margin", 2,
 NULL);
 
 g_signal_connect(G_OBJECT(iconview), "selection-changed",
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Update icon view frame name based on monitor count

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 6d78e6bc921b4a4b408af0e6c94aaf682ea3c5fd (commit)
   from 8385169faa534301b7131d842c062bb9971e5f67 (commit)

commit 6d78e6bc921b4a4b408af0e6c94aaf682ea3c5fd
Author: Eric Koegel 
Date:   Mon Apr 8 18:54:51 2013 +0300

Update icon view frame name based on monitor count

 settings/main.c |   45 +
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 8debcb9..7c167ab 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -637,14 +637,37 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
 
 workspace_name = g_strdup(wnck_workspace_get_name(wnck_workspace));
 
-if(panel->monitor_name) {
-g_snprintf(buf, sizeof(buf),
-   _("Wallpaper for %s on Monitor %d (%s)"),
-   workspace_name, panel->monitor, panel->monitor_name);
-} else
-g_snprintf(buf, sizeof(buf),
-   _("Wallpaper for %s on Monitor %d"),
-   workspace_name, panel->monitor);
+
if(gdk_screen_get_n_monitors(gtk_widget_get_screen(panel->chk_apply_to_all)) > 
1) {
+
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all))) {
+/* Multi-monitor single workspace */
+if(panel->monitor_name) {
+g_snprintf(buf, sizeof(buf),
+   _("Wallpaper for Monitor %d (%s)"),
+   panel->monitor, panel->monitor_name);
+} else {
+g_snprintf(buf, sizeof(buf), _("Wallpaper for Monitor %d"), 
panel->monitor);
+}
+} else {
+/* Multi-monitor per workspace wallpaper */
+if(panel->monitor_name) {
+g_snprintf(buf, sizeof(buf),
+   _("Wallpaper for %s on Monitor %d (%s)"),
+   workspace_name, panel->monitor, 
panel->monitor_name);
+} else {
+g_snprintf(buf, sizeof(buf),
+   _("Wallpaper for %s on Monitor %d"),
+   workspace_name, panel->monitor);
+}
+}
+} else {
+
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all))) {
+/* Single monitor and single workspace */
+g_snprintf(buf, sizeof(buf), _("Wallpaper for my desktop"));
+} else {
+/* Single monitor and per workspace wallpaper */
+g_snprintf(buf, sizeof(buf), _("Wallpaper for %s"), 
workspace_name);
+}
+}
 
 gtk_frame_set_label(GTK_FRAME(panel->frame_image_list), buf);
 
@@ -1153,6 +1176,9 @@ cb_monitor_changed(GdkScreen *gscreen,
 
 /* Update background because the monitor we're on may have changed */
 cb_update_background_tab(panel->wnck_window, user_data);
+
+/* Update the frame name because we may change from/to a single monitor */
+xfdesktop_settings_update_iconview_frame_name(panel, 
wnck_window_get_workspace(panel->wnck_window));
 }
 
 static void
@@ -1176,6 +1202,9 @@ cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
 } else {
 cb_update_background_tab(panel->wnck_window, panel);
 }
+
+/* update the frame name to since we changed to/from single workspace mode 
*/
+xfdesktop_settings_update_iconview_frame_name(panel, 
wnck_window_get_workspace(panel->wnck_window));
 }
 
 static void
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Cache wallpapers when they are loaded

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 4e51013473eed4a9879267db7d48986061caddd9 (commit)
   from bcd164f4e460f1cdaff1db4287a1109518f895e5 (commit)

commit 4e51013473eed4a9879267db7d48986061caddd9
Author: Eric Koegel 
Date:   Sat Mar 30 10:08:50 2013 +0300

Cache wallpapers when they are loaded

This is to make workspace switching faster. It only cached when drawing the
wallpaper because the user may have lots of workspaces configured for 
whatever
reason and never use all of them, so this would save on the memory overhead.
This patch also improves the backdrop comparison check and simplifies the
unbinding of some settings.

 src/xfce-backdrop.c  |   65 +++---
 src/xfce-workspace.c |   52 ++--
 2 files changed, 58 insertions(+), 59 deletions(-)

diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index f209c50..9122682 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -60,7 +60,9 @@ struct _XfceBackdropPriv
 {
 gint width, height;
 gint bpp;
-
+
+GdkPixbuf *pix;
+
 XfceBackdropColorStyle color_style;
 GdkColor color1;
 GdkColor color2;
@@ -179,6 +181,19 @@ create_gradient(GdkColor *color1, GdkColor *color2, gint 
width, gint height,
 return pix;
 }
 
+static void
+xfce_backdrop_clear_cached_image(XfceBackdrop *backdrop)
+{
+g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
+
+if(backdrop->priv->pix == NULL)
+return;
+
+g_object_unref(backdrop->priv->pix);
+backdrop->priv->pix = NULL;
+}
+
+
 /* gobject-related functions */
 
 
@@ -303,6 +318,8 @@ xfce_backdrop_finalize(GObject *object)
 backdrop->priv->cycle_timer_id = 0;
 }
 
+xfce_backdrop_clear_cached_image(backdrop);
+
 G_OBJECT_CLASS(xfce_backdrop_parent_class)->finalize(object);
 }
 
@@ -474,9 +491,13 @@ void
 xfce_backdrop_set_size(XfceBackdrop *backdrop, gint width, gint height)
 {
 g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
-
-backdrop->priv->width = width;
-backdrop->priv->height = height;
+
+if(backdrop->priv->width != width ||
+   backdrop->priv->height != height) {
+xfce_backdrop_clear_cached_image(backdrop);
+backdrop->priv->width = width;
+backdrop->priv->height = height;
+}
 }
 
 /**
@@ -494,6 +515,7 @@ xfce_backdrop_set_color_style(XfceBackdrop *backdrop,
 g_return_if_fail((int)style >= 0 && style <= 
XFCE_BACKDROP_COLOR_TRANSPARENT);
 
 if(style != backdrop->priv->color_style) {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->color_style = style;
 g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 
0);
 }
@@ -528,6 +550,7 @@ xfce_backdrop_set_first_color(XfceBackdrop *backdrop,
 || color->green != backdrop->priv->color1.green
 || color->blue != backdrop->priv->color1.blue)
 {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->color1.red = color->red;
 backdrop->priv->color1.green = color->green;
 backdrop->priv->color1.blue = color->blue;
@@ -564,6 +587,7 @@ xfce_backdrop_set_second_color(XfceBackdrop *backdrop,
 || color->green != backdrop->priv->color2.green
 || color->blue != backdrop->priv->color2.blue)
 {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->color2.red = color->red;
 backdrop->priv->color2.green = color->green;
 backdrop->priv->color2.blue = color->blue;
@@ -599,6 +623,7 @@ xfce_backdrop_set_image_style(XfceBackdrop *backdrop,
 g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
 
 if(style != backdrop->priv->image_style) {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->image_style = style;
 g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 
0);
 }
@@ -634,7 +659,9 @@ xfce_backdrop_set_image_filename(XfceBackdrop *backdrop, 
const gchar *filename)
 backdrop->priv->image_path = g_strdup(filename);
 else
 backdrop->priv->image_path = NULL;
-
+
+xfce_backdrop_clear_cached_image(backdrop);
+
 g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 0);
 }
 
@@ -763,9 +790,16 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
 gint dx, dy, xo, yo;
 gdouble xscale, yscale;
 GdkInterpType interp;
-
+
+TRACE("entering");
+
 g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), NULL);
-
+
+if(backdrop->priv->pix != NULL) {
+DBG("pixbuf cached");
+return g_object_ref(backdrop->priv->pix);
+}
+
 if(backdrop->priv->image_style != XFCE_BACKDROP_IMAGE_NONE &a

[Xfce4-commits] Select wallpaper on loading

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 8385169faa534301b7131d842c062bb9971e5f67 (commit)
   from 3ea195b2ac3223a4c2de1e7eeb30b3461eb4994e (commit)

commit 8385169faa534301b7131d842c062bb9971e5f67
Author: Eric Koegel 
Date:   Sun Apr 7 11:11:13 2013 +0300

Select wallpaper on loading

Increases the icon view item padding size so the selected item stands out 
better.
cb_folder_selection_change is manually called because GTK introduced a bug 
where
changing the gtk file chooser folder in code no longer emits the correct 
signal.

 settings/main.c |   22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 0f7f8d9..8debcb9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -132,7 +132,6 @@ typedef struct
 GtkTreeIter *selected_iter;
 gchar *last_image;
 gchar *file_path;
-gchar *cur_image_file;
 AppearancePanel *panel;
 } AddDirData;
 
@@ -527,13 +526,12 @@ xfdesktop_image_list_add_item(gpointer user_data)
 AddDirData *dir_data = user_data;
 AppearancePanel *panel = dir_data->panel;
 GFileInfo *info;
-GtkTreeIter *iter, *selected_iter = NULL;
+GtkTreeIter *iter;
 GtkTreePath *path;
 
 /* If the enumeration gets canceled/destroyed we need to clean up */
 if(!G_IS_FILE_ENUMERATOR(dir_data->file_enumerator)) {
 g_free(dir_data->file_path);
-g_free(dir_data->cur_image_file);
 g_free(dir_data->last_image);
 g_free(dir_data);
 
@@ -549,8 +547,7 @@ xfdesktop_image_list_add_item(gpointer user_data)
 
 iter = 
xfdesktop_settings_image_iconview_add(GTK_TREE_MODEL(dir_data->ls), buf, panel);
 if(iter) {
-if(dir_data->cur_image_file &&
-   !dir_data->selected_iter &&
+if(!dir_data->selected_iter &&
!strcmp(buf, dir_data->last_image))
 {
 dir_data->selected_iter = iter;
@@ -572,8 +569,8 @@ xfdesktop_image_list_add_item(gpointer user_data)
 GTK_TREE_MODEL(dir_data->ls));
 
 /* last_image is in the directory added then it should be selected */
-if(selected_iter) {
-path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_data->ls), 
selected_iter);
+if(dir_data->selected_iter) {
+path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_data->ls), 
dir_data->selected_iter);
 if(path) {
 gtk_icon_view_select_path(GTK_ICON_VIEW(panel->image_iconview), 
path);
 gtk_tree_iter_free(dir_data->selected_iter);
@@ -581,7 +578,6 @@ xfdesktop_image_list_add_item(gpointer user_data)
  }
 
 g_free(dir_data->file_path);
-g_free(dir_data->cur_image_file);
 g_free(dir_data->last_image);
 g_object_unref(dir_data->file_enumerator);
 g_free(dir_data);
@@ -617,7 +613,6 @@ xfdesktop_image_list_add_dir(GObject *source_object,
 dir_data->last_image = xfconf_channel_get_string(panel->channel, property, 
DEFAULT_BACKDROP);
 
 dir_data->file_path = g_file_get_path(panel->selected_file);
-dir_data->cur_image_file = g_file_get_parse_name(panel->selected_file);
 
 dir_data->file_enumerator = 
g_file_enumerate_children_finish(panel->selected_file,
  res,
@@ -965,14 +960,14 @@ xfdesktop_settings_update_iconview_folder(AppearancePanel 
*panel)
 
 prop_last = 
xfdesktop_settings_generate_per_workspace_binding_string(panel, "last-image");
 
-current_folder = xfconf_channel_get_string(panel->channel, prop_last, 
NULL);
-
-if(current_folder == NULL)
-current_folder = g_strdup(DEFAULT_BACKDROP);
+current_folder = xfconf_channel_get_string(panel->channel, prop_last, 
DEFAULT_BACKDROP);
 
 gtk_file_chooser_set_current_folder((GtkFileChooser*)panel->btn_folder,
   g_path_get_dirname(current_folder));
 
+/* Workaround for a bug in GTK */
+cb_folder_selection_changed(panel->btn_folder, panel);
+
 g_free(current_folder);
 g_free(prop_last);
 }
@@ -1197,7 +1192,6 @@ xfdesktop_settings_setup_image_iconview(AppearancePanel 
*panel)
 "tooltip-column", COL_NAME,
 "selection-mode", GTK_SELECTION_BROWSE,
 "column-spacing", 2,
-"item-padding", 2,
 "margin", 2,
 NULL);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fixes for multi-monitor per-workspace wallpapers

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 3cec6972530e4e4af47dbb84358fa8fedcc00f82 (commit)
   from 8674fc7ea9e0acae40db69714be13054053ef44d (commit)

commit 3cec6972530e4e4af47dbb84358fa8fedcc00f82
Author: Eric Koegel 
Date:   Tue Feb 26 10:50:20 2013 +0300

Fixes for multi-monitor per-workspace wallpapers

This fixes several issues with the per-workspace backdrop code,
especially with multi-monitor setups. Selection mode in the settings
app is set to browse to enforce an item is always selected. Also
xfdesktop trys to avoid redrawing the wallpaper on a workspace
change if the backdrops are identical. The --reload option works
correctly again.

 settings/main.c|  113 ---
 .../xfdesktop-settings-appearance-frame-ui.glade   |1 +
 src/xfce-backdrop.c|   58 --
 src/xfce-backdrop.h|3 +
 src/xfce-desktop.c |  114 
 src/xfce-workspace.c   |   81 +-
 6 files changed, 220 insertions(+), 150 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 441bcdc..1308b21 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -77,6 +77,8 @@
 #define DESKTOP_ICONS_SHOW_FILESYSTEM
"/desktop-icons/file-icons/show-filesystem"
 #define DESKTOP_ICONS_SHOW_REMOVABLE 
"/desktop-icons/file-icons/show-removable"
 
+#define IMAGE_STLYE_SPANNING_SCREENS 6
+#define XFCE_BACKDROP_IMAGE_NONE 0
 
 typedef struct
 {
@@ -480,6 +482,8 @@ 
xfdesktop_settings_generate_per_workspace_binding_string(AppearancePanel *panel,
   property);
 }
 
+DBG("name %s", buf);
+
 return buf;
 }
 
@@ -660,6 +664,21 @@ cb_folder_selection_changed(GtkWidget *button,
 }
 
 static void
+cb_xfdesktop_combo_image_style_changed(GtkComboBox *combo,
+ gpointer user_data)
+{
+AppearancePanel *panel = user_data;
+
+TRACE("entering");
+
+if(gtk_combo_box_get_active(combo) == XFCE_BACKDROP_IMAGE_NONE) {
+gtk_widget_set_sensitive(panel->image_iconview, FALSE);
+} else {
+gtk_widget_set_sensitive(panel->image_iconview, TRUE);
+}
+}
+
+static void
 cb_xfdesktop_combo_color_changed(GtkComboBox *combo,
  gpointer user_data)
 {
@@ -723,6 +742,8 @@ 
xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel,
 } else {
 xfconf_g_property_bind(channel, buf, G_TYPE_INT,
G_OBJECT(panel->image_style_combo), "active");
+/* determine if the iconview is sensitive */
+
cb_xfdesktop_combo_image_style_changed(GTK_COMBO_BOX(panel->image_style_combo), 
panel);
 }
 g_free(buf);
 
@@ -734,12 +755,15 @@ 
xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel,
 } else {
 xfconf_g_property_bind(channel, buf, G_TYPE_INT,
G_OBJECT(panel->color_style_combo), "active");
+/* update the color button sensitivity */
+
cb_xfdesktop_combo_color_changed(GTK_COMBO_BOX(panel->color_style_combo), 
panel);
 }
 g_free(buf);
 
 buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, 
"color1");
 if(remove_binding) {
 xfconf_g_property_unbind(panel->color1_btn_id);
+} else {
 panel->color1_btn_id = xfconf_g_property_bind_gdkcolor(channel, buf,

G_OBJECT(panel->color1_btn),
"color");
@@ -756,9 +780,6 @@ 
xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel,
 }
 g_free(buf);
 
-cb_xfdesktop_combo_color_changed(GTK_COMBO_BOX(panel->color_style_combo),
- panel);
-
 /* Cycle timer options */
 buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, 
"backdrop-cycle-enable");
 if(remove_binding) {
@@ -792,8 +813,6 @@ 
xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel,
 }
 g_free(buf);
 
-
cb_xfdesktop_chk_cycle_backdrop_toggled(GTK_CHECK_BUTTON(panel->backdrop_cycle_chkbox),
-panel);
 }
 
 static void
@@ -844,23 +863,24 @@ cb_update_background_tab(WnckWindow *wnck_window,
 panel->monitor = monitor_num;
 panel->monitor_name = gdk_screen_get_monitor_plug_name(screen, 
panel->monitor);
 
+/* The first monitor has the option of doing the "spanning screens" style,
+ * but only if there's multiple monitors attached. Remove it in all other 
cases.
+ *
+ * Remove

[Xfce4-commits] Fix warnings and add workspace-changed signal

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to d51fb8ba1ca31f1f66f2855c4e514b80b88b15de (commit)
   from 59921a68c40f8115460553ae69bde5bda3bc7d76 (commit)

commit d51fb8ba1ca31f1f66f2855c4e514b80b88b15de
Author: Eric Koegel 
Date:   Sun Mar 3 16:53:06 2013 +0300

Fix warnings and add workspace-changed signal

Removed the code attempting to bind to the brightness setting since
that functionality was removed. In xfdesktop-settings connect to the
workspace-changed signal to properly update the image_iconview.

 settings/main.c  |4 
 src/xfce-workspace.c |5 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index d0d7996..239eab1 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -1158,8 +1158,12 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 if(wnck_window == NULL)
 wnck_window = wnck_screen_get_active_window(wnck_screen);
 
+/* These callbacks are for updating the image_iconview when the window
+ * moves to another monitor or workspace */
 g_signal_connect(wnck_window, "geometry-changed",
  G_CALLBACK(cb_update_background_tab), panel);
+g_signal_connect(wnck_window, "workspace-changed",
+ G_CALLBACK(cb_update_background_tab), panel);
 
 /* send invalid numbers so that the update_background_tab will update 
everything */
 panel->monitor = -1;
diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c
index 1775fe9..eeb131b 100644
--- a/src/xfce-workspace.c
+++ b/src/xfce-workspace.c
@@ -364,11 +364,6 @@ xfce_workspace_connect_backdrop_settings(XfceWorkspace 
*workspace,
G_OBJECT(backdrop), "image-style");
 
 buf[pp_len] = 0;
-g_strlcat(buf, "brightness", sizeof(buf));
-xfconf_g_property_bind(channel, buf, G_TYPE_INT,
-   G_OBJECT(backdrop), "brightness");
-
-buf[pp_len] = 0;
 g_strlcat(buf, "backdrop-cycle-enable", sizeof(buf));
 xfconf_g_property_bind(channel, buf, G_TYPE_BOOLEAN,
G_OBJECT(backdrop), "backdrop-cycle-enable");
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Make the image style default setting consistant

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 02c53a331c02300134d66da376bcb6a85d90be63 (commit)
   from 9f81066800a9de6a2a20f5436e69fad2492564e2 (commit)

commit 02c53a331c02300134d66da376bcb6a85d90be63
Author: Eric Koegel 
Date:   Sun Mar 24 09:45:29 2013 +0300

Make the image style default setting consistant

 settings/main.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 3f00439..f33f543 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -77,8 +77,9 @@
 #define DESKTOP_ICONS_SHOW_FILESYSTEM
"/desktop-icons/file-icons/show-filesystem"
 #define DESKTOP_ICONS_SHOW_REMOVABLE 
"/desktop-icons/file-icons/show-removable"
 
-#define IMAGE_STLYE_SPANNING_SCREENS 6
 #define XFCE_BACKDROP_IMAGE_NONE 0
+#define XFCE_BACKDROP_IMAGE_SCALED   4
+#define XFCE_BACKDROP_IMAGE_SPANNING_SCREENS 6
 
 typedef struct
 {
@@ -1081,7 +1082,7 @@ cb_update_background_tab(WnckWindow *wnck_window,
  * Remove the spanning screens option before we potentially add it again
  */
 gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(panel->image_style_combo),
-  IMAGE_STLYE_SPANNING_SCREENS);
+  XFCE_BACKDROP_IMAGE_SPANNING_SCREENS);
 if(panel->monitor == 0 && gdk_screen_get_n_monitors(screen) > 1) {
 
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(panel->image_style_combo),
_("Spanning screens"));
@@ -1291,7 +1292,7 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  panel);
 
 /* Pick the first entries so something shows up */
-gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), 0);
+gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), 
XFCE_BACKDROP_IMAGE_SCALED);
 gtk_combo_box_set_active(GTK_COMBO_BOX(panel->color_style_combo), 0);
 
 /* Use these settings for all workspaces checkbox */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Remove unused code

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 9ca8aea6d217d72f95287b9750d152eca734a3eb (commit)
   from be0719f7c9e686ee52dc8a9a37f27e15f18203d1 (commit)

commit 9ca8aea6d217d72f95287b9750d152eca734a3eb
Author: Eric Koegel 
Date:   Sun Mar 24 15:24:31 2013 +0300

Remove unused code

 src/xfce-backdrop.c   |   89 
 src/xfce-backdrop.h   |5 --
 src/xfdesktop-file-icon-manager.c |  116 -
 3 files changed, 210 deletions(-)

diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 1a63426..f209c50 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -68,8 +68,6 @@ struct _XfceBackdropPriv
 XfceBackdropImageStyle image_style;
 gchar *image_path;
 
-gint brightness;
-
 gboolean cycle_backdrop;
 guint cycle_timer;
 guint cycle_timer_id;
@@ -102,52 +100,6 @@ static guint backdrop_signals[LAST_SIGNAL] = { 0, };
 /* helper functions */
 
 static GdkPixbuf *
-adjust_brightness(GdkPixbuf *src, gint amount)
-{
-GdkPixbuf *newpix;
-GdkPixdata pdata;
-gboolean has_alpha = FALSE;
-gint i, len;
-GError *err = NULL;
-
-g_return_val_if_fail(src != NULL, NULL);
-if(amount == 0)
-return src;
-
-gdk_pixdata_from_pixbuf(&pdata, src, FALSE);
-has_alpha = (pdata.pixdata_type & GDK_PIXDATA_COLOR_TYPE_RGBA);
-if(pdata.length < 1)
-len = pdata.width * pdata.height * (has_alpha?4:3);
-else
-len = pdata.length - GDK_PIXDATA_HEADER_LENGTH;
-
-for(i = 0; i < len; i++) {
-gshort scaled;
-
-if(has_alpha && (i+1)%4)
-continue;
-
-scaled = pdata.pixel_data[i] + amount;
-if(scaled > 255)
-scaled = 255;
-if(scaled < 0)
-scaled = 0;
-pdata.pixel_data[i] = scaled;
-}
-
-newpix = gdk_pixbuf_from_pixdata(&pdata, TRUE, &err);
-if(!newpix) {
-g_warning("%s: Unable to modify image brightness: %s", PACKAGE,
-err->message);
-g_error_free(err);
-return src;
-}
-g_object_unref(G_OBJECT(src));
-
-return newpix;
-}
-
-static GdkPixbuf *
 create_solid(GdkColor *color,
  gint width,
  gint height,
@@ -389,10 +341,6 @@ xfce_backdrop_set_property(GObject *object,
  g_value_get_string(value));
 break;
 
-case PROP_BRIGHTNESS:
-xfce_backdrop_set_brightness(backdrop, g_value_get_int(value));
-break;
-
 case PROP_BACKDROP_CYCLE_ENABLE:
 xfce_backdrop_set_cycle_backdrop(backdrop, 
g_value_get_boolean(value));
 break;
@@ -441,10 +389,6 @@ xfce_backdrop_get_property(GObject *object,
xfce_backdrop_get_image_filename(backdrop));
 break;
 
-case PROP_BRIGHTNESS:
-g_value_set_int(value, xfce_backdrop_get_brightness(backdrop));
-break;
-
 case PROP_BACKDROP_CYCLE_ENABLE:
 g_value_set_boolean(value, 
xfce_backdrop_get_cycle_backdrop(backdrop));
 break;
@@ -701,33 +645,6 @@ xfce_backdrop_get_image_filename(XfceBackdrop *backdrop)
 return backdrop->priv->image_path;
 }
 
-/**
- * xfce_backdrop_set_brightness:
- * @backdrop: An #XfceBackdrop.
- * @brightness: A brightness value.
- *
- * Modifies the brightness of the backdrop using a value between -128 and 127.
- * A value of 0 indicates that the brightness should not be changed.  This 
value
- * is applied to the entire image, after compositing.
- **/
-void
-xfce_backdrop_set_brightness(XfceBackdrop *backdrop, gint brightness)
-{
-g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
-
-if(brightness != backdrop->priv->brightness) {
-backdrop->priv->brightness = brightness;
-g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 
0);
-}
-}
-
-gint
-xfce_backdrop_get_brightness(XfceBackdrop *backdrop)
-{
-g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), 0);
-return backdrop->priv->brightness;
-}
-
 static gboolean
 xfce_backdrop_timer(XfceBackdrop *backdrop)
 {
@@ -878,9 +795,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
  *and if it doesn't then make the background the single colour*/
 if(!g_file_test(backdrop->priv->image_path, G_FILE_TEST_EXISTS) ||
backdrop->priv->image_style == XFCE_BACKDROP_IMAGE_NONE) {
-if(backdrop->priv->brightness != 0)
-final_image = adjust_brightness(final_image, 
backdrop->priv->brightness);
-
 return final_image;
 }
 
@@ -1006,9 +920,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
 if(image)
 g_object_unref(G_OBJECT(image));
 
-if(backdrop->priv->brightness != 0)
-final_image = adjust_brightness(final_ima

[Xfce4-commits] Correctly handle workspaces being removed

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 9f81066800a9de6a2a20f5436e69fad2492564e2 (commit)
   from 963d829f123b7cd4da36c25fa03cf5754897e195 (commit)

commit 9f81066800a9de6a2a20f5436e69fad2492564e2
Author: Eric Koegel 
Date:   Mon Mar 25 19:20:41 2013 +0300

Correctly handle workspaces being removed

When workspaces are removed the xfconf bindings need to be removed
and it also handles the single workspace number set to an invalid
workspace.

 src/xfce-desktop.c   |   67 ++---
 src/xfce-workspace.c |  199 ++
 2 files changed, 177 insertions(+), 89 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 2623547..bf00f2d 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -481,6 +481,9 @@ screen_size_changed_cb(GdkScreen *gscreen, gpointer 
user_data)
 if(desktop->priv->nworkspaces <= current_workspace)
 return;
 
+if(current_workspace < 0)
+return;
+
 /* special case for 1 backdrop to handle xinerama stretching */
 
if(xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[current_workspace]))
 {

backdrop_changed_cb(xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace],
 0), desktop);
@@ -549,33 +552,36 @@ workspace_changed_cb(WnckScreen *wnck_screen,
 TRACE("entering");
 
 current_workspace = desktop->priv->current_workspace;
-desktop->priv->current_workspace = 
xfce_desktop_get_current_workspace(desktop);
-new_workspace = desktop->priv->current_workspace;
+new_workspace = xfce_desktop_get_current_workspace(desktop);
 
-DBG("current_workspace %d, new_workspace %d",
-current_workspace, new_workspace);
+if(new_workspace < 0 || new_workspace >= desktop->priv->nworkspaces)
+return;
 
-/* special case for the spanning screen option */
-
if(xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[new_workspace]))
 {
-current_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace], 0);
-new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], 0);
+desktop->priv->current_workspace = new_workspace;
 
-if(!xfce_backdrop_compare_backdrops(current_backdrop, new_backdrop)) {
-backdrop_changed_cb(new_backdrop, user_data);
-return;
-}
-}
+DBG("current_workspace %d, new_workspace %d",
+current_workspace, new_workspace);
 
-/* We want to compare the current workspace backdrops with the new one
- * and see if we can avoid changing them if they are the same image/style 
*/
 for(i = 0; i < xfce_desktop_get_n_monitors(desktop); i++) {
-current_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace], i);
-new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
+/* We want to compare the current workspace backdrop with the new one
+ * and see if we can avoid changing them if they are the same 
image/style */
+if(current_workspace < desktop->priv->nworkspaces) {
+current_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace], i);
+new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
 
-if(!xfce_backdrop_compare_backdrops(current_backdrop, new_backdrop)) {
-/* only update monitors that require it */
+if(!xfce_backdrop_compare_backdrops(current_backdrop, 
new_backdrop)) {
+/* only update monitors that require it */
+backdrop_changed_cb(new_backdrop, user_data);
+}
+} else {
+/* If current_workspace was removed, get the new backdrop and 
apply it */
+new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
 backdrop_changed_cb(new_backdrop, user_data);
 }
+
+/* When we're spanning screens we only care about the first monitor */
+
if(xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[new_workspace]))
+break;
 }
 }
 
@@ -638,6 +644,10 @@ workspace_destroyed_cb(WnckScreen *wnck_screen,
 /* deallocate it */
 desktop->priv->workspaces = g_realloc(desktop->priv->workspaces,
   desktop->priv->nworkspaces * 
sizeof(XfceWorkspace *));
+
+/* Make sure we stay within bounds now that we removed a workspace */
+if(desktop->priv->current_workspace > desktop->priv->nworkspaces)
+desktop->priv->current_workspace = desktop->priv->nworkspaces;
 }
 
 static void
@@ -787,7 +797,7 @@ xf

[Xfce4-commits] Fix for invalid single workspace number in settings app

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to be0719f7c9e686ee52dc8a9a37f27e15f18203d1 (commit)
   from 02c53a331c02300134d66da376bcb6a85d90be63 (commit)

commit be0719f7c9e686ee52dc8a9a37f27e15f18203d1
Author: Eric Koegel 
Date:   Sun Mar 24 15:07:29 2013 +0300

Fix for invalid single workspace number in settings app

Xfdesktop-settings app now repsonds to workspaces being created
and destroyed because it can impact how the single workspace mode
operates. If the single workspace number is set to a workspace that
is destroyed it reverts back to per workspace wallpapers and toogles
the checkbox so that the user knows what is going on.

 settings/main.c |   52 +++-
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index f33f543..d10dec2 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -101,6 +101,7 @@ typedef struct
 GtkWidget *frame_image_list;
 GtkWidget *image_iconview;
 GtkWidget *btn_folder;
+GtkWidget *chk_apply_to_all;
 GtkWidget *image_style_combo;
 GtkWidget *color_style_combo;
 GtkWidget *color1_btn;
@@ -141,6 +142,9 @@ enum
 N_ICON_COLS,
 };
 
+static void cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
+  gpointer user_data);
+
 
 /* assumes gdk lock is held on function enter, and should be held
  * on function exit */
@@ -683,7 +687,7 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
 {
 WnckWorkspace *wnck_workspace;
 gboolean single_workspace;
-gint workspace_num, active_workspace;
+gint workspace_num, single_workspace_num;
 
 wnck_workspace = wnck_window_get_workspace(wnck_window);
 
@@ -694,16 +698,22 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
TRUE);
 
 /* If we're in single_workspace mode we need to return the workspace that
- * it was set to, otherwise return the current workspace */
+ * it was set to, if that workspace exists, otherwise return the current
+ * workspace and turn off the single workspace mode */
 if(single_workspace) {
-active_workspace = xfconf_channel_get_int(panel->channel,
-  SINGLE_WORKSPACE_NUMBER,
-  0);
-} else {
-active_workspace = workspace_num;
+WnckScreen *wnck_screen = wnck_window_get_screen(wnck_window);
+single_workspace_num = xfconf_channel_get_int(panel->channel,
+  SINGLE_WORKSPACE_NUMBER,
+  0);
+if(single_workspace_num < 
wnck_screen_get_workspace_count(wnck_screen)) {
+return single_workspace_num;
+} else {
+
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all),
+ FALSE);
+}
 }
 
-return active_workspace;
+return workspace_num;
 }
 
 static void
@@ -1097,6 +1107,18 @@ cb_update_background_tab(WnckWindow *wnck_window,
 }
 
 static void
+cb_workspace_changed(WnckScreen *screen,
+   WnckWorkspace *workspace,
+   gpointer user_data)
+{
+AppearancePanel *panel = user_data;
+
+/* Call update background because the single workspace mode may have
+ * changed due to the addition/removal of a workspace */
+cb_update_background_tab(panel->wnck_window, user_data);
+}
+
+static void
 cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
   gpointer user_data)
 {
@@ -1153,7 +1175,7 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 GtkWidget *appearance_container, *chk_custom_font_size,
   *spin_font_size, *w, *box, *spin_icon_size,
   *chk_show_thumbnails, *chk_single_click, *appearance_settings,
-  *bnt_exit, *chk_apply_to_all;
+  *bnt_exit;
 GtkBuilder *appearance_gxml;
 AppearancePanel *panel = g_new0(AppearancePanel, 1);
 GError *error = NULL;
@@ -1226,6 +1248,10 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  G_CALLBACK(cb_update_background_tab), panel);
 g_signal_connect(panel->wnck_window, "workspace-changed",
  G_CALLBACK(cb_update_background_tab), panel);
+g_signal_connect(wnck_screen, "workspace-created",
+ G_CALLBACK(cb_workspace_changed), panel);
+g_signal_connect(wnck_screen, "workspace-destroyed",
+ G_CALLBACK(cb_workspace_changed), panel);
 
 /* send invalid numbers so that the update_background_tab will update 
everything */
 panel->monitor = -1;
@@ -1296,14 +1322,14 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 

[Xfce4-commits] Thumbnail service support to xfdesktop-settings (Bug #6536)

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 59921a68c40f8115460553ae69bde5bda3bc7d76 (commit)
   from 3cec6972530e4e4af47dbb84358fa8fedcc00f82 (commit)

commit 59921a68c40f8115460553ae69bde5bda3bc7d76
Author: Eric Koegel 
Date:   Mon Feb 25 11:49:16 2013 +0300

Thumbnail service support to xfdesktop-settings (Bug #6536)

 common/xfdesktop-common.c|   61 -
 common/xfdesktop-common.h|2 +
 common/xfdesktop-thumbnailer.c   |   49 +++
 common/xfdesktop-thumbnailer.h   |3 +
 settings/main.c  |  235 ++
 settings/xfdesktop-settings-ui.glade |4 +-
 6 files changed, 298 insertions(+), 56 deletions(-)

diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index 344611a..755e273 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -188,13 +188,70 @@ xfdesktop_backdrop_choose_random(const gchar *filename)
 return file;
 }
 
+gchar *
+xfdesktop_get_file_mimetype(const gchar *file)
+{
+GFile *temp_file;
+GFileInfo *file_info;
+gchar *mime_type = NULL;
+
+g_return_val_if_fail(file != NULL, NULL);
+
+temp_file = g_file_new_for_path(file);
+
+g_return_val_if_fail(temp_file != NULL, NULL);
+
+file_info = g_file_query_info(temp_file,
+  "standard::content-type",
+  0,
+  NULL,
+  NULL);
+
+if(file_info != NULL) {
+mime_type = g_strdup(g_file_info_get_content_type(file_info));
+
+g_object_unref(file_info);
+}
+
+g_object_unref(temp_file);
+
+return mime_type;
+}
+
 gboolean
 xfdesktop_image_file_is_valid(const gchar *filename)
 {
+static GSList *pixbuf_formats = NULL;
+GSList *l;
+gboolean image_valid = FALSE;
+gchar *file_mimetype;
+
 g_return_val_if_fail(filename, FALSE);
 
-/* if gdk can get pixbuf info from the file then it's an image file */
-return (gdk_pixbuf_get_file_info(filename, NULL, NULL) == NULL ? FALSE : 
TRUE);
+if(pixbuf_formats == NULL) {
+pixbuf_formats = gdk_pixbuf_get_formats();
+}
+
+file_mimetype = xfdesktop_get_file_mimetype(filename);
+
+if(file_mimetype == NULL)
+return FALSE;
+
+/* Every pixbuf format has a list of mime types we can compare against */
+for(l = pixbuf_formats; l != NULL && image_valid == FALSE; l = 
g_slist_next(l)) {
+gint i;
+gchar ** mimetypes = gdk_pixbuf_format_get_mime_types(l->data);
+
+for(i = 0; mimetypes[i] != NULL && image_valid == FALSE; i++) {
+if(g_strcmp0(file_mimetype, mimetypes[i]) == 0)
+image_valid = TRUE;
+}
+ g_strfreev(mimetypes);
+}
+
+g_free(file_mimetype);
+
+return image_valid;
 }
 
 gboolean
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index 7c7570d..5334ba8 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -76,6 +76,8 @@ gchar *xfdesktop_backdrop_choose_random(const gchar 
*filename);
 
 gboolean xfdesktop_image_file_is_valid(const gchar *filename);
 
+gchar *xfdesktop_get_file_mimetype(const gchar *file);
+
 gboolean xfdesktop_check_is_running(Window *xid);
 void xfdesktop_send_client_message(Window xid, const gchar *msg);
 
diff --git a/common/xfdesktop-thumbnailer.c b/common/xfdesktop-thumbnailer.c
index 8f39fe9..2c735df 100644
--- a/common/xfdesktop-thumbnailer.c
+++ b/common/xfdesktop-thumbnailer.c
@@ -41,6 +41,7 @@
 #include 
 #include "xfdesktop-thumbnailer.h"
 #include "xfdesktop-marshal.h"
+#include "xfdesktop-common.h"
 
 static void xfdesktop_thumbnailer_init(GObject *);
 static void xfdesktop_thumbnailer_class_init(GObjectClass *);
@@ -257,34 +258,14 @@ xfdesktop_thumbnailer_new(void)
 return thumbnailer_object;
 }
 
-static gchar *
-xfdesktop_get_file_mimetype(gchar *file)
+gboolean xfdesktop_thumbnailer_service_available(XfdesktopThumbnailer 
*thumbnailer)
 {
-GFile *temp_file;
-GFileInfo *file_info;
-gchar *mime_type = NULL;
-
-g_return_val_if_fail(file != NULL, NULL);
-
-temp_file = g_file_new_for_path(file);
-
-g_return_val_if_fail(temp_file != NULL, NULL);
-
-file_info = g_file_query_info(temp_file,
-  "standard::content-type",
-  0,
-  NULL,
-  NULL);
-
-if(file_info != NULL) {
-mime_type = g_strdup(g_file_info_get_content_type(file_info));
+g_return_val_if_fail(XFDESKTOP_IS_THUMBNAILER(thumbnailer), FALSE);
 
-g_object_unref(file_info);
-}
+if(thumbnailer->priv->proxy == NULL)
+return FALSE;
 
-g_object_unref(temp_file);
-
-return mime_type;
+return TRUE;
 }
 
 gboolean
@@ -370,6 +351,12 @@ xfdesktop_thumbnailer_qu

[Xfce4-commits] Clip overlapping backdrops (Bug #9052)

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 963d829f123b7cd4da36c25fa03cf5754897e195 (commit)
   from 594ea3b79117c866b8d2358dc2b44303572e0578 (commit)

commit 963d829f123b7cd4da36c25fa03cf5754897e195
Author: Eric Koegel 
Date:   Sun Mar 17 14:45:27 2013 +0300

Clip overlapping backdrops (Bug #9052)

In a multi-monitor setup each successive wallpaper drawn has the
previous area subtracted from it so that the wallpapers aren't
drawn over each other.

 src/xfce-desktop.c   |   89 ++
 src/xfce-workspace.c |1 -
 2 files changed, 69 insertions(+), 21 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 09f2e53..2623547 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -321,6 +321,7 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 cairo_t *cr;
 GdkPixbuf *pix;
 GdkRectangle rect;
+GdkRegion *clip_region = NULL;
 gint i, monitor = -1, current_workspace;
 
 TRACE("entering");
@@ -376,27 +377,75 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 
 xfce_backdrop_set_size(backdrop, rect.width, rect.height);
 
-/* create/get the composited backdrop pixmap */
-pix = xfce_backdrop_get_pixbuf(backdrop);
-if(!pix)
-return;
+if(monitor > 0
+   && 
!xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[current_workspace]))
 {
+clip_region = gdk_region_rectangle(&rect);
 
-cr = gdk_cairo_create(GDK_DRAWABLE(pmap));
-gdk_cairo_set_source_pixbuf(cr, pix, rect.x, rect.y);
-cairo_paint(cr);
-g_object_unref(G_OBJECT(pix));
-cairo_destroy(cr);
-
-/* tell gtk to redraw the repainted area */
-gtk_widget_queue_draw_area(GTK_WIDGET(desktop), rect.x, rect.y,
-   rect.width, rect.height);
-
-set_imgfile_root_property(desktop,
-  xfce_backdrop_get_image_filename(backdrop),
-  monitor);
-
-/* do this again so apps watching the root win notice the update */
-set_real_root_window_pixmap(gscreen, pmap);
+DBG("clip_region: x: %d, y: %d, w: %d, h: %d",
+rect.x, rect.y, rect.width, rect.height);
+
+/* If we are not monitor 0 on a multi-monitor setup we need to subtract
+ * all the previous monitor regions so we don't draw over them. This
+ * should prevent the overlap and double backdrop drawing bugs.
+ */
+for(i = 0; i < monitor; i++) {
+GdkRectangle previous_monitor;
+GdkRegion *previous_region;
+gdk_screen_get_monitor_geometry(gscreen, i, &previous_monitor);
+
+DBG("previous_monitor: x: %d, y: %d, w: %d, h: %d",
+previous_monitor.x, previous_monitor.y,
+previous_monitor.width, previous_monitor.height);
+
+previous_region = gdk_region_rectangle(&previous_monitor);
+
+gdk_region_subtract(clip_region, previous_region);
+
+gdk_region_destroy(previous_region);
+}
+}
+
+if(clip_region != NULL) {
+/* Update the area to redraw to limit the icons/area painted */
+gdk_region_get_clipbox(clip_region, &rect);
+DBG("area to update: x: %d, y: %d, w: %d, h: %d",
+rect.x, rect.y, rect.width, rect.height);
+}
+
+if(rect.width != 0 && rect.height != 0) {
+/* create/get the composited backdrop pixmap */
+pix = xfce_backdrop_get_pixbuf(backdrop);
+if(!pix)
+return;
+
+cr = gdk_cairo_create(GDK_DRAWABLE(pmap));
+gdk_cairo_set_source_pixbuf(cr, pix, rect.x, rect.y);
+
+/* clip the area so we don't draw over a previous wallpaper */
+if(clip_region != NULL) {
+gdk_cairo_region(cr, clip_region);
+cairo_clip(cr);
+}
+
+cairo_paint(cr);
+g_object_unref(G_OBJECT(pix));
+
+cairo_destroy(cr);
+
+/* tell gtk to redraw the repainted area */
+gtk_widget_queue_draw_area(GTK_WIDGET(desktop), rect.x, rect.y,
+   rect.width, rect.height);
+
+set_imgfile_root_property(desktop,
+  xfce_backdrop_get_image_filename(backdrop),
+  monitor);
+
+/* do this again so apps watching the root win notice the update */
+set_real_root_window_pixmap(gscreen, pmap);
+}
+
+if(clip_region != NULL)
+gdk_region_destroy(clip_region);
 }
 
 static void
diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c
index eeb131b..cdcae08 100644
--- a/src/xfce-workspace.c
+++ b/src/xfce-workspace.c
@@ -149,7 +149,6 @@ backdrop_cycle_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 if(g_strcmp0(backdrop_file, new_backdrop) != 0) {
 xfce_backdro

[Xfce4-commits] Use an async message queue to load preview images

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 4d154b0614252950576b4ec49f067102f729c796 (commit)
   from 4e51013473eed4a9879267db7d48986061caddd9 (commit)

commit 4d154b0614252950576b4ec49f067102f729c796
Author: Eric Koegel 
Date:   Sat Mar 30 13:37:15 2013 +0300

Use an async message queue to load preview images

This patch uses the g_async_queue for message passing between the
main thread and the preview thread of the settings app. Doing this
gets rid of the idle timeout callback and a seperate thread loading
function. It also makes it easy to pop any pending previews when
the app changes what the icon view should display.

 settings/main.c |  171 +++
 1 file changed, 59 insertions(+), 112 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index fab16f9..d04904f 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -84,7 +84,7 @@
 typedef struct
 {
 GtkTreeModel *model;
-GSList *iters;
+GtkTreeIter *iter;
 } PreviewData;
 
 typedef struct
@@ -115,12 +115,10 @@ typedef struct
 GtkWidget *random_backdrop_order_chkbox;
 
 GThread *preview_thread;
-PreviewData *pdata;
+GAsyncQueue *preview_queue;
 
 XfdesktopThumbnailer *thumbnailer;
 
-gint request_timer_id;
-
 } AppearancePanel;
 
 enum
@@ -210,87 +208,62 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 }
 }
 
-static gpointer
-xfdesktop_settings_create_some_previews(gpointer data)
+static void
+xfdesktop_settings_free_pdata(gpointer data)
 {
 PreviewData *pdata = data;
-GSList *l;
-
-GDK_THREADS_ENTER ();
-
-for(l = pdata->iters; l && l->data != NULL; l = l->next)
-xfdesktop_settings_do_single_preview(pdata->model, l->data);
-
 g_object_unref(G_OBJECT(pdata->model));
-g_slist_foreach(pdata->iters, (GFunc)gtk_tree_iter_free, NULL);
-g_slist_free(pdata->iters);
+gtk_tree_iter_free(pdata->iter);
 g_free(pdata);
-
-GDK_THREADS_LEAVE ();
-
-return NULL;
 }
 
 static gpointer
-xfdesktop_settings_create_all_previews(gpointer data)
+xfdesktop_settings_create_previews(gpointer data)
 {
-GtkTreeModel *model = data;
-GtkTreeView *tree_view;
-GtkTreeIter iter;
-
-GDK_THREADS_ENTER ();
+AppearancePanel *panel = data;
+PreviewData *pdata = NULL;
 
-if(gtk_tree_model_get_iter_first(model, &iter)) {
-do {
-xfdesktop_settings_do_single_preview(model, &iter);
-} while(gtk_tree_model_iter_next(model, &iter));
-}
+while(panel->preview_queue != NULL) {
+pdata = g_async_queue_pop(panel->preview_queue);
 
-/* if possible, scroll to the selected image */
-tree_view = g_object_get_data(G_OBJECT(model), "xfdesktop-tree-view");
-if(tree_view) {
-GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
+GDK_THREADS_ENTER ();
 
-if(gtk_tree_selection_get_mode(selection) != GTK_SELECTION_MULTIPLE
-   && gtk_tree_selection_get_selected(selection, NULL, &iter))
-{
-GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
-gtk_tree_view_scroll_to_cell(tree_view, path, NULL, TRUE, 0.0, 
0.0);
-}
-}
-g_object_set_data(G_OBJECT(model), "xfdesktop-tree-view", NULL);
+xfdesktop_settings_do_single_preview(pdata->model, pdata->iter);
 
-GDK_THREADS_LEAVE ();
+xfdesktop_settings_free_pdata(pdata);
 
-g_object_unref(G_OBJECT(model));
+GDK_THREADS_LEAVE ();
+}
 
 return NULL;
 }
 
 static void
-cb_request_timer(gpointer data)
+xfdesktop_settings_add_file_to_queue(AppearancePanel *panel, PreviewData 
*pdata)
 {
-AppearancePanel *panel = data;
-PreviewData *pdata = panel->pdata;
-
 TRACE("entering");
 
-if(pdata == NULL)
-return;
+g_return_if_fail(panel != NULL);
+g_return_if_fail(pdata != NULL);
 
-panel->pdata = NULL;
-g_source_remove(panel->request_timer_id);
-panel->request_timer_id = 0;
+if(panel->preview_queue == NULL) {
+panel->preview_queue = 
g_async_queue_new_full(xfdesktop_settings_free_pdata);
+}
 
-if(!g_thread_try_new("xfdesktop_settings_create_some_previews",
- xfdesktop_settings_create_some_previews,
- pdata, NULL))
-{
-g_critical("Unable to create thread for image previews.");
-g_object_unref(G_OBJECT(pdata->model));
-g_slist_foreach(pdata->iters, (GFunc)gtk_tree_iter_free, NULL);
-g_slist_free(pdata->iters);
-g_free(pdata);
+g_async_queue_push(panel->preview_queue, pdata);
+
+if(panel->preview_thread == NULL) {
+panel->preview_thread = 
g_thread_try_new("xfdesktop_settings_create_previews",
+

[Xfce4-commits] Add an iconview tooltip

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to c4a10cc1524490d35a6afd7aa67cdd57c59729b8 (commit)
   from d51fb8ba1ca31f1f66f2855c4e514b80b88b15de (commit)

commit c4a10cc1524490d35a6afd7aa67cdd57c59729b8
Author: Eric Koegel 
Date:   Mon Mar 4 15:44:27 2013 +0300

Add an iconview tooltip

Add a tooltip letting the user know that the image style is set to
none and therefore they can't select a wallpaper in the iconview.

 settings/main.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/settings/main.c b/settings/main.c
index 239eab1..f82bd7c 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -848,8 +848,11 @@ cb_xfdesktop_combo_image_style_changed(GtkComboBox *combo,
 
 if(gtk_combo_box_get_active(combo) == XFCE_BACKDROP_IMAGE_NONE) {
 gtk_widget_set_sensitive(panel->image_iconview, FALSE);
+gtk_widget_set_tooltip_text(panel->image_iconview,
+_("Image selection is unavailable while 
the image style is set to None."));
 } else {
 gtk_widget_set_sensitive(panel->image_iconview, TRUE);
+gtk_widget_set_tooltip_text(panel->image_iconview, _("Select a 
background image for this display."));
 }
 }
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix memory leaks

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 594ea3b79117c866b8d2358dc2b44303572e0578 (commit)
   from 95542b215411106f404e21a443ddd1e7059fff1c (commit)

commit 594ea3b79117c866b8d2358dc2b44303572e0578
Author: Eric Koegel 
Date:   Sun Mar 17 13:36:54 2013 +0300

Fix memory leaks

 settings/main.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/settings/main.c b/settings/main.c
index 71f917f..3f00439 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -670,6 +670,7 @@ cb_image_selection_changed(GtkIconView *icon_view,
 xfconf_channel_set_string(panel->channel, buf, filename);
 }
 
+g_list_foreach (selected_items, (GFunc)gtk_tree_path_free, NULL);
 g_list_free(selected_items);
 g_free(current_filename);
 g_free(buf);
@@ -819,10 +820,13 @@ cb_folder_selection_changed(GtkWidget *button,
 TRACE("entering");
 
 /* Check to see if the folder actually did change */
-if(g_strcmp0(filename, previous_filename) == 0)
+if(g_strcmp0(filename, previous_filename) == 0) {
+g_free(filename);
 return;
+}
 
 TRACE("folder changed to: %s", filename);
+g_free(previous_filename);
 previous_filename = filename;
 
 xfdesktop_settings_stop_image_loading(panel);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix a warning message

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 95542b215411106f404e21a443ddd1e7059fff1c (commit)
   from 8e38b064c7c09c787d7af78efff4eaa59c235510 (commit)

commit 95542b215411106f404e21a443ddd1e7059fff1c
Author: Eric Koegel 
Date:   Sun Mar 17 09:37:18 2013 +0300

Fix a warning message

 src/xfce-desktop.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 11df13d..09f2e53 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -409,7 +409,9 @@ screen_size_changed_cb(GdkScreen *gscreen, gpointer 
user_data)
 TRACE("entering");
 
 g_return_if_fail(XFCE_IS_DESKTOP(desktop));
-g_return_if_fail(desktop->priv->workspaces);
+
+if(desktop->priv->workspaces == NULL)
+return;
 
 w = gdk_screen_get_width(gscreen);
 h = gdk_screen_get_height(gscreen);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change tooltips in xfdesktop-settings

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to b651fd1ebc1b4a93bb46c8dc265849a73155fe20 (commit)
   from 520f3055a62a5c125be42127bd81a6bf705d760c (commit)

commit b651fd1ebc1b4a93bb46c8dc265849a73155fe20
Author: Eric Koegel 
Date:   Fri Apr 12 14:10:56 2013 +0300

Change tooltips in xfdesktop-settings

Since the tooltips were reporting the image size of the thumbnails
and parsing the original file just to get the image dimensions is
slow, this patch changes it to pull the content type and file size
to populate the tooltip with. Also fixed how tooltips in the icon
view popped up so that it follows the mouse when it is sensitive.

 settings/main.c |   62 ++-
 1 file changed, 39 insertions(+), 23 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 1e0df52..2365c90 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -163,12 +163,11 @@ static void
 xfdesktop_settings_do_single_preview(GtkTreeModel *model,
  GtkTreeIter *iter)
 {
-gchar *name = NULL, *new_name = NULL, *filename = NULL, *thumbnail = NULL;
+gchar *filename = NULL, *thumbnail = NULL;
 GdkPixbuf *pix, *pix_scaled = NULL;
 
 GDK_THREADS_ENTER ();
 gtk_tree_model_get(model, iter,
-   COL_NAME, &name,
COL_FILENAME, &filename,
COL_THUMBNAIL, &thumbnail,
-1);
@@ -188,10 +187,6 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 
 width = gdk_pixbuf_get_width(pix);
 height = gdk_pixbuf_get_height(pix);
-/* no need to escape markup; it's already done for us */
-new_name = g_strdup_printf(_("%s\nSize: %dx%d"),
-   name, width, height);
-
 aspect = (gdouble)width / height;
 
 /* Keep the aspect ratio sensible otherwise the treeview looks bad */
@@ -206,16 +201,6 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 
 g_object_unref(G_OBJECT(pix));
 }
-g_free(name);
-
-if(new_name) {
-GDK_THREADS_ENTER ();
-gtk_list_store_set(GTK_LIST_STORE(model), iter,
-   COL_NAME, new_name,
-   -1);
-GDK_THREADS_LEAVE ();
-g_free(new_name);
-}
 
 if(pix_scaled) {
 GDK_THREADS_ENTER ();
@@ -469,12 +454,15 @@ image_list_compare(GtkTreeModel *model,
 static GtkTreeIter *
 xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
   const char *path,
+  GFileInfo *info,
   AppearancePanel *panel)
 {
 gboolean added = FALSE, found = FALSE, valid = FALSE;
 GtkTreeIter iter, search_iter;
-gchar *name = NULL, *name_utf8 = NULL, *name_markup = NULL;
+gchar *name = NULL, *name_utf8 = NULL, *name_markup = NULL, *size_string = 
NULL;
 gint position = 0;
+const gchar *content_type = g_file_info_get_content_type(info);
+goffset file_size = g_file_info_get_size(info);
 
 if(!xfdesktop_image_file_is_valid(path))
 return NULL;
@@ -484,8 +472,15 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 name_utf8 = g_filename_to_utf8(name, strlen(name),
NULL, NULL, NULL);
 if(name_utf8) {
-name_markup = g_markup_printf_escaped("%s",
-  name_utf8);
+#if GLIB_CHECK_VERSION (2, 30, 0)
+size_string = g_format_size(file_size);
+#else
+size_string = g_format_size_for_display(file_size);
+#endif
+
+/* Display the file name, file type, and file size in the tooltip. 
*/
+name_markup = g_markup_printf_escaped(_("%s\nType: 
%s\nSize: %s"),
+  name_utf8, content_type, 
size_string);
 
 /* Insert sorted */
 valid = gtk_tree_model_get_iter_first(model, &search_iter);
@@ -513,6 +508,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 g_free(name);
 g_free(name_utf8);
 g_free(name_markup);
+g_free(size_string);
 
 if(added)
 return gtk_tree_iter_copy(&iter);
@@ -545,7 +541,7 @@ xfdesktop_image_list_add_item(gpointer user_data)
 const gchar *file_name = g_file_info_get_name(info);
 gchar *buf = g_strconcat(dir_data->file_path, "/", file_name, NULL);
 
-iter = 
xfdesktop_settings_image_iconview_add(GTK_TREE_MODEL(dir_data->ls), buf, panel);
+iter = 
xfdesktop_settings_image_iconview_add(GTK_TREE_MODEL(dir_data->ls), buf, info, 
panel);
 if(iter) {
 if(!dir_data->selected_iter &&
!strcmp(buf, dir_data->last_image))
@@ -920,7 +916,7 @@ cb_folder

[Xfce4-commits] Align folder and color style combo boxes

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 9587dfd4a006c121ceceb068b969093956b24fc0 (commit)
   from 8b8cdbe39e3218eb59135681aae0f816849099f6 (commit)

commit 9587dfd4a006c121ceceb068b969093956b24fc0
Author: Eric Koegel 
Date:   Fri Apr 12 10:53:53 2013 +0300

Align folder and color style combo boxes

Packed the folder, color, and image styles into a GtkTable to
align things better. Also removed some unneeded Gtk containers
from the glade file and labeled the id's to be more descriptive.

 .../xfdesktop-settings-appearance-frame-ui.glade   |  503 +++-
 1 file changed, 269 insertions(+), 234 deletions(-)

diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index d838190..8f40ae8 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -34,261 +34,296 @@
 12
 6
 
-  
+  
 True
-6
+0
+GTK_SHADOW_NONE
 
-  
+  
 True
-12
+6
 
-  
+  
 True
-0
-GTK_SHADOW_NONE
+6
 
-  
+  
 True
-6
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+GTK_POLICY_AUTOMATIC
+GTK_POLICY_AUTOMATIC
+GTK_SHADOW_ETCHED_IN
 
-  
+  
 True
-6
-
-  
-True
-True
-GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-GTK_POLICY_AUTOMATIC
-GTK_POLICY_AUTOMATIC
-GTK_SHADOW_ETCHED_IN
-
-  
-True
-True
-GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-  
-
-  
-
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+  
+
+  
+  
+True
+0
+  
+
+
+  
+True
+8
+2
+6
+
+  
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+Folder:
+True
+  
+  
+0
+1
+0
+1
+GTK_SHRINK
+GTK_SHRINK
+  
+
+
+  
+True
+True
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+Add 
an image to the list
+GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+  
+  
+1
+2
+0
+1
+GTK_FILL|GTK_EXPAND
+GTK_SHRINK
+  
+
+
+  
+True
+  
+  
+4
+5
+0
+1
+GTK_FILL|GTK_EXPAND
+GTK_SHRINK
+  
+
+
+  
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+St_yle:
+True
+combo_

[Xfce4-commits] Use a collation key when sorting wallpapers

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to de3e0239693bbde88a32805541d5decdbef4b9b3 (commit)
   from 066b3f13732fe54d2cf54cc031664a7b023235e0 (commit)

commit de3e0239693bbde88a32805541d5decdbef4b9b3
Author: Eric Koegel 
Date:   Fri Apr 19 11:46:09 2013 +0300

Use a collation key when sorting wallpapers

 settings/main.c |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 5fdd184..b321a54 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -141,6 +141,7 @@ enum
 COL_NAME,
 COL_FILENAME,
 COL_THUMBNAIL,
+COL_COLLATE_KEY,
 N_COLS,
 };
 
@@ -442,7 +443,7 @@ image_list_compare(GtkTreeModel *model,
 gchar *key_b = NULL;
 gint ret;
 
-gtk_tree_model_get(model, b, COL_NAME, &key_b, -1);
+gtk_tree_model_get(model, b, COL_COLLATE_KEY, &key_b, -1);
 
 ret = g_strcmp0(a, key_b);
 
@@ -460,6 +461,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 gboolean added = FALSE, found = FALSE, valid = FALSE;
 GtkTreeIter iter, search_iter;
 gchar *name = NULL, *name_utf8 = NULL, *name_markup = NULL, *size_string = 
NULL;
+gchar *collate_key = NULL;
 gint position = 0;
 const gchar *content_type = g_file_info_get_content_type(info);
 goffset file_size = g_file_info_get_size(info);
@@ -469,7 +471,8 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 
 name = g_path_get_basename(path);
 if(name) {
-name_utf8 = g_filename_to_utf8(name, strlen(name),
+guint name_length = strlen(name);
+name_utf8 = g_filename_to_utf8(name, name_length,
NULL, NULL, NULL);
 if(name_utf8) {
 #if GLIB_CHECK_VERSION (2, 30, 0)
@@ -482,10 +485,14 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 name_markup = g_markup_printf_escaped(_("%s\nType: 
%s\nSize: %s"),
   name_utf8, content_type, 
size_string);
 
+/* create a case sensitive collation key for sorting filenames like
+ * Thunar does */
+collate_key = g_utf8_collate_key_for_filename(name, name_length);
+
 /* Insert sorted */
 valid = gtk_tree_model_get_iter_first(model, &search_iter);
 while(valid && !found) {
-if(image_list_compare(model, name_markup, &search_iter) <= 0) {
+if(image_list_compare(model, collate_key, &search_iter) <= 0) {
 found = TRUE;
 } else {
 valid = gtk_tree_model_iter_next(model, &search_iter);
@@ -498,6 +505,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
   position,
   COL_NAME, name_markup,
   COL_FILENAME, path,
+  COL_COLLATE_KEY, collate_key,
   -1);
 xfdesktop_settings_queue_preview(model, &iter, panel);
 
@@ -509,6 +517,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 g_free(name_utf8);
 g_free(name_markup);
 g_free(size_string);
+g_free(collate_key);
 
 if(added)
 return gtk_tree_iter_copy(&iter);
@@ -602,7 +611,7 @@ xfdesktop_image_list_add_dir(GObject *source_object,
 dir_data->panel = panel;
 
 dir_data->ls = gtk_list_store_new(N_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
-  G_TYPE_STRING, G_TYPE_STRING);
+  G_TYPE_STRING, G_TYPE_STRING, 
G_TYPE_STRING);
 
 /* Get the last image/current image displayed so we can select it in the
  * icon view */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix memory leaks

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 13fd293590da7934f61bf59129080ec535b5b9d8 (commit)
   from de3e0239693bbde88a32805541d5decdbef4b9b3 (commit)

commit 13fd293590da7934f61bf59129080ec535b5b9d8
Author: Eric Koegel 
Date:   Sat Apr 27 15:41:02 2013 +0300

Fix memory leaks

Use the destroy notify callback when adding items to remove duplicated
code. Also found and fixed a couple memory leaks.

 settings/main.c|   94 ++--
 src/xfce-desktop.c |   16 +
 2 files changed, 63 insertions(+), 47 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index b321a54..675809c 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -119,7 +119,7 @@ typedef struct
 
 XfdesktopThumbnailer *thumbnailer;
 
-GFile *selected_file;
+GFile *selected_folder;
 GCancellable *cancel_enumeration;
 guint add_dir_idle_id;
 
@@ -226,9 +226,10 @@ static gpointer
 xfdesktop_settings_create_previews(gpointer data)
 {
 AppearancePanel *panel = data;
-PreviewData *pdata = NULL;
 
 while(panel->preview_queue != NULL) {
+PreviewData *pdata = NULL;
+
 /* Block and wait for another preview to create */
 pdata = g_async_queue_pop(panel->preview_queue);
 
@@ -525,6 +526,28 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 return NULL;
 }
 
+static void
+cb_destroy_add_dir_enumeration(gpointer user_data)
+{
+AddDirData *dir_data = user_data;
+AppearancePanel *panel = dir_data->panel;
+
+TRACE("entering");
+
+g_free(dir_data->file_path);
+g_free(dir_data->last_image);
+
+if(G_IS_FILE_ENUMERATOR(dir_data->file_enumerator))
+g_object_unref(dir_data->file_enumerator);
+
+g_free(dir_data);
+
+if(panel->cancel_enumeration) {
+g_object_unref(panel->cancel_enumeration);
+panel->cancel_enumeration = NULL;
+}
+}
+
 static gboolean
 xfdesktop_image_list_add_item(gpointer user_data)
 {
@@ -532,22 +555,13 @@ xfdesktop_image_list_add_item(gpointer user_data)
 AppearancePanel *panel = dir_data->panel;
 GFileInfo *info;
 GtkTreeIter *iter;
-GtkTreePath *path;
-
-/* If the enumeration gets canceled/destroyed we need to clean up */
-if(!G_IS_FILE_ENUMERATOR(dir_data->file_enumerator)) {
-g_free(dir_data->file_path);
-g_free(dir_data->last_image);
-g_free(dir_data);
-
-if(panel->cancel_enumeration) {
-g_object_unref(panel->cancel_enumeration);
-panel->cancel_enumeration = NULL;
-}
 
+/* If the enumeration gets canceled/destroyed return and
+ * cb_destroy_add_dir_enumeration will get called to clean up */
+if(!G_IS_FILE_ENUMERATOR(dir_data->file_enumerator))
 return FALSE;
-}
 
+/* Add one item to the icon view at a time so we don't block the UI */
 if((info = g_file_enumerator_next_file(dir_data->file_enumerator, NULL, 
NULL))) {
 const gchar *file_name = g_file_info_get_name(info);
 gchar *buf = g_strconcat(dir_data->file_path, "/", file_name, NULL);
@@ -577,23 +591,16 @@ xfdesktop_image_list_add_item(gpointer user_data)
 
 /* last_image is in the directory added then it should be selected */
 if(dir_data->selected_iter) {
+GtkTreePath *path;
 path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_data->ls), 
dir_data->selected_iter);
 if(path) {
 gtk_icon_view_select_path(GTK_ICON_VIEW(panel->image_iconview), 
path);
 gtk_tree_iter_free(dir_data->selected_iter);
+gtk_tree_path_free(path);
 }
  }
 
-g_free(dir_data->file_path);
-g_free(dir_data->last_image);
-g_object_unref(dir_data->file_enumerator);
-g_free(dir_data);
-
-if(panel->cancel_enumeration) {
-g_object_unref(panel->cancel_enumeration);
-panel->cancel_enumeration = NULL;
-}
-
+/* cb_destroy_add_dir_enumeration will get called to clean up */
 return FALSE;
 }
 
@@ -619,15 +626,18 @@ xfdesktop_image_list_add_dir(GObject *source_object,
 
 dir_data->last_image = xfconf_channel_get_string(panel->channel, property, 
DEFAULT_BACKDROP);
 
-dir_data->file_path = g_file_get_path(panel->selected_file);
+dir_data->file_path = g_file_get_path(panel->selected_folder);
 
-dir_data->file_enumerator = 
g_file_enumerate_children_finish(panel->selected_file,
+dir_data->file_enumerator = 
g_file_enumerate_children_finish(panel->selected_folder,
  res,
  NULL);
 
 /* Individual items are added in an idle callback so everything is more
  * responsive */
-panel->add_dir_idle_id = g_idle_add(xfdesktop_image_list_add_item, 
dir_da

[Xfce4-commits] Set the column spacing to 12

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 799811c5b53c53552067af5418f2ae7b7ceddff9 (commit)
   from 13fd293590da7934f61bf59129080ec535b5b9d8 (commit)

commit 799811c5b53c53552067af5418f2ae7b7ceddff9
Author: Eric Koegel 
Date:   Tue Apr 30 19:01:31 2013 +0300

Set the column spacing to 12

 settings/xfdesktop-settings-appearance-frame-ui.glade |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index 8f40ae8..32e10c0 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -73,6 +73,7 @@
 8
 2
 6
+12
 
   
 True
@@ -270,7 +271,7 @@
   
 True
 GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-4
+12
 
   
 True
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] xfdesktop-settings is more responsive

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 3ea195b2ac3223a4c2de1e7eeb30b3461eb4994e (commit)
   from 4d154b0614252950576b4ec49f067102f729c796 (commit)

commit 3ea195b2ac3223a4c2de1e7eeb30b3461eb4994e
Author: Eric Koegel 
Date:   Sat Apr 6 15:45:38 2013 +0300

xfdesktop-settings is more responsive

Changed to using g_file_enumerate_children_async and enumerating
each file individually in an idle callback function to keep things
responsive while loading large directories of images. This is also
cancellable so that when the user moves the window to a different
monitor or workspace it will respond faster.

 settings/main.c |  268 ---
 1 file changed, 176 insertions(+), 92 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index d04904f..0f7f8d9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -119,15 +119,29 @@ typedef struct
 
 XfdesktopThumbnailer *thumbnailer;
 
+GFile *selected_file;
+GCancellable *cancel_enumeration;
+guint add_dir_idle_id;
+
 } AppearancePanel;
 
+typedef struct
+{
+GFileEnumerator *file_enumerator;
+GtkListStore *ls;
+GtkTreeIter *selected_iter;
+gchar *last_image;
+gchar *file_path;
+gchar *cur_image_file;
+AppearancePanel *panel;
+} AddDirData;
+
 enum
 {
 COL_PIX = 0,
 COL_NAME,
 COL_FILENAME,
 COL_THUMBNAIL,
-COL_COLLATE_KEY,
 N_COLS,
 };
 
@@ -142,10 +156,10 @@ enum
 
 static void cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
   gpointer user_data);
+static gchar 
*xfdesktop_settings_generate_per_workspace_binding_string(AppearancePanel 
*panel,
+   const 
gchar* property);
 
 
-/* assumes gdk lock is held on function enter, and should be held
- * on function exit */
 static void
 xfdesktop_settings_do_single_preview(GtkTreeModel *model,
  GtkTreeIter *iter)
@@ -153,11 +167,13 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 gchar *name = NULL, *new_name = NULL, *filename = NULL, *thumbnail = NULL;
 GdkPixbuf *pix, *pix_scaled = NULL;
 
+GDK_THREADS_ENTER ();
 gtk_tree_model_get(model, iter,
COL_NAME, &name,
COL_FILENAME, &filename,
COL_THUMBNAIL, &thumbnail,
-1);
+GDK_THREADS_LEAVE ();
 
 if(thumbnail == NULL) {
 pix = gdk_pixbuf_new_from_file(filename, NULL);
@@ -194,16 +210,20 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 g_free(name);
 
 if(new_name) {
+GDK_THREADS_ENTER ();
 gtk_list_store_set(GTK_LIST_STORE(model), iter,
COL_NAME, new_name,
-1);
+GDK_THREADS_LEAVE ();
 g_free(new_name);
 }
 
 if(pix_scaled) {
+GDK_THREADS_ENTER ();
 gtk_list_store_set(GTK_LIST_STORE(model), iter,
COL_PIX, pix_scaled,
-1);
+GDK_THREADS_LEAVE ();
 g_object_unref(G_OBJECT(pix_scaled));
 }
 }
@@ -224,15 +244,12 @@ xfdesktop_settings_create_previews(gpointer data)
 PreviewData *pdata = NULL;
 
 while(panel->preview_queue != NULL) {
+/* Block and wait for another preview to create */
 pdata = g_async_queue_pop(panel->preview_queue);
 
-GDK_THREADS_ENTER ();
-
 xfdesktop_settings_do_single_preview(pdata->model, pdata->iter);
 
 xfdesktop_settings_free_pdata(pdata);
-
-GDK_THREADS_LEAVE ();
 }
 
 return NULL;
@@ -246,12 +263,14 @@ xfdesktop_settings_add_file_to_queue(AppearancePanel 
*panel, PreviewData *pdata)
 g_return_if_fail(panel != NULL);
 g_return_if_fail(pdata != NULL);
 
+/* Create the queue if it doesn't exist */
 if(panel->preview_queue == NULL) {
 panel->preview_queue = 
g_async_queue_new_full(xfdesktop_settings_free_pdata);
 }
 
 g_async_queue_push(panel->preview_queue, pdata);
 
+/* Create the thread if it doesn't exist */
 if(panel->preview_thread == NULL) {
 panel->preview_thread = 
g_thread_try_new("xfdesktop_settings_create_previews",
  
xfdesktop_settings_create_previews,
@@ -259,10 +278,10 @@ xfdesktop_settings_add_file_to_queue(AppearancePanel 
*panel, PreviewData *pdata)
 if(panel->preview_thread == NULL)
 {
 g_critical("Unable to create thread for image previews.");
+/* Don't block but try to remove the data from the queue
+ * since we won't be creating previews */
 if(g_async_queue_try_pop(panel->preview_queue))
 xfdesktop_settings_free_pdata(pdata);
-
-retur

[Xfce4-commits] Change wallpaper iconview spacing and max width

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 520f3055a62a5c125be42127bd81a6bf705d760c (commit)
   from 9587dfd4a006c121ceceb068b969093956b24fc0 (commit)

commit 520f3055a62a5c125be42127bd81a6bf705d760c
Author: Eric Koegel 
Date:   Fri Apr 12 11:08:51 2013 +0300

Change wallpaper iconview spacing and max width

Changed the max aspect ratio of the xfdesktop-settings iconview
so it would pack the images better. Removed some of the row and
column spacing and increased the item-padding so that the selected
item stands out better.

 settings/main.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 7c167ab..1e0df52 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -55,7 +55,7 @@
 #include "xfdesktop-settings-appearance-frame-ui.h"
 
 #define PREVIEW_HEIGHT  96
-#define MAX_ASPECT_RATIO 2.0f
+#define MAX_ASPECT_RATIO 1.5f
 
 #define SHOW_DESKTOP_MENU_PROP   "/desktop-menu/show"
 #define DESKTOP_MENU_SHOW_ICONS_PROP "/desktop-menu/show-icons"
@@ -1220,7 +1220,9 @@ xfdesktop_settings_setup_image_iconview(AppearancePanel 
*panel)
 "pixbuf-column", COL_PIX,
 "tooltip-column", COL_NAME,
 "selection-mode", GTK_SELECTION_BROWSE,
-"column-spacing", 2,
+"column-spacing", 1,
+"row-spacing", 1,
+"item-padding", 10,
 "margin", 2,
 NULL);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Support xfdesktop-settings as a pinned window

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 066b3f13732fe54d2cf54cc031664a7b023235e0 (commit)
   from b651fd1ebc1b4a93bb46c8dc265849a73155fe20 (commit)

commit 066b3f13732fe54d2cf54cc031664a7b023235e0
Author: Eric Koegel 
Date:   Fri Apr 12 14:50:36 2013 +0300

Support xfdesktop-settings as a pinned window

 settings/main.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 2365c90..5fdd184 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -535,6 +535,8 @@ xfdesktop_image_list_add_item(gpointer user_data)
 g_object_unref(panel->cancel_enumeration);
 panel->cancel_enumeration = NULL;
 }
+
+return FALSE;
 }
 
 if((info = g_file_enumerator_next_file(dir_data->file_enumerator, NULL, 
NULL))) {
@@ -631,6 +633,11 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
 if(panel->monitor < 0 && panel->workspace < 0)
 return;
 
+if(wnck_workspace == NULL) {
+WnckScreen *wnck_screen = wnck_window_get_screen(panel->wnck_window);
+wnck_workspace = wnck_screen_get_active_workspace(wnck_screen);
+}
+
 workspace_name = g_strdup(wnck_workspace_get_name(wnck_workspace));
 
 
if(gdk_screen_get_n_monitors(gtk_widget_get_screen(panel->chk_apply_to_all)) > 
1) {
@@ -750,10 +757,16 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
 WnckWorkspace *wnck_workspace;
 gboolean single_workspace;
 gint workspace_num, single_workspace_num;
+WnckScreen *wnck_screen = wnck_window_get_screen(wnck_window);
 
 wnck_workspace = wnck_window_get_workspace(wnck_window);
 
-workspace_num = wnck_workspace_get_number(wnck_workspace);
+if(wnck_workspace != NULL) {
+workspace_num = wnck_workspace_get_number(wnck_workspace);
+} else {
+workspace_num = 
wnck_workspace_get_number(wnck_screen_get_active_workspace(wnck_screen));
+}
+
 
 single_workspace = xfconf_channel_get_bool(panel->channel,
SINGLE_WORKSPACE_MODE,
@@ -763,7 +776,6 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
  * it was set to, if that workspace exists, otherwise return the current
  * workspace and turn off the single workspace mode */
 if(single_workspace) {
-WnckScreen *wnck_screen = wnck_window_get_screen(wnck_window);
 single_workspace_num = xfconf_channel_get_int(panel->channel,
   SINGLE_WORKSPACE_NUMBER,
   0);
@@ -1335,6 +1347,8 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  G_CALLBACK(cb_workspace_changed), panel);
 g_signal_connect(wnck_screen, "workspace-destroyed",
  G_CALLBACK(cb_workspace_changed), panel);
+g_signal_connect(wnck_screen, "active-workspace-changed",
+G_CALLBACK(cb_workspace_changed), panel);
 g_signal_connect(G_OBJECT(screen), "monitors-changed",
  G_CALLBACK(cb_monitor_changed), panel);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change lable to read: Apply to all workspaces

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to 8b8cdbe39e3218eb59135681aae0f816849099f6 (commit)
   from 6d78e6bc921b4a4b408af0e6c94aaf682ea3c5fd (commit)

commit 8b8cdbe39e3218eb59135681aae0f816849099f6
Author: Eric Koegel 
Date:   Fri Apr 12 09:09:49 2013 +0300

Change lable to read: Apply to all workspaces

 settings/xfdesktop-settings-appearance-frame-ui.glade |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index b928932..d838190 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -221,7 +221,7 @@
 True
 True
 GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-_Use these settings 
for all workspaces
+Apply to all 
_workspaces
 True
 True
   
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] More consistent icon placement (Bug #8814)

2013-08-04 Thread Eric Koegel
Updating branch refs/heads/master
 to b73e824438ed12d85e63d601dcc117165b648daf (commit)
   from bf859f1caef83338e4c5c5725b55009abe68457d (commit)

commit b73e824438ed12d85e63d601dcc117165b648daf
Author: Eric Koegel 
Date:   Sun Apr 21 10:05:14 2013 +0300

More consistent icon placement (Bug #8814)

When the screen size changes, icons are loaded from the icon cache
if the position is available, then an attempt is made to re-locate
the icon at its original position before the change event, if that
is still available, and finally any leftover icons are appended to
any free position. This should help keep the icons where the user
would like them to be.

 src/xfdesktop-file-icon-manager.c |   18 ++--
 src/xfdesktop-icon-view.c |  171 +++--
 2 files changed, 118 insertions(+), 71 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 8f4d72a..ae4ffc2 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1691,7 +1691,9 @@ xfdesktop_file_icon_manager_save_icons(gpointer user_data)
 path = xfce_resource_save_location(XFCE_RESOURCE_CONFIG, relpath, TRUE);
 if(!path)
 return FALSE;
-
+
+DBG("saving to: %s", path);
+
 tmppath = g_strconcat(path, ".new", NULL);
 
 rcfile = xfce_rc_simple_open(tmppath, FALSE);
@@ -1714,11 +1716,15 @@ xfdesktop_file_icon_manager_save_icons(gpointer 
user_data)
 
 xfce_rc_flush(rcfile);
 xfce_rc_close(rcfile);
-
-if(rename(tmppath, path)) {
-g_warning("Unable to rename temp file to %s: %s", path,
-  strerror(errno));
-unlink(tmppath);
+
+if(g_file_test(tmppath, G_FILE_TEST_EXISTS)) {
+if(rename(tmppath, path)) {
+g_warning("Unable to rename temp file to %s: %s", path,
+  strerror(errno));
+unlink(tmppath);
+}
+} else {
+DBG("didn't write anything in the RC file, desktop is probably empty");
 }
 
 g_free(path);
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index cf03485..4ae5b53 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -1682,20 +1682,6 @@ xfdesktop_icon_view_compare_icons(gconstpointer *a,
 }
 
 static void
-xfdesktop_move_icon_from_pending_list_to_icons_list(XfdesktopIconView 
*icon_view,
-XfdesktopIcon *icon)
-{
-GList *pending_icons = icon_view->priv->pending_icons;
-GList *icon_list = icon_view->priv->icons;
-
-if(g_list_find(pending_icons, icon)) {
-/* Add the icon to the icon list and remove from the pending list */
-icon_list = g_list_append(icon_list, icon);
-pending_icons = g_list_remove(pending_icons, icon);
-}
-}
-
-static void
 xfdesktop_icon_view_append_icons(XfdesktopIconView *icon_view,
  GList *icon_list,
  guint16 *row,
@@ -1722,38 +1708,6 @@ xfdesktop_icon_view_append_icons(XfdesktopIconView 
*icon_view,
 }
 }
 
-static void
-xfdesktop_icon_view_append_pending_icons(XfdesktopIconView *icon_view)
-{
-GList *l = NULL;
-guint16 row = 0, col = 0;
-
-for(l = icon_view->priv->pending_icons; l != NULL; l = g_list_next(l)) {
-
-/* Find the next available spot for an icon */
-do {
-if(row + 1 >= icon_view->priv->nrows) {
-++col;
-row = 0;
-} else {
-++row;
-}
-
-/* Check that we haven't ran out of space */
-if(col > icon_view->priv->ncols)
-return;
-} while(!xfdesktop_grid_is_free_position(icon_view, row, col));
-
-/* set new position */
-xfdesktop_icon_set_position(l->data, row, col);
-xfdesktop_grid_unset_position_free(icon_view, l->data);
-
-xfdesktop_move_icon_from_pending_list_to_icons_list(icon_view, 
l->data);
-
-xfdesktop_icon_view_invalidate_icon(icon_view, l->data, TRUE);
-}
-}
-
 void
 xfdesktop_icon_view_sort_icons(XfdesktopIconView *icon_view)
 {
@@ -3136,56 +3090,130 @@ 
xfdesktop_move_all_icons_to_pending_icons_list(XfdesktopIconView *icon_view)
 icon_view->priv->pending_icons = g_list_concat(icon_view->priv->icons,

icon_view->priv->pending_icons);
 icon_view->priv->icons = NULL;
-
-DUMP_GRID_LAYOUT(icon_view);
-
+
 memset(icon_view->priv->grid_layout, 0,
icon_view->priv->nrows * icon_view->priv->ncols
* sizeof(XfdesktopIcon *));
 
 xfdesktop_setup_grids(icon_view);
-
-DUMP_GRID_LAYOUT(icon_view);
 }
 
+/* When changing resolutions this 

[Xfce4-commits] Fix for CTRL + drag selections (Bug 10275)

2013-08-05 Thread Eric Koegel
Updating branch refs/heads/master
 to bb9350184566231b0fbf1c03ff54d26d44dc7d8c (commit)
   from b73e824438ed12d85e63d601dcc117165b648daf (commit)

commit bb9350184566231b0fbf1c03ff54d26d44dc7d8c
Author: Eric Koegel 
Date:   Mon Aug 5 11:57:57 2013 +0300

Fix for CTRL + drag selections (Bug 10275)

When a rubber band selection area shrinks, the icon must be in the
old rubber band area and not in the new one for it to be removed.
Otherwise, when doing a rubber band with the CTRL modifier key any
time the area shrinks it will de-select all the icons that weren't
in the new rubber band area.

 src/xfdesktop-icon-view.c |4 
 1 file changed, 4 insertions(+)

diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 4ae5b53..6a8f223 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -1151,7 +1151,11 @@ xfdesktop_icon_view_motion_notify(GtkWidget *widget,
 GdkRectangle extents, dummy;
 XfdesktopIcon *icon = l->data;
 
+/* To be removed, it must intersect the old rectangle and
+ * not intersect the new one. This way CTRL + rubber band
+ * works properly (Bug 10275) */
 if(xfdesktop_icon_get_extents(icon, NULL, NULL, &extents)
+   && gdk_rectangle_intersect(&extents, &old_rect, NULL)
&& !gdk_rectangle_intersect(&extents, new_rect, &dummy))
 {
 /* remove the icon from the selected list */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix a crash when changing icon types

2013-08-11 Thread Eric Koegel
Updating branch refs/heads/master
 to 144ef9abcb876f5d432eed48e464aaa1c9a1fc05 (commit)
   from 22ec2563c8bc7526f01e7758c001190d44cc8a6f (commit)

commit 144ef9abcb876f5d432eed48e464aaa1c9a1fc05
Author: Eric Koegel 
Date:   Sun Aug 11 14:36:57 2013 +0300

Fix a crash when changing icon types

 src/xfdesktop-file-icon-manager.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index ae4ffc2..ed4fcde 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1761,6 +1761,9 @@ 
xfdesktop_file_icon_manager_get_cached_icon_position(XfdesktopFileIconManager *f
 gboolean ret = FALSE;
 gint x = 0, y = 0, width = 0, height = 0;
 
+if(!fmanager || !fmanager->priv)
+return FALSE;
+
 xfdesktop_get_workarea_single(fmanager->priv->icon_view,
   0,
   &x,
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Creating branch eric/icon-changes

2013-08-12 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 as new branch
 to 2cdfde11b827b97576347c2eacb043780abc9415 (commit)

Branches are created implicitly by pushing. This mail only exists to 
let you know that there was code pushed to 

  refs/heads/eric/icon-changes

for the first time. Mails for the commits that lead to the creation 
of the branch will follow after this mail.
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Use GIcons and add support for emblems on icons

2013-08-12 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to bc48d533bd0dbaaad8d865bd6f26bc9c8f47e042 (commit)
   from e2af8b45c6bb1a7f18cd8ac36c072fd024cfa664 (commit)

commit bc48d533bd0dbaaad8d865bd6f26bc9c8f47e042
Author: Eric Koegel 
Date:   Mon Aug 12 12:24:13 2013 +0300

Use GIcons and add support for emblems on icons

 common/xfdesktop-common.h |3 +-
 src/xfdesktop-file-icon-manager.c |8 +-
 src/xfdesktop-file-icon.c |   54 ++
 src/xfdesktop-file-icon.h |5 +
 src/xfdesktop-file-utils.c|  151 
 src/xfdesktop-file-utils.h|4 +-
 src/xfdesktop-regular-file-icon.c |  196 ++---
 src/xfdesktop-special-file-icon.c |   84 +---
 src/xfdesktop-volume-icon.c   |   53 +-
 9 files changed, 353 insertions(+), 205 deletions(-)

diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index b34d7b5..cda8f75 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -64,7 +64,8 @@
   "time::*," \
   "thumbnail::*," \
   "trash::*," \
-  "unix::*"
+  "unix::*," \
+  "metadata::*"
 
 /**
  * Filesystem information namespaces queried for #GFileInfo * objects.
diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index ed4fcde..4ec88b9 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1827,12 +1827,16 @@ 
xfdesktop_file_icon_manager_add_icon(XfdesktopFileIconManager *fmanager,
 gboolean do_add = FALSE;
 const gchar *name;
 GFile *file;
+gchar *path = NULL;
 
 file = xfdesktop_file_icon_peek_file(icon);
 
-if(fmanager->priv->show_thumbnails && g_file_get_path(file) != NULL) {
+if(file != NULL)
+path = g_file_get_path(file);
+
+if(fmanager->priv->show_thumbnails && path != NULL) {
 xfdesktop_thumbnailer_queue_thumbnail(fmanager->priv->thumbnailer,
-  g_file_get_path(file));
+  path);
 }
 
 
diff --git a/src/xfdesktop-file-icon.c b/src/xfdesktop-file-icon.c
index 1088e99..f90bf04 100644
--- a/src/xfdesktop-file-icon.c
+++ b/src/xfdesktop-file-icon.c
@@ -53,11 +53,16 @@ xfdesktop_file_icon_class_init(XfdesktopFileIconClass 
*klass)
 static void
 xfdesktop_file_icon_init(XfdesktopFileIcon *icon)
 {
+icon->gicon = NULL;
 }
 
 static void
 xfdesktop_file_icon_finalize(GObject *obj)
 {
+XfdesktopFileIcon *icon = XFDESKTOP_FILE_ICON(obj);
+
+xfdesktop_file_icon_invalidate_icon(icon);
+
 G_OBJECT_CLASS(xfdesktop_file_icon_parent_class)->finalize(obj);
 }
 
@@ -178,3 +183,52 @@ xfdesktop_file_icon_can_delete_file(XfdesktopFileIcon 
*icon)
 else
 return FALSE;
 }
+
+void
+xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
+{
+GIcon *emblemed_icon = NULL;
+gchar **emblem_names;
+
+TRACE("entering");
+
+g_return_if_fail(XFDESKTOP_IS_FILE_ICON(icon));
+
+if(G_IS_ICON(icon->gicon))
+emblemed_icon = g_emblemed_icon_new(icon->gicon, NULL);
+else
+return;
+
+/* Get the list of emblems */
+emblem_names = 
g_file_info_get_attribute_stringv(xfdesktop_file_icon_peek_file_info(icon),
+ "metadata::emblems");
+
+if(emblem_names != NULL) {
+/* for each item in the list create an icon, pack it into an emblem,
+ * and attach it to our icon. */
+for (; *emblem_names != NULL; ++emblem_names) {
+GIcon *themed_icon = g_themed_icon_new(*emblem_names);
+GEmblem *emblem = g_emblem_new(themed_icon);
+
+g_emblemed_icon_add_emblem(G_EMBLEMED_ICON(emblemed_icon), emblem);
+
+g_object_unref(emblem);
+g_object_unref(themed_icon);
+}
+} else
+
+/* Clear out the old icon and set the new one */
+xfdesktop_file_icon_invalidate_icon(icon);
+icon->gicon = emblemed_icon;
+}
+
+void
+xfdesktop_file_icon_invalidate_icon(XfdesktopFileIcon *icon)
+{
+g_return_if_fail(XFDESKTOP_IS_FILE_ICON(icon));
+
+if(G_IS_ICON(icon->gicon)) {
+g_object_unref(icon->gicon);
+icon->gicon = NULL;
+}
+}
diff --git a/src/xfdesktop-file-icon.h b/src/xfdesktop-file-icon.h
index 4ca703f..26cf816 100644
--- a/src/xfdesktop-file-icon.h
+++ b/src/xfdesktop-file-icon.h
@@ -40,6 +40,7 @@ typedef struct _XfdesktopFileIconClass   
XfdesktopFileIconClass;
 struct _XfdesktopFileIcon
 {
 XfdesktopIcon parent;
+GIcon *gicon;
 };
 
 struct _XfdesktopFileIconClass
@@ -68,6 +69,10 @@ gboolean 
xfdesktop_file_icon_can_rename_file(XfdesktopFileIcon *icon);
 
 gboolean xfdesktop_file_icon_can_delete_file(XfdesktopFileIcon *icon);
 
+void xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon);
+
+void xfdeskto

[Xfce4-commits] Align icon labels and allow them to be multi-line (Bug 8646)

2013-08-12 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to e2af8b45c6bb1a7f18cd8ac36c072fd024cfa664 (commit)
   from 144ef9abcb876f5d432eed48e464aaa1c9a1fc05 (commit)

commit e2af8b45c6bb1a7f18cd8ac36c072fd024cfa664
Author: Eric Koegel 
Date:   Sun Aug 11 10:31:49 2013 +0300

Align icon labels and allow them to be multi-line (Bug 8646)

When thumbnails are turned on the icon labels can become unaligned with 
others
in that row. There's also unused space in the icon's label area that is now
used to display more of the text. Additionally, some effort was made to 
lower
the number of times the icon redraws itself in response to expose events,
especially during xfdesktop's startup.

 src/xfdesktop-icon-view.c |  100 ++---
 1 file changed, 58 insertions(+), 42 deletions(-)

diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 6a8f223..a04b83e 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -60,6 +60,7 @@
 #define CELL_PADDING  (icon_view->priv->cell_padding)
 #define CELL_SIZE (TEXT_WIDTH + CELL_PADDING * 2)
 #define SPACING   (icon_view->priv->cell_spacing)
+#define TEXT_HEIGHT   (CELL_SIZE - ICON_SIZE - SPACING - (CELL_PADDING * 
2))
 #define SCREEN_MARGIN 8
 #define DEFAULT_RUBBERBAND_ALPHA  64
 
@@ -330,6 +331,8 @@ static gboolean xfdesktop_icon_view_show_tooltip(GtkWidget 
*widget,
  GtkTooltip *tooltip,
  gpointer user_data);
 
+static gboolean xfdesktop_icon_view_is_icon_selected(XfdesktopIconView 
*icon_view,
+ XfdesktopIcon *icon);
 static void xfdesktop_icon_view_real_select_all(XfdesktopIconView *icon_view);
 static void xfdesktop_icon_view_real_unselect_all(XfdesktopIconView 
*icon_view);
 static void xfdesktop_icon_view_real_select_cursor_item(XfdesktopIconView 
*icon_view);
@@ -790,7 +793,7 @@ xfdesktop_icon_view_button_press(GtkWidget *widget,
 icon_l = g_list_find_custom(icon_view->priv->icons, evt,
 
(GCompareFunc)xfdesktop_check_icon_clicked);
 if(icon_l && (icon = icon_l->data)) {
-if(g_list_find(icon_view->priv->selected_icons, icon)) {
+if(xfdesktop_icon_view_is_icon_selected(icon_view, icon)) {
 /* clicked an already-selected icon */
 
 if(evt->state & GDK_CONTROL_MASK) {
@@ -1177,7 +1180,7 @@ xfdesktop_icon_view_motion_notify(GtkWidget *widget,
 
 if(xfdesktop_icon_get_extents(icon, NULL, NULL, &extents)
&& gdk_rectangle_intersect(&extents, new_rect, &dummy)
-   && !g_list_find(icon_view->priv->selected_icons, icon))
+   && !xfdesktop_icon_view_is_icon_selected(icon_view, icon))
 {
 /* since _select_item() prepends to the list, we
  * should be ok just calling this */
@@ -2035,6 +2038,7 @@ xfdesktop_icon_view_expose(GtkWidget *widget,
 {
 XfdesktopIconView *icon_view = XFDESKTOP_ICON_VIEW(widget);
 GdkRectangle *rects = NULL;
+GdkRectangle clipbox;
 gint n_rects = 0, i;
 
 /*TRACE("entering");*/
@@ -2043,9 +2047,9 @@ xfdesktop_icon_view_expose(GtkWidget *widget,
 return FALSE;
 
 gdk_region_get_rectangles(evt->region, &rects, &n_rects);
+gdk_region_get_clipbox(evt->region, &clipbox);
 
-for(i = 0; i < n_rects; ++i)
-xfdesktop_icon_view_repaint_icons(icon_view, &rects[i]);
+xfdesktop_icon_view_repaint_icons(icon_view, &clipbox);
 
 if(icon_view->priv->definitely_rubber_banding) {
 GdkRectangle intersect;
@@ -2454,7 +2458,7 @@ xfdesktop_icon_view_repaint_icons(XfdesktopIconView 
*icon_view,
 /* fist paint non-selected items, then paint selected items */
 for(l = icon_view->priv->icons; l; l = l->next) {
 icon = (XfdesktopIcon *)l->data;
-if (g_list_find(icon_view->priv->selected_icons, icon))
+if (xfdesktop_icon_view_is_icon_selected(icon_view, icon))
 continue;
 
 if(!xfdesktop_icon_get_extents(icon, NULL, NULL, &extents)
@@ -2466,7 +2470,7 @@ xfdesktop_icon_view_repaint_icons(XfdesktopIconView 
*icon_view,
 
 for(l = icon_view->priv->icons; l; l = l->next) {
 icon = (XfdesktopIcon *)l->data;
-if (!g_list_find(icon_view->priv->selected_icons, icon))
+if (!xfdesktop_icon_view_is_icon_selected(icon_view, icon))
 continue;
 
 if(!xfdesktop_icon_get_extents(icon, NULL, NULL, &extents)
@@ -2799,20 +2803,20 @@ 
xfdesktop_icon_view_setup_pango_layout(XfdesktopIconView *icon_vi

[Xfce4-commits] Fill in the icon area better

2013-08-12 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to 2cdfde11b827b97576347c2eacb043780abc9415 (commit)
   from bc48d533bd0dbaaad8d865bd6f26bc9c8f47e042 (commit)

commit 2cdfde11b827b97576347c2eacb043780abc9415
Author: Eric Koegel 
Date:   Mon Aug 12 16:26:58 2013 +0300

Fill in the icon area better

It bypasses the thumbnailer for svg icons so they look better.

 common/xfdesktop-common.h |3 +--
 src/xfdesktop-file-utils.c|   50 -
 src/xfdesktop-file-utils.h|3 ++-
 src/xfdesktop-icon-view.c |   10 +---
 src/xfdesktop-icon.c  |4 +--
 src/xfdesktop-icon.h  |5 ++--
 src/xfdesktop-regular-file-icon.c |   31 ---
 src/xfdesktop-special-file-icon.c |   13 +-
 src/xfdesktop-volume-icon.c   |   12 -
 src/xfdesktop-window-icon.c   |   23 +
 10 files changed, 93 insertions(+), 61 deletions(-)

diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index cda8f75..3b496fc 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -36,8 +36,7 @@
 #define DEFAULT_ICON_FONT_SIZE   12
 #define DEFAULT_ICON_SIZE32
 #define ITHEME_FLAGS (GTK_ICON_LOOKUP_USE_BUILTIN \
-  | GTK_ICON_LOOKUP_GENERIC_FALLBACK \
-  | GTK_ICON_LOOKUP_FORCE_SIZE)
+  | GTK_ICON_LOOKUP_GENERIC_FALLBACK)
 
 #define LIST_TEXT"# xfce backdrop list"
 #define XFDESKTOP_SELECTION_FMT  "XFDESKTOP_SELECTION_%d"
diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c
index 1a29b69..ba0e753 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -491,12 +491,16 @@ xfdesktop_file_utils_get_fallback_icon(gint size)
 
 GdkPixbuf *
 xfdesktop_file_utils_get_icon(GIcon *icon,
-  gint size,
+  gint width,
+  gint height,
   guint opacity)
 {
 GtkIconTheme *itheme = gtk_icon_theme_get_default();
 GdkPixbuf *pix_theme = NULL, *pix = NULL;
 GIcon *base_icon = NULL;
+gint size = MIN(width, height);
+
+g_return_val_if_fail(width > 0 && height > 0 && icon != NULL, NULL);
 
 /* Extract the base icon if available */
 if(G_IS_EMBLEMED_ICON(icon))
@@ -504,26 +508,36 @@ xfdesktop_file_utils_get_icon(GIcon *icon,
 else
 base_icon = icon;
 
-if(!pix_theme && base_icon) {
-if(G_IS_THEMED_ICON(base_icon) || G_IS_FILE_ICON(base_icon)) {
-  GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(itheme,
-  base_icon, 
size,
-  
ITHEME_FLAGS);
-  if(icon_info) {
-  pix_theme = gtk_icon_info_load_icon(icon_info, NULL);
-  gtk_icon_info_free(icon_info);
-  }
-} else if(G_IS_LOADABLE_ICON(base_icon)) {
-GInputStream *stream = 
g_loadable_icon_load(G_LOADABLE_ICON(base_icon),
-size, NULL, NULL, 
NULL);
-if(stream) {
-pix = gdk_pixbuf_new_from_stream(stream, NULL, NULL);
-g_object_unref(stream);
-}
+if(!base_icon)
+return NULL;
+
+if(G_IS_THEMED_ICON(base_icon)) {
+  GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(itheme,
+  base_icon, size,
+  ITHEME_FLAGS);
+  if(icon_info) {
+  pix_theme = gtk_icon_info_load_icon(icon_info, NULL);
+  gtk_icon_info_free(icon_info);
+  }
+} else if(G_IS_LOADABLE_ICON(base_icon)) {
+GInputStream *stream = g_loadable_icon_load(G_LOADABLE_ICON(base_icon),
+size, NULL, NULL, NULL);
+if(stream) {
+pix = gdk_pixbuf_new_from_stream_at_scale(stream, width, height, 
TRUE, NULL, NULL);
+g_object_unref(stream);
 }
+} else if(G_IS_FILE_ICON(base_icon)) {
+GFile *file = g_file_icon_get_file(G_FILE_ICON(icon));
+gchar *path = g_file_get_path(file);
+
+pix = gdk_pixbuf_new_from_file_at_size(path, width, height, NULL);
+
+g_free(path);
+g_object_unref(file);
 }
 
-if(G_LIKELY(pix_theme)) {
+
+if(pix_theme) {
 /* we can't edit thsese icons */
 pix = gdk_pixbuf_copy(pix_theme);
 g_object_unref(G_OBJECT(pix_theme));
diff --git a/src/xfdesktop-file-utils.h b/src/xfdesktop-file-utils.h
index 3a80e0c..1975ae5 100644
--- a/src/xfdesktop-file-utils.h
+++ b/src/xfdesktop-file-utils.h
@@ -51,7 +51,8 @@ void xfdesktop_

[Xfce4-commits] Make the GIcon for file icons private

2013-08-17 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to f6252759fcb4aa2e510237aa45c77b84bfab3cc4 (commit)
   from 2cdfde11b827b97576347c2eacb043780abc9415 (commit)

commit f6252759fcb4aa2e510237aa45c77b84bfab3cc4
Author: Eric Koegel 
Date:   Sat Aug 17 15:47:21 2013 +0300

Make the GIcon for file icons private

 src/xfdesktop-file-icon.c |  100 +---
 src/xfdesktop-file-icon.h |9 ++-
 src/xfdesktop-regular-file-icon.c |  133 +
 src/xfdesktop-special-file-icon.c |   94 +++---
 src/xfdesktop-volume-icon.c   |   45 +
 5 files changed, 257 insertions(+), 124 deletions(-)

diff --git a/src/xfdesktop-file-icon.c b/src/xfdesktop-file-icon.c
index f90bf04..7673ea7 100644
--- a/src/xfdesktop-file-icon.c
+++ b/src/xfdesktop-file-icon.c
@@ -30,30 +30,61 @@
 #include "xfdesktop-file-utils.h"
 #include "xfdesktop-file-icon.h"
 
+struct _XfdesktopFileIconPrivate
+{
+GIcon *gicon;
+};
+
 static void xfdesktop_file_icon_finalize(GObject *obj);
 
 static gboolean xfdesktop_file_icon_activated(XfdesktopIcon *icon);
 
+static void xfdesktop_file_icon_set_property(GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void xfdesktop_file_icon_get_property(GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
 
 G_DEFINE_ABSTRACT_TYPE(XfdesktopFileIcon, xfdesktop_file_icon,
XFDESKTOP_TYPE_ICON)
 
+enum
+{
+PROP_0,
+PROP_GICON,
+};
 
 static void
 xfdesktop_file_icon_class_init(XfdesktopFileIconClass *klass)
 {
 GObjectClass *gobject_class = (GObjectClass *)klass;
 XfdesktopIconClass *icon_class = (XfdesktopIconClass *)klass;
-
+
+g_type_class_add_private(klass, sizeof(XfdesktopFileIconPrivate));
+
 gobject_class->finalize = xfdesktop_file_icon_finalize;
+gobject_class->set_property = xfdesktop_file_icon_set_property;
+gobject_class->get_property = xfdesktop_file_icon_get_property;
 
 icon_class->activated = xfdesktop_file_icon_activated;
+
+g_object_class_install_property(gobject_class,
+PROP_GICON,
+g_param_spec_pointer("gicon",
+ "gicon",
+ "gicon",
+ G_PARAM_READWRITE));
 }
 
 static void
 xfdesktop_file_icon_init(XfdesktopFileIcon *icon)
 {
-icon->gicon = NULL;
+icon->priv = G_TYPE_INSTANCE_GET_PRIVATE(icon,
+ XFDESKTOP_TYPE_FILE_ICON,
+ XfdesktopFileIconPrivate);
 }
 
 static void
@@ -66,6 +97,45 @@ xfdesktop_file_icon_finalize(GObject *obj)
 G_OBJECT_CLASS(xfdesktop_file_icon_parent_class)->finalize(obj);
 }
 
+static void
+xfdesktop_file_icon_set_property(GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+XfdesktopFileIcon *file_icon = XFDESKTOP_FILE_ICON(object);
+
+switch(property_id) {
+case PROP_GICON:
+xfdesktop_file_icon_invalidate_icon(file_icon);
+file_icon->priv->gicon = g_value_get_pointer(value);
+break;
+
+default:
+G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+break;
+}
+}
+
+static void
+xfdesktop_file_icon_get_property(GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+XfdesktopFileIcon *file_icon = XFDESKTOP_FILE_ICON(object);
+
+switch(property_id) {
+case PROP_GICON:
+g_value_set_pointer(value, file_icon->priv->gicon);
+break;
+
+default:
+G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+break;
+}
+}
+
 static gboolean
 xfdesktop_file_icon_activated(XfdesktopIcon *icon)
 {
@@ -184,7 +254,7 @@ xfdesktop_file_icon_can_delete_file(XfdesktopFileIcon *icon)
 return FALSE;
 }
 
-void
+GIcon *
 xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
 {
 GIcon *emblemed_icon = NULL;
@@ -192,12 +262,12 @@ xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
 
 TRACE("entering");
 
-g_return_if_fail(XFDESKTOP_IS_FILE_ICON(icon));
+g_return_val_if_fail(XFDESKTOP_IS_FILE_ICON(icon), NULL);
 
-if(G_I

[Xfce4-commits] Creating branch eric/middle-click-menu

2013-08-17 Thread Eric Koegel
Updating branch refs/heads/eric/middle-click-menu
 as new branch
 to b5d1ce1c99780579a4cc6b3c1be42d75eafd4c8c (commit)

Branches are created implicitly by pushing. This mail only exists to 
let you know that there was code pushed to 

  refs/heads/eric/middle-click-menu

for the first time. Mails for the commits that lead to the creation 
of the branch will follow after this mail.
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Clean up middle-click menu appearance

2013-08-17 Thread Eric Koegel
Updating branch refs/heads/eric/middle-click-menu
 to b5d1ce1c99780579a4cc6b3c1be42d75eafd4c8c (commit)
   from b93d57a91f27e73249da0e061d4d988f06763b0c (commit)

commit b5d1ce1c99780579a4cc6b3c1be42d75eafd4c8c
Author: Eric Koegel 
Date:   Sat Aug 17 15:51:29 2013 +0300

Clean up middle-click menu appearance

Center workspace names so they look more like headers. Lower the
number of font states and insensitive color use in the menu. Fade
out the appicon for minimized windows. This patch also adds a
confirmation dialog box when removing a workspace (Bug #7337).

 src/windowlist.c |  129 +-
 1 file changed, 60 insertions(+), 69 deletions(-)

diff --git a/src/windowlist.c b/src/windowlist.c
index e337a6e..177f2f8 100644
--- a/src/windowlist.c
+++ b/src/windowlist.c
@@ -52,36 +52,46 @@ static gboolean wl_submenus = FALSE;
 static gboolean wl_sticky_once = FALSE;
 
 static void
-set_num_workspaces(GtkWidget *w, gpointer num)
+set_num_workspaces(GtkWidget *w, gpointer data)
 {
-static Atom xa_NET_NUMBER_OF_DESKTOPS = 0;
-XClientMessageEvent sev;
-gint n;
-GdkScreen *gscreen = gtk_widget_get_screen(w);
-GdkWindow *groot = gdk_screen_get_root_window(gscreen);
-
-if(!xa_NET_NUMBER_OF_DESKTOPS) {
-xa_NET_NUMBER_OF_DESKTOPS = XInternAtom(gdk_x11_get_default_xdisplay(),
-"_NET_NUMBER_OF_DESKTOPS", False);
-}
-
-n = GPOINTER_TO_INT(num);
-
-sev.type = ClientMessage;
-sev.display = gdk_x11_get_default_xdisplay();
-sev.format = 32;
-sev.window = GDK_WINDOW_XID(groot);
-sev.message_type = xa_NET_NUMBER_OF_DESKTOPS;
-sev.data.l[0] = n;
-
-gdk_error_trap_push();
+WnckScreen *wnck_screen = 
wnck_screen_get(gdk_screen_get_number(gtk_widget_get_screen(w)));
+WnckWorkspace *wnck_workspace = 
wnck_screen_get_active_workspace(wnck_screen);
+gint nworkspaces = wnck_screen_get_workspace_count(wnck_screen);
+const gchar *ws_name = 
wnck_workspace_get_name(wnck_screen_get_workspace(wnck_screen, nworkspaces -1));
+gint num = GPOINTER_TO_INT(data);
+gchar *rm_label_short, *rm_label_long;
+gint current_workspace = wnck_workspace_get_number(wnck_workspace);
+const gchar *current_workspace_name = 
wnck_workspace_get_name(wnck_workspace);
+
+g_return_if_fail(nworkspaces != num);
+
+if(num < nworkspaces) {
+if(!ws_name || atoi(ws_name) == nworkspaces) {
+rm_label_short = g_strdup_printf(_("Remove Workspace %d"), 
nworkspaces);
+rm_label_long = g_strdup_printf(_("Do you really want to remove 
workspace %d?\nNote: You are currently on workspace %d."),
+nworkspaces, current_workspace);
+} else {
+gchar *ws_name_esc = g_markup_escape_text(ws_name, 
strlen(ws_name));
+rm_label_short = g_strdup_printf(_("Remove Workspace '%s'"), 
ws_name_esc);
+rm_label_long = g_strdup_printf(_("Do you really want to remove 
workspace '%s'?\nNote: You are currently on workspace '%s'."),
+ws_name_esc, 
current_workspace_name);
+g_free(ws_name_esc);
+}
 
-XSendEvent(gdk_x11_get_default_xdisplay(), GDK_WINDOW_XID(groot), False,
-SubstructureNotifyMask | SubstructureRedirectMask,
-(XEvent *)&sev);
+/* Popup a dialog box confirming that the user wants to remove a
+ * workspace */
+if(!xfce_dialog_confirm(NULL, NULL, _("Remove"), rm_label_long,
+"%s", rm_label_short))
+{
+g_free(rm_label_short);
+g_free(rm_label_long);
+return;
+}
+}
 
-gdk_flush();
-gdk_error_trap_pop();
+g_free(rm_label_short);
+g_free(rm_label_long);
+wnck_screen_change_workspace_count(wnck_screen, num);
 }
 
 static void
@@ -153,11 +163,7 @@ menu_item_from_wnck_window(WnckWindow *wnck_window, gint 
icon_width,
 g_string_prepend(label, "");
 g_string_append(label, "");
 }
-if(wnck_window_is_minimized(wnck_window)) {
-g_string_prepend(label, "[");
-g_string_append(label, "]");
-}
-
+
 if(wl_show_icons) {
 icon = wnck_window_get_icon(wnck_window);
 w = gdk_pixbuf_get_width(icon);
@@ -165,12 +171,18 @@ menu_item_from_wnck_window(WnckWindow *wnck_window, gint 
icon_width,
 if(w != icon_width || h != icon_height) {
 tmp = gdk_pixbuf_scale_simple(icon, icon_width, icon_height,
 GDK_INTERP_BILINEAR);
+
+if(wnck_window_is_minimized(wnck_window)) {
+/* minimized window, fade out app icon */
+gdk_pixbuf_saturate_and_pixelate(tmp, tmp, 0.55, TRUE

[Xfce4-commits] Check GFileInfo before trying to use it.

2013-08-19 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to 21fe3ab4185b7eba72b5554f4645c8945be3da27 (commit)
   from f6252759fcb4aa2e510237aa45c77b84bfab3cc4 (commit)

commit 21fe3ab4185b7eba72b5554f4645c8945be3da27
Author: Eric Koegel 
Date:   Mon Aug 19 11:47:00 2013 +0300

Check GFileInfo before trying to use it.

 src/xfdesktop-file-icon.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/xfdesktop-file-icon.c b/src/xfdesktop-file-icon.c
index 7673ea7..1d2ddcc 100644
--- a/src/xfdesktop-file-icon.c
+++ b/src/xfdesktop-file-icon.c
@@ -269,6 +269,11 @@ xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
 else
 return NULL;
 
+icon->priv->gicon = emblemed_icon;
+
+if(!G_IS_FILE_INFO(xfdesktop_file_icon_peek_file_info(icon)))
+return emblemed_icon;
+
 /* Get the list of emblems */
 emblem_names = 
g_file_info_get_attribute_stringv(xfdesktop_file_icon_peek_file_info(icon),
  "metadata::emblems");
@@ -289,7 +294,7 @@ xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
 
 /* Clear out the old icon and set the new one */
 xfdesktop_file_icon_invalidate_icon(icon);
-return icon->priv->gicon = emblemed_icon;
+return emblemed_icon;
 }
 
 void
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Make inactive workspace headers insensitive in color

2013-08-24 Thread Eric Koegel
Updating branch refs/heads/eric/middle-click-menu
 to 5407011db19c870d701978f49af8549144a4281f (commit)
   from b5d1ce1c99780579a4cc6b3c1be42d75eafd4c8c (commit)

commit 5407011db19c870d701978f49af8549144a4281f
Author: Eric Koegel 
Date:   Sun Aug 25 08:12:06 2013 +0300

Make inactive workspace headers insensitive in color

 src/windowlist.c |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/windowlist.c b/src/windowlist.c
index 177f2f8..a539fd4 100644
--- a/src/windowlist.c
+++ b/src/windowlist.c
@@ -275,7 +275,15 @@ windowlist_populate(XfceDesktop *desktop,
 g_free(ws_label);
 label = gtk_bin_get_child(GTK_BIN(mi));
 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+/* center the workspace header */
 gtk_misc_set_alignment(GTK_MISC(label), 0.4f, 0);
+/* If it's not the active workspace, make the color insensitive */
+if(wnck_workspace != active_workspace)
+{
+GtkWidget *lbl = gtk_bin_get_child(GTK_BIN(mi));
+gtk_widget_modify_fg(lbl, GTK_STATE_NORMAL,
+ &(style->fg[GTK_STATE_INSENSITIVE]));
+}
 gtk_widget_show(mi);
 gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
 if(!wl_submenus) {
@@ -342,11 +350,6 @@ windowlist_populate(XfceDesktop *desktop,
 
 pango_font_description_free(italic_font_desc);
 
-
-mi = gtk_separator_menu_item_new();
-gtk_widget_show(mi);
-gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
-
 /* 'add workspace' item */
 if(wl_show_icons) {
 img = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix double-free crash

2013-08-24 Thread Eric Koegel
Updating branch refs/heads/eric/middle-click-menu
 to 4acec356cb8ce03bfbed5366db3dc14ea0ce2327 (commit)
   from 5407011db19c870d701978f49af8549144a4281f (commit)

commit 4acec356cb8ce03bfbed5366db3dc14ea0ce2327
Author: Eric Koegel 
Date:   Sun Aug 25 08:20:45 2013 +0300

Fix double-free crash

 src/windowlist.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/windowlist.c b/src/windowlist.c
index a539fd4..1b3edd2 100644
--- a/src/windowlist.c
+++ b/src/windowlist.c
@@ -59,12 +59,14 @@ set_num_workspaces(GtkWidget *w, gpointer data)
 gint nworkspaces = wnck_screen_get_workspace_count(wnck_screen);
 const gchar *ws_name = 
wnck_workspace_get_name(wnck_screen_get_workspace(wnck_screen, nworkspaces -1));
 gint num = GPOINTER_TO_INT(data);
-gchar *rm_label_short, *rm_label_long;
+gchar *rm_label_short = NULL, *rm_label_long = NULL;
 gint current_workspace = wnck_workspace_get_number(wnck_workspace);
 const gchar *current_workspace_name = 
wnck_workspace_get_name(wnck_workspace);
 
 g_return_if_fail(nworkspaces != num);
 
+TRACE("entering");
+
 if(num < nworkspaces) {
 if(!ws_name || atoi(ws_name) == nworkspaces) {
 rm_label_short = g_strdup_printf(_("Remove Workspace %d"), 
nworkspaces);
@@ -89,8 +91,11 @@ set_num_workspaces(GtkWidget *w, gpointer data)
 }
 }
 
-g_free(rm_label_short);
-g_free(rm_label_long);
+if(rm_label_short != NULL)
+g_free(rm_label_short);
+if(rm_label_long != NULL)
+g_free(rm_label_long);
+
 wnck_screen_change_workspace_count(wnck_screen, num);
 }
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Better icon pixbuf caching

2013-08-25 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to de26505ba425ca939241e0c51b860c5763850386 (commit)
   from 21fe3ab4185b7eba72b5554f4645c8945be3da27 (commit)

commit de26505ba425ca939241e0c51b860c5763850386
Author: Eric Koegel 
Date:   Sun Aug 25 14:08:37 2013 +0300

Better icon pixbuf caching

With the inclusion of tooltip pixbuf previews the icon pixbuf would
get recreated every time the tooltip pixbuf was generated. So now it
will cache both the normal size icon pixbuf and the tooltip pixbuf.
The pixbufs are stored in the base icon so that all the different
icon types don't have to do the same redundant checks.

 src/xfdesktop-file-icon-manager.c |1 +
 src/xfdesktop-file-icon.c |8 ++--
 src/xfdesktop-file-utils.c|2 +-
 src/xfdesktop-icon-view.c |6 +--
 src/xfdesktop-icon.c  |   83 +++--
 src/xfdesktop-icon.h  |   10 -
 src/xfdesktop-regular-file-icon.c |   74 ++---
 src/xfdesktop-special-file-icon.c |   63 
 src/xfdesktop-volume-icon.c   |   68 ++
 src/xfdesktop-window-icon.c   |   44 +---
 10 files changed, 196 insertions(+), 163 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 4ec88b9..45e35ea 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2160,6 +2160,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor 
*monitor,
 GFileInfo *file_info;
 
 switch(event) {
+case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
 case G_FILE_MONITOR_EVENT_CHANGED:
 DBG("got changed event: %s", g_file_get_path(file));
 
diff --git a/src/xfdesktop-file-icon.c b/src/xfdesktop-file-icon.c
index 1d2ddcc..c4dd11a 100644
--- a/src/xfdesktop-file-icon.c
+++ b/src/xfdesktop-file-icon.c
@@ -269,10 +269,8 @@ xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
 else
 return NULL;
 
-icon->priv->gicon = emblemed_icon;
-
 if(!G_IS_FILE_INFO(xfdesktop_file_icon_peek_file_info(icon)))
-return emblemed_icon;
+return icon->priv->gicon = emblemed_icon;
 
 /* Get the list of emblems */
 emblem_names = 
g_file_info_get_attribute_stringv(xfdesktop_file_icon_peek_file_info(icon),
@@ -294,7 +292,7 @@ xfdesktop_file_icon_add_emblems(XfdesktopFileIcon *icon)
 
 /* Clear out the old icon and set the new one */
 xfdesktop_file_icon_invalidate_icon(icon);
-return emblemed_icon;
+return icon->priv->gicon = emblemed_icon;
 }
 
 void
@@ -313,5 +311,5 @@ xfdesktop_file_icon_has_gicon(XfdesktopFileIcon *icon)
 {
 g_return_val_if_fail(XFDESKTOP_IS_FILE_ICON(icon), FALSE);
 
-return icon->priv->gicon != NULL ? TRUE : FALSE;
+return G_IS_ICON(icon->priv->gicon);
 }
diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c
index ba0e753..248df59 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -584,7 +584,7 @@ xfdesktop_file_utils_add_emblems(GdkPixbuf *pix, GList 
*emblems)
 pix_width = gdk_pixbuf_get_width(pix);
 pix_height = gdk_pixbuf_get_height(pix);
 
-emblem_size = MIN(pix_width, pix_height) / 3;
+emblem_size = MIN(pix_width, pix_height) / 2;
 
 /* render up to four emblems for sizes from 48 onwards, else up to 2 
emblems */
 max_emblems = (pix_height < 48 && pix_width < 48) ? 2 : 4;
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 48c5aab..da22d0d 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -1064,9 +1064,9 @@ xfdesktop_icon_view_show_tooltip(GtkWidget *widget,
 
 if(icon_view->priv->tooltip_size > 0) {
 gtk_tooltip_set_icon(tooltip,
-xfdesktop_icon_peek_pixbuf(icon_view->priv->item_under_pointer,
-   icon_view->priv->tooltip_size * 
1.5f,
-   icon_view->priv->tooltip_size));
+
xfdesktop_icon_peek_tooltip_pixbuf(icon_view->priv->item_under_pointer,
+   
icon_view->priv->tooltip_size * 1.5f,
+   
icon_view->priv->tooltip_size));
 }
 
 gtk_tooltip_set_text(tooltip, padded_tip_text);
diff --git a/src/xfdesktop-icon.c b/src/xfdesktop-icon.c
index f78189c..b6c2ce7 100644
--- a/src/xfdesktop-icon.c
+++ b/src/xfdesktop-icon.c
@@ -40,6 +40,10 @@ struct _XfdesktopIconPrivate
 GdkRectangle pixbuf_extents;
 GdkRectangle text_extents;
 GdkRectangle total_extents;
+
+GdkPixbuf *pix, *tooltip_pix;
+gint cur_pix_width, cur_pix_height;
+gint cur_tooltip_pix_width, cur_tooltip_pix_height;
 };
 
 enum {
@@ -54,6 +58,7 @@ enum 

[Xfce4-commits] Icon stays in place when renamed (Bug 1678)

2013-08-25 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to f606524d5d8b91c983c2412af291e6d4d6c66678 (commit)
   from de26505ba425ca939241e0c51b860c5763850386 (commit)

commit f606524d5d8b91c983c2412af291e6d4d6c66678
Author: Eric Koegel 
Date:   Sun Aug 25 16:42:24 2013 +0300

Icon stays in place when renamed (Bug 1678)

 src/xfdesktop-file-icon-manager.c |   67 +
 1 file changed, 61 insertions(+), 6 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 45e35ea..26303a8 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1821,9 +1821,9 @@ _icon_notify_destroy(gpointer data,
 static gboolean
 xfdesktop_file_icon_manager_add_icon(XfdesktopFileIconManager *fmanager,
  XfdesktopFileIcon *icon,
+ gint16 row, gint16 col,
  gboolean defer_if_missing)
 {
-gint16 row = -1, col = -1;
 gboolean do_add = FALSE;
 const gchar *name;
 GFile *file;
@@ -1841,8 +1841,12 @@ 
xfdesktop_file_icon_manager_add_icon(XfdesktopFileIconManager *fmanager,
 
 
 name = xfdesktop_icon_peek_label(XFDESKTOP_ICON(icon));
-if(xfdesktop_file_icon_manager_get_cached_icon_position(fmanager, name,
-&row, &col))
+if(row >= 0 && col >= 0) {
+DBG("attempting to set icon '%s' to position (%d,%d)", name, row, col);
+xfdesktop_icon_set_position(XFDESKTOP_ICON(icon), row, col);
+do_add = TRUE;
+} else if(xfdesktop_file_icon_manager_get_cached_icon_position(fmanager, 
name,
+   &row, &col))
 {
 DBG("attempting to set icon '%s' to position (%d,%d)", name, row, col);
 xfdesktop_icon_set_position(XFDESKTOP_ICON(icon), row, col);
@@ -1873,10 +1877,13 @@ 
xfdesktop_file_icon_manager_add_icon(XfdesktopFileIconManager *fmanager,
 return do_add;
 }
 
+/* If row and col are set then they will be used, otherwise set them to -1
+ * and it will lookup the position in the rc file */
 static XfdesktopFileIcon *
 xfdesktop_file_icon_manager_add_regular_icon(XfdesktopFileIconManager 
*fmanager,
  GFile *file,
  GFileInfo *info,
+ guint16 row, guint16 col,
  gboolean defer_if_missing)
 {
 XfdesktopRegularFileIcon *icon = NULL;
@@ -1936,6 +1943,7 @@ 
xfdesktop_file_icon_manager_add_regular_icon(XfdesktopFileIconManager *fmanager,
 
 if(xfdesktop_file_icon_manager_add_icon(fmanager,
  XFDESKTOP_FILE_ICON(icon),
+ row, col,
  defer_if_missing))
 {
 g_hash_table_replace(fmanager->priv->icons, g_object_ref(file), icon);
@@ -1959,6 +1967,7 @@ 
xfdesktop_file_icon_manager_add_volume_icon(XfdesktopFileIconManager *fmanager,
 
 if(xfdesktop_file_icon_manager_add_icon(fmanager,
 XFDESKTOP_FILE_ICON(icon),
+-1, -1,
 FALSE))
 {
 g_hash_table_replace(fmanager->priv->removable_icons,
@@ -1983,6 +1992,7 @@ 
xfdesktop_file_icon_manager_add_special_file_icon(XfdesktopFileIconManager *fman
 
 if(xfdesktop_file_icon_manager_add_icon(fmanager,
 XFDESKTOP_FILE_ICON(icon),
+-1, -1,
 FALSE))
 {
 g_hash_table_replace(fmanager->priv->special_icons,
@@ -2158,8 +2168,50 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor
 *monitor,
 XfdesktopFileIconManager *fmanager = 
XFDESKTOP_FILE_ICON_MANAGER(user_data);
 XfdesktopFileIcon *icon;
 GFileInfo *file_info;
+guint16 row, col;
 
 switch(event) {
+case G_FILE_MONITOR_EVENT_MOVED:
+DBG("got a moved event, old filename: %s new filename: %s",
+g_file_get_path(file), g_file_get_path(other_file));
+
+icon = g_hash_table_lookup(fmanager->priv->icons, file);
+if(!icon) {
+g_critical("G_FILE_MONITOR_EVENT_MOVED for an icon that 
doesn't exist");
+return;
+}
+
+file_info = g_file_query_info(other_file, 
XFDESKTOP_FILE_INFO_NAMESPACE,
+  G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
+if(file_info) {
+gboolean is_hidden;
+
+/* Get the old posi

[Xfce4-commits] Unselect the desktop icon after activating it. (Bug #8640)

2013-08-25 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to 104d482576b8538c9d2443d15817934876f16c8a (commit)
   from f606524d5d8b91c983c2412af291e6d4d6c66678 (commit)

commit 104d482576b8538c9d2443d15817934876f16c8a
Author: Eric Koegel 
Date:   Fri Apr 6 18:24:29 2012 +0300

Unselect the desktop icon after activating it. (Bug #8640)

 src/xfdesktop-icon-view.c |4 
 1 file changed, 4 insertions(+)

diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index da22d0d..2fd446c 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -878,6 +878,7 @@ xfdesktop_icon_view_button_press(GtkWidget *widget,
 g_signal_emit(G_OBJECT(icon_view), 
__signals[SIG_ICON_ACTIVATED],
   0, NULL);
 xfdesktop_icon_activated(icon);
+xfdesktop_icon_view_unselect_item(icon_view, icon);
 }
 }
 
@@ -919,6 +920,7 @@ xfdesktop_icon_view_button_release(GtkWidget *widget,
 g_signal_emit(G_OBJECT(icon_view), __signals[SIG_ICON_ACTIVATED],
   0, NULL);
 xfdesktop_icon_activated(icon);
+xfdesktop_icon_view_unselect_item(icon_view, icon);
 }
 }
 
@@ -2153,6 +2155,8 @@ 
xfdesktop_icon_view_real_activate_cursor_item(XfdesktopIconView *icon_view)
 
 g_signal_emit(G_OBJECT(icon_view), __signals[SIG_ICON_ACTIVATED], 0, NULL);
 xfdesktop_icon_activated(icon_view->priv->cursor);
+xfdesktop_icon_view_unselect_item(icon_view, icon_view->priv->cursor);
+icon_view->priv->cursor = NULL;
 
 return TRUE;
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Icon spacing

2013-08-26 Thread Eric Koegel
Updating branch refs/heads/eric/icon-changes
 to dc9f86912900c7d6461b273953ae6fad6c00daed (commit)
   from 104d482576b8538c9d2443d15817934876f16c8a (commit)

commit dc9f86912900c7d6461b273953ae6fad6c00daed
Author: Eric Koegel 
Date:   Mon Aug 26 10:17:37 2013 +0300

Icon spacing

Fix the spacing the between the icon pix and label. Also calculate
the label radius once rather than all the time.

 src/xfdesktop-icon-view.c |   68 +
 1 file changed, 31 insertions(+), 37 deletions(-)

diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 2fd446c..ac97f20 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -61,7 +61,8 @@
 #define CELL_PADDING  (icon_view->priv->cell_padding)
 #define CELL_SIZE (TEXT_WIDTH + CELL_PADDING * 2)
 #define SPACING   (icon_view->priv->cell_spacing)
-#define TEXT_HEIGHT   (CELL_SIZE - ICON_SIZE - SPACING - (CELL_PADDING * 
2))
+#define LABEL_RADIUS  (icon_view->priv->label_radius)
+#define TEXT_HEIGHT   (CELL_SIZE - ICON_SIZE - SPACING - (CELL_PADDING * 
2) - LABEL_RADIUS)
 #define SCREEN_MARGIN 8
 #define DEFAULT_RUBBERBAND_ALPHA  64
 
@@ -173,6 +174,7 @@ struct _XfdesktopIconViewPrivate
 
 gint cell_padding;
 gint cell_spacing;
+gdouble label_radius;
 gdouble cell_text_width_proportion;
 
 gboolean ellipsize_icon_labels;
@@ -1846,6 +1848,7 @@ xfdesktop_icon_view_style_set(GtkWidget *widget,
  "cell-text-width-proportion", 
&icon_view->priv->cell_text_width_proportion,
  "ellipsize-icon-labels", 
&icon_view->priv->ellipsize_icon_labels,
  "tooltip-size", &icon_view->priv->tooltip_size,
+ "label-radius", &icon_view->priv->label_radius,
  NULL);
 
 DBG("cell spacing is %d", icon_view->priv->cell_spacing);
@@ -1853,6 +1856,7 @@ xfdesktop_icon_view_style_set(GtkWidget *widget,
 DBG("cell text width proportion is %f", 
icon_view->priv->cell_text_width_proportion);
 DBG("ellipsize icon label is %s", 
icon_view->priv->ellipsize_icon_labels?"true":"false");
 DBG("tooltip size is %d", icon_view->priv->tooltip_size);
+DBG("label radius is %f", icon_view->priv->label_radius);
 
 if(icon_view->priv->selection_box_color) {
 gdk_color_free(icon_view->priv->selection_box_color);
@@ -2694,7 +2698,7 @@ 
xfdesktop_icon_view_invalidate_icon_pixbuf(XfdesktopIconView *icon_view,
 return;
 
 rect.x += CELL_PADDING + ((CELL_SIZE - 2 * CELL_PADDING) - rect.width) 
/ 2;
-rect.y += CELL_PADDING + SPACING;
+rect.y += CELL_PADDING;
 
 if(gtk_widget_get_realized(GTK_WIDGET(icon_view))) {
 gtk_widget_queue_draw_area(GTK_WIDGET(icon_view), rect.x, rect.y,
@@ -2710,17 +2714,12 @@ xfdesktop_paint_rounded_box(XfdesktopIconView 
*icon_view,
 GdkRectangle *expose_area)
 {
 GdkRectangle box_area, intersection;
-gdouble label_radius = 4.0;
-
-gtk_widget_style_get(GTK_WIDGET(icon_view),
- "label-radius", &label_radius,
- NULL);
 
 box_area = *text_area;
-box_area.x -= label_radius;
-box_area.y -= label_radius;
-box_area.width += label_radius * 2;
-box_area.height += label_radius * 2;
+box_area.x -= LABEL_RADIUS;
+box_area.y -= LABEL_RADIUS;
+box_area.width += LABEL_RADIUS * 2;
+box_area.height += LABEL_RADIUS * 2;
 
 if(gdk_rectangle_intersect(&box_area, expose_area, &intersection)) {
 cairo_t *cr = 
gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(icon_view)));
@@ -2741,29 +2740,29 @@ xfdesktop_paint_rounded_box(XfdesktopIconView 
*icon_view,
 gdk_cairo_rectangle(cr, expose_area);
 cairo_clip(cr);
 
-if(label_radius < 0.1)
+if(LABEL_RADIUS < 0.1)
 gdk_cairo_rectangle(cr, &box_area);
 else {
-cairo_move_to(cr, box_area.x, box_area.y + label_radius);
-cairo_arc(cr, box_area.x + label_radius,
-  box_area.y + label_radius, label_radius,
+cairo_move_to(cr, box_area.x, box_area.y + LABEL_RADIUS);
+cairo_arc(cr, box_area.x + LABEL_RADIUS,
+  box_area.y + LABEL_RADIUS, LABEL_RADIUS,
   M_PI, 3.0*M_PI/2.0);
-cairo_line_to(cr, box_area.x + box_area.width - label_radius,
+cairo_line_to(cr, box_area.x + box_area.width - LABEL_RADIUS,
   box_area.y);
-cairo_arc(cr, box_area.x + box_area.width - label_radius,
-  box_area.y + label

[Xfce4-commits] Lower update delay of icon size spinbutton (Bug 9882)

2013-08-26 Thread Eric Koegel
Updating branch refs/heads/master
 to 30ef6b2772c76899b3580e99ed754a8c5f18ca1c (commit)
   from 41a895db3cb15518c88b4344b2f53e84eb2f34b0 (commit)

commit 30ef6b2772c76899b3580e99ed754a8c5f18ca1c
Author: Jérôme Guelfucci 
Date:   Mon Aug 26 11:54:03 2013 +0300

Lower update delay of icon size spinbutton (Bug 9882)

This patch makes the process smoother when the value is taken into
account. The delay is used to avoid firing hundreds of events if
you keep the buttons pressed.

Signed-off-by: Eric Koegel 

 settings/main.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/settings/main.c b/settings/main.c
index 675809c..9731b87 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -870,7 +870,7 @@ cb_xfdesktop_spin_icon_size_changed(GtkSpinButton *button,
 timer_id = 0;
 }
 
-timer_id = g_timeout_add(2000,
+timer_id = g_timeout_add(500,
  (GSourceFunc)xfdesktop_spin_icon_size_timer,
  button);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] xfdesktop-application code cleanup

2013-11-12 Thread Eric Koegel
Updating branch refs/heads/eric/Port-to-GApplication
 to 14fa81af7edeb570e6f3251ed9b3dc795560a328 (commit)
   from 0efc8138db0b63262f1b674b49d2b23d92e4b37c (commit)

commit 14fa81af7edeb570e6f3251ed9b3dc795560a328
Author: Eric Koegel 
Date:   Wed Nov 13 09:09:22 2013 +0300

xfdesktop-application code cleanup

This patch also works around g_application_quit being too new.
The startup operation can be canceled now, additional comments
added and some sanity checks were added.

 src/xfce-desktop.c  |   10 ++-
 src/xfdesktop-application.c |  197 ++-
 2 files changed, 165 insertions(+), 42 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index b35a0a1..a0931ff 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -1094,15 +1094,17 @@ xfce_desktop_unrealize(GtkWidget *widget)
 gdk_flush();
 gdk_error_trap_pop();
 
-g_object_unref(G_OBJECT(desktop->priv->bg_pixmap));
-desktop->priv->bg_pixmap = NULL;
+if(desktop->priv->bg_pixmap) {
+g_object_unref(G_OBJECT(desktop->priv->bg_pixmap));
+desktop->priv->bg_pixmap = NULL;
+}
 
 gtk_window_set_icon(GTK_WINDOW(widget), NULL);
-
+
 gtk_style_detach(gtk_widget_get_style(widget));
 g_object_unref(G_OBJECT(gtk_widget_get_window(widget)));
 gtk_widget_set_window(widget, NULL);
-
+
 gtk_selection_remove_all(widget);
 
 gtk_widget_set_realized(widget, FALSE);
diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index 997b4f2..bc95841 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -126,6 +126,7 @@ struct _XfdesktopApplication
 gint nscreens;
 guint wait_for_wm_timeout_id;
 XfceSMClient *sm_client;
+GCancellable *cancel;
 
 gboolean opt_disable_wm_check;
 };
@@ -169,6 +170,8 @@ xfdesktop_application_init(XfdesktopApplication *app)
 {
 GSimpleAction *action;
 
+app->cancel = g_cancellable_new();
+
 #if !GLIB_CHECK_VERSION (2, 32, 0)
 app->actions = g_simple_action_group_new();
 #endif
@@ -208,18 +211,25 @@ xfdesktop_application_finalize(GObject *object)
 G_OBJECT_CLASS(xfdesktop_application_parent_class)->finalize(object);
 }
 
+/**
+ * xfdesktop_application_get:
+ *
+ * Singleton. Additional calls increase the reference count.
+ *
+ * Return value: #XfdesktopApplication, free with g_object_unref.
+ **/
 XfdesktopApplication *
 xfdesktop_application_get(void)
 {
 static XfdesktopApplication *app = NULL;
 
-if(app) {
-g_object_ref(G_OBJECT(app));
+if(app == NULL) {
+   app = g_object_new(XFDESKTOP_TYPE_APPLICATION,
+  "application-id", "org.xfce.xfdesktop",
+  "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
+  NULL);
 } else {
-  app = g_object_new(XFDESKTOP_TYPE_APPLICATION,
- "application-id", "org.xfce.xfdesktop",
- "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
- NULL);
+g_object_ref(app);
 }
 
 return app;
@@ -237,8 +247,32 @@ session_logout(void)
 static void
 session_die(gpointer user_data)
 {
-gtk_main_quit();
-g_application_quit(G_APPLICATION(user_data));
+gint main_level;
+XfdesktopApplication *app;
+
+TRACE("entering");
+
+/* If we somehow got here after the app has been released we don't need
+ * to do anything */
+if(user_data == NULL || !XFDESKTOP_IS_APPLICATION(user_data))
+return;
+
+app = XFDESKTOP_APPLICATION(user_data);
+
+/* Cancel the wait for wm check if it's still running */
+g_cancellable_cancel(app->cancel);
+
+/* unhook our session quit function */
+g_signal_handlers_disconnect_by_func(app->sm_client, session_die, app);
+
+for(main_level = gtk_main_level(); main_level > 0; --main_level)
+gtk_main_quit();
+
+#if GLIB_CHECK_VERSION(2, 32, 0)
+g_application_quit(G_APPLICATION(app));
+#else
+xfdesktop_application_shutdown(G_APPLICATION(app));
+#endif
 }
 
 static void
@@ -322,6 +356,9 @@ reload_idle_cb(gpointer data)
 
 TRACE("entering");
 
+g_return_if_fail(app->desktops);
+
+/* reload all the desktops */
 for(i = 0; i < app->nscreens; ++i) {
 if(app->desktops[i])
 xfce_desktop_refresh(XFCE_DESKTOP(app->desktops[i]));
@@ -339,7 +376,14 @@ cb_xfdesktop_application_reload(GAction  *action,
 GVariant *parameter,
 gpointer  data)
 {
-GApplication *g_application = G_APPLICATION(data);
+GApplication *g_application;
+
+if(!data || !G_IS_APPLICATION(data))
+return;
+
+g_application = G_APPLICATION(data);
+
+/* hold the app so it doesn't quit while a q

[Xfce4-commits] Wait for the window manager (Bug 7769)

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to f8204f77cf48452b7021ee707369f6b69f322928 (commit)
   from 1d9dca11efbc9ac7f416d9c9dccb2049be2b5997 (commit)

commit f8204f77cf48452b7021ee707369f6b69f322928
Author: Eric Koegel 
Date:   Sat Sep 21 11:34:48 2013 +0300

Wait for the window manager (Bug 7769)

When xfdesktop starts before the window manager the wallpaper images
and icons won't appear on all the screens. This patch waits for the
window manager to start up or 5 seconds before loading the desktops.
Most of the actual checking if the wm is ready is based on a patch
in xfce4-panel, commit-id cabbdfd1c04caf20a71e0af773accf809135a03d

 src/xfdesktop-application.c |  108 ++-
 1 file changed, 107 insertions(+), 1 deletion(-)

diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index f52c821..8d528db 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -23,6 +23,9 @@
  * Copyright (C) 2003 Benedikt Meurer 

  *  X event forwarding code:
  * Copyright (c) 2004 Nils Rennebarth
+ * Additional portions taken from 
https://bugzilla.xfce.org/attachment.cgi?id=3751
+ * which is in xfce4-panel git commit id 
2a8de2b1b019eaef543e34764c999a409fe2bef9
+ * and adapted for xfdesktop.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -85,6 +88,9 @@ static void cb_xfdesktop_application_arrange(GAction  *action,
  GVariant *parameter,
  gpointer  data);
 
+static gboolean cb_wait_for_window_manager(gpointer data);
+static void cb_wait_for_window_manager_destroyed(gpointer data);
+
 static void xfdesktop_application_startup(GApplication *g_application);
 static void xfdesktop_application_start(XfdesktopApplication *app);
 static void xfdesktop_application_shutdown(GApplication *g_application);
@@ -95,6 +101,18 @@ static gboolean 
xfdesktop_application_local_command_line(GApplication *g_applica
 static gint xfdesktop_application_command_line(GApplication *g_application,
GApplicationCommandLine 
*command_line);
 
+typedef struct
+{
+XfdesktopApplication *app;
+
+Display *dpy;
+Atom *atoms;
+guint atom_count;
+guint have_wm : 1;
+guint counter;
+guint wait_for_wm_timeout_id;
+} WaitForWM;
+
 struct _XfdesktopApplication
 {
 GApplication parent;
@@ -106,7 +124,10 @@ struct _XfdesktopApplication
 GtkWidget **desktops;
 XfconfChannel *channel;
 gint nscreens;
+guint wait_for_wm_timeout_id;
 XfceSMClient *sm_client;
+
+gboolean opt_disable_wm_check;
 };
 
 struct _XfdesktopApplicationClass
@@ -405,16 +426,95 @@ cb_xfdesktop_application_arrange(GAction  *action,
 xfce_desktop_arrange_icons(XFCE_DESKTOP(app->desktops[screen_num]));
 }
 
+static gboolean
+cb_wait_for_window_manager(gpointer data)
+{
+WaitForWM *wfwm = data;
+guint i;
+gboolean have_wm = TRUE;
+
+for(i = 0; i < wfwm->atom_count; i++) {
+if(XGetSelectionOwner(wfwm->dpy, wfwm->atoms[i]) == None) {
+DBG("window manager not ready on screen %d", i);
+have_wm = FALSE;
+break;
+}
+}
+
+wfwm->have_wm = have_wm;
+
+/* abort if a window manager is found or 5 seconds expired */
+return wfwm->counter++ < 20 * 5 && !wfwm->have_wm;
+}
+
+static void
+cb_wait_for_window_manager_destroyed(gpointer data)
+{
+WaitForWM *wfwm = data;
+
+g_return_if_fail(wfwm->app != NULL);
+
+wfwm->app->wait_for_wm_timeout_id = 0;
+
+if(!wfwm->have_wm) {
+g_printerr("No window manager registered on screen 0. "
+   "To start the xfdesktop without this check, run with 
--disable-wm-check.\n");
+} else {
+DBG("found window manager after %d tries", wfwm->counter);
+}
+
+/* start loading the desktop, hopefully a window manager is found, but it
+ * also works without it */
+xfdesktop_application_start(wfwm->app);
+
+g_free(wfwm->atoms);
+XCloseDisplay(wfwm->dpy);
+g_slice_free(WaitForWM, wfwm);
+}
+
 static void
 xfdesktop_application_startup(GApplication *g_application)
 {
 XfdesktopApplication *app = XFDESKTOP_APPLICATION(g_application);
+WaitForWM *wfwm;
+guint i;
+gchar **atom_names;
 
 TRACE("entering");
 
 g_application_hold(g_application);
 
-xfdesktop_application_start(app);
+if(!app->opt_disable_wm_check) {
+/* setup data for wm checking */
+wfwm = g_slice_new0(WaitForWM);
+wfwm->dpy = XOpenDisplay(NULL);
+wfwm->have_wm = FALSE;
+wfwm->counter = 0;
+wfwm->app = app;
+
+/* preload wm atoms for all screens */
+wfwm->atom_count = XScreenCount(wfwm->dpy);
+wfwm->atoms = g_new(Atom, wfwm->atom_co

[Xfce4-commits] Merge branch 'eric/Port-to-GApplication'

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 46c09c3a910df3e71bf9b15f5488c8265816256c (commit)
   from 2e4d8d39015c87b4c91c6a0e9192dba123a0c681 (commit)

commit 46c09c3a910df3e71bf9b15f5488c8265816256c
Merge: 2e4d8d3 14fa81a
Author: Eric Koegel 
Date:   Thu Nov 14 02:37:07 2013 +0300

Merge branch 'eric/Port-to-GApplication'

Conflicts:
common/xfdesktop-common.c
common/xfdesktop-common.h
src/main.c

commit 14fa81af7edeb570e6f3251ed9b3dc795560a328
Author: Eric Koegel 
Date:   Wed Nov 13 09:09:22 2013 +0300

xfdesktop-application code cleanup

This patch also works around g_application_quit being too new.
The startup operation can be canceled now, additional comments
added and some sanity checks were added.

commit 0efc8138db0b63262f1b674b49d2b23d92e4b37c
Author: Eric Koegel 
Date:   Mon Sep 23 14:10:27 2013 +0300

Tell session manage not to restart when quitting

commit f8204f77cf48452b7021ee707369f6b69f322928
Author: Eric Koegel 
Date:   Sat Sep 21 11:34:48 2013 +0300

Wait for the window manager (Bug 7769)

When xfdesktop starts before the window manager the wallpaper images
and icons won't appear on all the screens. This patch waits for the
window manager to start up or 5 seconds before loading the desktops.
Most of the actual checking if the wm is ready is based on a patch
in xfce4-panel, commit-id cabbdfd1c04caf20a71e0af773accf809135a03d

commit 1d9dca11efbc9ac7f416d9c9dccb2049be2b5997
Author: Eric Koegel 
Date:   Sat Sep 21 10:50:39 2013 +0300

Workaround g_action_map being too new

This adds in code for g_simple_action_group stuff so that it will
work with glib versions earlier than 2.32.

commit f4fa63b92f0ee07268f0af8b0bccb39a03c0e0e5
Author: Eric Koegel 
Date:   Sat Sep 21 09:57:11 2013 +0300

Use the GApplication API

Uses the GApplication API to handle process uniqueness, message
passing, and lifecycle management. This eliminates the need to
check if xfdesktop is already running and using X to forward events
to the running instance of xfdesktop making it eaiser to port to
GTK3 in the future (as well as GTKApplication).

 common/xfdesktop-common.c   |   47 ---
 common/xfdesktop-common.h   |3 -
 src/Makefile.am |4 +-
 src/main.c  |  356 +
 src/xfce-desktop.c  |   10 +-
 src/xfdesktop-application.c |  883 +++
 src/xfdesktop-application.h |   47 +++
 7 files changed, 951 insertions(+), 399 deletions(-)

diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index ca6b89c..f36c500 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -120,53 +120,6 @@ xfdesktop_image_file_is_valid(const gchar *filename)
 return image_valid;
 }
 
-gboolean
-xfdesktop_check_is_running(Window *xid)
-{
-const gchar *display = g_getenv("DISPLAY");
-gchar *p;
-gint xscreen = -1;
-gchar selection_name[100];
-Atom selection_atom;
-
-if(display) {
-if((p=g_strrstr(display, ".")))
-xscreen = atoi(p);
-}
-if(xscreen == -1)
-xscreen = 0;
-
-g_snprintf(selection_name, 100, XFDESKTOP_SELECTION_FMT, xscreen);
-selection_atom = XInternAtom(gdk_x11_get_default_xdisplay(), 
selection_name, False);
-
-if((*xid = XGetSelectionOwner(gdk_x11_get_default_xdisplay(), 
selection_atom)))
-return TRUE;
-
-return FALSE;
-}
-
-void
-xfdesktop_send_client_message(Window xid, const gchar *msg)
-{
-GdkEventClient gev;
-GtkWidget *win;
-
-win = gtk_invisible_new();
-gtk_widget_realize(win);
-
-gev.type = GDK_CLIENT_EVENT;
-gev.window = gtk_widget_get_window(win);
-gev.send_event = TRUE;
-gev.message_type = gdk_atom_intern("STRING", FALSE);
-gev.data_format = 8;
-strcpy(gev.data.b, msg);
-
-gdk_event_send_client_message((GdkEvent *)&gev, (GdkNativeWindow)xid);
-gdk_flush();
-
-gtk_widget_destroy(win);
-}
-
 /* The image styles changed from versions prior to 4.11.
  * Auto isn't an option anymore, additionally we should handle invalid
  * values. Set them to the default of stretched. */
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index e1b3878..78f543b 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -90,9 +90,6 @@ gboolean xfdesktop_image_file_is_valid(const gchar *filename);
 
 gchar *xfdesktop_get_file_mimetype(const gchar *file);
 
-gboolean xfdesktop_check_is_running(Window *xid);
-void xfdesktop_send_client_message(Window xid, const gchar *msg);
-
 gint xfce_translate_image_styles(gint input);
 
 guint32 xfdesktop_popup_keyboard_grab_available(GdkWindow *win);
diff --git a/src/Makefile.am b/src/Makefile.am
index 4d73dad..42667a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,7 +25,9 @@ xfdesktop_SOURCES = \
xfce-workspace

[Xfce4-commits] Tell session manage not to restart when quitting

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 0efc8138db0b63262f1b674b49d2b23d92e4b37c (commit)
   from f8204f77cf48452b7021ee707369f6b69f322928 (commit)

commit 0efc8138db0b63262f1b674b49d2b23d92e4b37c
Author: Eric Koegel 
Date:   Mon Sep 23 14:10:27 2013 +0300

Tell session manage not to restart when quitting

 src/xfdesktop-application.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index 8d528db..997b4f2 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -349,6 +349,12 @@ xfdesktop_handle_quit_signals(gint sig,
   gpointer user_data)
 {
 gint main_level;
+XfdesktopApplication *app = XFDESKTOP_APPLICATION(user_data);
+
+if(app->sm_client && XFCE_IS_SM_CLIENT(app->sm_client)) {
+xfce_sm_client_set_restart_style(app->sm_client,
+ XFCE_SM_CLIENT_RESTART_NORMAL);
+}
 
 for(main_level = gtk_main_level(); main_level > 0; --main_level)
 gtk_main_quit();
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add an info bar to the settings app (Bug 10460)

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 9a7b5c1381b8047dc97d2080a6274b2d468987e1 (commit)
   from 2456c1974cace0cb0494638146c33a88737cf6a9 (commit)

commit 9a7b5c1381b8047dc97d2080a6274b2d468987e1
Author: Eric Koegel 
Date:   Wed Nov 13 14:57:11 2013 +0300

Add an info bar to the settings app (Bug 10460)

The info bar will be used to notify the user that dragging the
window to another monitor or workspace will allow them to change
those settings. This should help user's customize those settings.

 settings/main.c|   45 +-
 .../xfdesktop-settings-appearance-frame-ui.glade   |  571 ++--
 2 files changed, 332 insertions(+), 284 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index a46d608..d64bf81 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -99,6 +99,8 @@ typedef struct
  * wnck_screen_get_active_workspace sometimes has to return NULL. */
 gint active_workspace;
 
+GtkWidget *infobar;
+GtkWidget *infobar_label;
 GtkWidget *label_header;
 GtkWidget *image_iconview;
 GtkWidget *btn_folder;
@@ -680,6 +682,14 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
 } else {
 g_snprintf(buf, sizeof(buf), _("Wallpaper for Monitor %d"), 
panel->monitor);
 }
+
+/* This is for the infobar letting the user know how to configure
+ * multiple monitor setups */
+gtk_label_set_text(GTK_LABEL(panel->infobar_label),
+   _("You are using more than one display, "
+ "move this dialog to the display you "
+ "want to edit the settings for."));
+gtk_widget_set_visible(panel->infobar, TRUE);
 } else {
 /* Multi-monitor per workspace wallpaper */
 if(panel->monitor_name) {
@@ -691,17 +701,36 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
_("Wallpaper for %s on Monitor %d"),
workspace_name, panel->monitor);
 }
+
+/* This is for the infobar letting the user know how to configure
+ * multiple monitor/workspace setups */
+gtk_label_set_text(GTK_LABEL(panel->infobar_label),
+   _("You are using more than one display, "
+ "move this dialog to the display and "
+ "workspace you want to edit the settings 
for."));
+gtk_widget_set_visible(panel->infobar, TRUE);
 }
 } else {
 
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all))) {
 /* Single monitor and single workspace */
 g_snprintf(buf, sizeof(buf), _("Wallpaper for my desktop"));
+
+/* No need for the infobar */
+gtk_widget_set_visible(panel->infobar, FALSE);
 } else {
 /* Single monitor and per workspace wallpaper */
 g_snprintf(buf, sizeof(buf), _("Wallpaper for %s"), 
workspace_name);
+
+/* This is for the infobar letting the user know how to configure
+ * multiple workspace setups */
+gtk_label_set_text(GTK_LABEL(panel->infobar_label),
+   _("Move this dialog to the workspace you "
+ "want to edit the settings for."));
+gtk_widget_set_visible(panel->infobar, TRUE);
 }
 }
 
+/* This label is for which workspace/monitor we're on */
 gtk_label_set_text(GTK_LABEL(panel->label_header), buf);
 
 g_free(workspace_name);
@@ -1619,7 +1648,7 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 GtkWidget *appearance_container, *chk_custom_font_size,
   *spin_font_size, *w, *box, *spin_icon_size,
   *chk_show_thumbnails, *chk_single_click, *appearance_settings,
-  *chk_show_tooltips, *spin_tooltip_size, *bnt_exit;
+  *chk_show_tooltips, *spin_tooltip_size, *bnt_exit, *content_area;
 GtkBuilder *appearance_gxml;
 AppearancePanel *panel = g_new0(AppearancePanel, 1);
 GError *error = NULL;
@@ -1728,6 +1757,20 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(appearance_container), FALSE);
 
 /* icon view area */
+panel->infobar = GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
+   "infobar_header"));
+
+panel->infobar_label = gtk_label_new("This is some text");
+gtk_widget_set_no_show_all(panel->infobar, TRUE);
+gtk_widget_show(panel->infobar_label);
+gtk

[Xfce4-commits] Workaround g_action_map being too new

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 1d9dca11efbc9ac7f416d9c9dccb2049be2b5997 (commit)
   from f4fa63b92f0ee07268f0af8b0bccb39a03c0e0e5 (commit)

commit 1d9dca11efbc9ac7f416d9c9dccb2049be2b5997
Author: Eric Koegel 
Date:   Sat Sep 21 10:50:39 2013 +0300

Workaround g_action_map being too new

This adds in code for g_simple_action_group stuff so that it will
work with glib versions earlier than 2.32.

 src/xfdesktop-application.c |   30 ++
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index f1b2944..f52c821 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -99,6 +99,10 @@ struct _XfdesktopApplication
 {
 GApplication parent;
 
+#if !GLIB_CHECK_VERSION (2, 32, 0)
+GSimpleActionGroup *actions;
+#endif
+
 GtkWidget **desktops;
 XfconfChannel *channel;
 gint nscreens;
@@ -130,33 +134,51 @@ 
xfdesktop_application_class_init(XfdesktopApplicationClass *klass)
 }
 
 static void
+xfdesktop_application_add_action(XfdesktopApplication *app, GAction *action)
+{
+#if GLIB_CHECK_VERSION (2, 32, 0)
+g_action_map_add_action(G_ACTION_MAP(app), action);
+#else
+g_simple_action_group_insert(app->actions, action);
+#endif
+}
+
+static void
 xfdesktop_application_init(XfdesktopApplication *app)
 {
 GSimpleAction *action;
 
+#if !GLIB_CHECK_VERSION (2, 32, 0)
+app->actions = g_simple_action_group_new();
+#endif
+
 /* reload action */
 action = g_simple_action_new("reload", NULL);
 g_signal_connect(action, "activate", 
G_CALLBACK(cb_xfdesktop_application_reload), app);
-g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(action));
+xfdesktop_application_add_action(app, G_ACTION(action));
 g_object_unref(action);
 
 /* quit action */
 action = g_simple_action_new("quit", NULL);
 g_signal_connect(action, "activate", 
G_CALLBACK(cb_xfdesktop_application_quit), app);
-g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(action));
+xfdesktop_application_add_action(app, G_ACTION(action));
 g_object_unref(action);
 
 /* menu action, parameter pops up primary (TRUE) or windowlist menu */
 action = g_simple_action_new("menu", G_VARIANT_TYPE_BOOLEAN);
 g_signal_connect(action, "activate", 
G_CALLBACK(cb_xfdesktop_application_menu), app);
-g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(action));
+xfdesktop_application_add_action(app, G_ACTION(action));
 g_object_unref(action);
 
 /* arrange action */
 action = g_simple_action_new("arrange", NULL);
 g_signal_connect(action, "activate", 
G_CALLBACK(cb_xfdesktop_application_arrange), app);
-g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(action));
+xfdesktop_application_add_action(app, G_ACTION(action));
 g_object_unref(action);
+
+#if !GLIB_CHECK_VERSION (2, 32, 0)
+g_application_set_action_group(G_APPLICATION(app), 
(GActionGroup*)app->actions);
+#endif
 }
 
 static void
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] xfdesktop-application code cleanup

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 14fa81af7edeb570e6f3251ed9b3dc795560a328 (commit)
   from 0efc8138db0b63262f1b674b49d2b23d92e4b37c (commit)

commit 14fa81af7edeb570e6f3251ed9b3dc795560a328
Author: Eric Koegel 
Date:   Wed Nov 13 09:09:22 2013 +0300

xfdesktop-application code cleanup

This patch also works around g_application_quit being too new.
The startup operation can be canceled now, additional comments
added and some sanity checks were added.

 src/xfce-desktop.c  |   10 ++-
 src/xfdesktop-application.c |  197 ++-
 2 files changed, 165 insertions(+), 42 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index b35a0a1..a0931ff 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -1094,15 +1094,17 @@ xfce_desktop_unrealize(GtkWidget *widget)
 gdk_flush();
 gdk_error_trap_pop();
 
-g_object_unref(G_OBJECT(desktop->priv->bg_pixmap));
-desktop->priv->bg_pixmap = NULL;
+if(desktop->priv->bg_pixmap) {
+g_object_unref(G_OBJECT(desktop->priv->bg_pixmap));
+desktop->priv->bg_pixmap = NULL;
+}
 
 gtk_window_set_icon(GTK_WINDOW(widget), NULL);
-
+
 gtk_style_detach(gtk_widget_get_style(widget));
 g_object_unref(G_OBJECT(gtk_widget_get_window(widget)));
 gtk_widget_set_window(widget, NULL);
-
+
 gtk_selection_remove_all(widget);
 
 gtk_widget_set_realized(widget, FALSE);
diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index 997b4f2..bc95841 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -126,6 +126,7 @@ struct _XfdesktopApplication
 gint nscreens;
 guint wait_for_wm_timeout_id;
 XfceSMClient *sm_client;
+GCancellable *cancel;
 
 gboolean opt_disable_wm_check;
 };
@@ -169,6 +170,8 @@ xfdesktop_application_init(XfdesktopApplication *app)
 {
 GSimpleAction *action;
 
+app->cancel = g_cancellable_new();
+
 #if !GLIB_CHECK_VERSION (2, 32, 0)
 app->actions = g_simple_action_group_new();
 #endif
@@ -208,18 +211,25 @@ xfdesktop_application_finalize(GObject *object)
 G_OBJECT_CLASS(xfdesktop_application_parent_class)->finalize(object);
 }
 
+/**
+ * xfdesktop_application_get:
+ *
+ * Singleton. Additional calls increase the reference count.
+ *
+ * Return value: #XfdesktopApplication, free with g_object_unref.
+ **/
 XfdesktopApplication *
 xfdesktop_application_get(void)
 {
 static XfdesktopApplication *app = NULL;
 
-if(app) {
-g_object_ref(G_OBJECT(app));
+if(app == NULL) {
+   app = g_object_new(XFDESKTOP_TYPE_APPLICATION,
+  "application-id", "org.xfce.xfdesktop",
+  "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
+  NULL);
 } else {
-  app = g_object_new(XFDESKTOP_TYPE_APPLICATION,
- "application-id", "org.xfce.xfdesktop",
- "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
- NULL);
+g_object_ref(app);
 }
 
 return app;
@@ -237,8 +247,32 @@ session_logout(void)
 static void
 session_die(gpointer user_data)
 {
-gtk_main_quit();
-g_application_quit(G_APPLICATION(user_data));
+gint main_level;
+XfdesktopApplication *app;
+
+TRACE("entering");
+
+/* If we somehow got here after the app has been released we don't need
+ * to do anything */
+if(user_data == NULL || !XFDESKTOP_IS_APPLICATION(user_data))
+return;
+
+app = XFDESKTOP_APPLICATION(user_data);
+
+/* Cancel the wait for wm check if it's still running */
+g_cancellable_cancel(app->cancel);
+
+/* unhook our session quit function */
+g_signal_handlers_disconnect_by_func(app->sm_client, session_die, app);
+
+for(main_level = gtk_main_level(); main_level > 0; --main_level)
+gtk_main_quit();
+
+#if GLIB_CHECK_VERSION(2, 32, 0)
+g_application_quit(G_APPLICATION(app));
+#else
+xfdesktop_application_shutdown(G_APPLICATION(app));
+#endif
 }
 
 static void
@@ -322,6 +356,9 @@ reload_idle_cb(gpointer data)
 
 TRACE("entering");
 
+g_return_if_fail(app->desktops);
+
+/* reload all the desktops */
 for(i = 0; i < app->nscreens; ++i) {
 if(app->desktops[i])
 xfce_desktop_refresh(XFCE_DESKTOP(app->desktops[i]));
@@ -339,7 +376,14 @@ cb_xfdesktop_application_reload(GAction  *action,
 GVariant *parameter,
 gpointer  data)
 {
-GApplication *g_application = G_APPLICATION(data);
+GApplication *g_application;
+
+if(!data || !G_IS_APPLICATION(data))
+return;
+
+g_application = G_APPLICATION(data);
+
+/* hold the app so it doesn't quit while a q

[Xfce4-commits] Use the GApplication API

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to f4fa63b92f0ee07268f0af8b0bccb39a03c0e0e5 (commit)
   from c014cb3231259ea4ffc4477f7ce7c7531f1c5d12 (commit)

commit f4fa63b92f0ee07268f0af8b0bccb39a03c0e0e5
Author: Eric Koegel 
Date:   Sat Sep 21 09:57:11 2013 +0300

Use the GApplication API

Uses the GApplication API to handle process uniqueness, message
passing, and lifecycle management. This eliminates the need to
check if xfdesktop is already running and using X to forward events
to the running instance of xfdesktop making it eaiser to port to
GTK3 in the future (as well as GTKApplication).

 common/xfdesktop-common.c   |   47 
 common/xfdesktop-common.h   |3 -
 src/Makefile.am |4 +-
 src/main.c  |  359 +
 src/xfdesktop-application.c |  628 +++
 src/xfdesktop-application.h |   47 
 6 files changed, 692 insertions(+), 396 deletions(-)

diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index 65f0214..f97f9d6 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -254,53 +254,6 @@ xfdesktop_image_file_is_valid(const gchar *filename)
 return image_valid;
 }
 
-gboolean
-xfdesktop_check_is_running(Window *xid)
-{
-const gchar *display = g_getenv("DISPLAY");
-gchar *p;
-gint xscreen = -1;
-gchar selection_name[100];
-Atom selection_atom;
-
-if(display) {
-if((p=g_strrstr(display, ".")))
-xscreen = atoi(p);
-}
-if(xscreen == -1)
-xscreen = 0;
-
-g_snprintf(selection_name, 100, XFDESKTOP_SELECTION_FMT, xscreen);
-selection_atom = XInternAtom(gdk_x11_get_default_xdisplay(), 
selection_name, False);
-
-if((*xid = XGetSelectionOwner(gdk_x11_get_default_xdisplay(), 
selection_atom)))
-return TRUE;
-
-return FALSE;
-}
-
-void
-xfdesktop_send_client_message(Window xid, const gchar *msg)
-{
-GdkEventClient gev;
-GtkWidget *win;
-
-win = gtk_invisible_new();
-gtk_widget_realize(win);
-
-gev.type = GDK_CLIENT_EVENT;
-gev.window = gtk_widget_get_window(win);
-gev.send_event = TRUE;
-gev.message_type = gdk_atom_intern("STRING", FALSE);
-gev.data_format = 8;
-strcpy(gev.data.b, msg);
-
-gdk_event_send_client_message((GdkEvent *)&gev, (GdkNativeWindow)xid);
-gdk_flush();
-
-gtk_widget_destroy(win);
-}
-
 guint
 xfce_grab_cursor(GtkWidget *w,
  GdkEventButton *evt)
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index 1d6db85..903875d 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -83,9 +83,6 @@ gboolean xfdesktop_image_file_is_valid(const gchar *filename);
 
 gchar *xfdesktop_get_file_mimetype(const gchar *file);
 
-gboolean xfdesktop_check_is_running(Window *xid);
-void xfdesktop_send_client_message(Window xid, const gchar *msg);
-
 guint xfce_grab_cursor(GtkWidget *w, GdkEventButton *evt);
 gboolean xfdesktop_popup_grab_available(GdkWindow *win, guint32 timestamp);
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 4d73dad..42667a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,7 +25,9 @@ xfdesktop_SOURCES = \
xfce-workspace.c \
xfce-workspace.h \
xfce-desktop.c \
-   xfce-desktop.h
+   xfce-desktop.h \
+   xfdesktop-application.c \
+   xfdesktop-application.h
 
 desktop_icon_sources = \
xfdesktop-icon.c \
diff --git a/src/main.c b/src/main.c
index d0f24bc..db6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,207 +48,27 @@
 #include 
 #endif
 
-#include 
-
-#include 
-#include 
-
-#include 
-#include 
-
 #ifdef ENABLE_FILE_ICONS
 #include 
 #endif
 
-#include "xfdesktop-common.h"
-#include "xfce-backdrop.h"
-#include "xfce-desktop.h"
-#include "menu.h"
-#include "windowlist.h"
-
-#ifdef HAVE_LIBNOTIFY
-#include "xfdesktop-notify.h"
-#endif
-
-static XfceSMClient *sm_client = NULL;
-
-static void
-session_logout(void)
-{
-xfce_sm_client_request_shutdown(sm_client, 
XFCE_SM_CLIENT_SHUTDOWN_HINT_ASK);
-}
-
-static void
-session_die(gpointer user_data)
-{
-gtk_main_quit();
-}
-
-static void
-event_forward_to_rootwin(GdkScreen *gscreen, GdkEvent *event)
-{
-XButtonEvent xev, xev2;
-Display *dpy = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(gscreen));
-
-if(event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) {
-if(event->type == GDK_BUTTON_PRESS) {
-xev.type = ButtonPress;
-/*
- * rox has an option to disable the next
- * instruction. it is called "blackbox_hack". Does
- * anyone know why exactly it is needed?
- */
-XUngrabPointer(dpy, event->button.time);
-} else
-xev.type = ButtonRelease;
-
-xev.button 

[Xfce4-commits] Use a label instead of a frame

2013-11-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 2456c1974cace0cb0494638146c33a88737cf6a9 (commit)
   from 46c09c3a910df3e71bf9b15f5488c8265816256c (commit)

commit 2456c1974cace0cb0494638146c33a88737cf6a9
Author: Eric Koegel 
Date:   Wed Nov 13 14:54:31 2013 +0300

Use a label instead of a frame

In the xfdesktop-settings app use just a label instead of a frame
above the icon view in the background tab. This will make it look
consistant with the other tabs.

 settings/main.c|   11 +-
 .../xfdesktop-settings-appearance-frame-ui.glade   |  560 ++--
 settings/xfdesktop-settings-ui.glade   |1 +
 3 files changed, 291 insertions(+), 281 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 050a4d5..a46d608 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -99,7 +99,7 @@ typedef struct
  * wnck_screen_get_active_workspace sometimes has to return NULL. */
 gint active_workspace;
 
-GtkWidget *frame_image_list;
+GtkWidget *label_header;
 GtkWidget *image_iconview;
 GtkWidget *btn_folder;
 GtkWidget *chk_apply_to_all;
@@ -702,7 +702,7 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
 }
 }
 
-gtk_frame_set_label(GTK_FRAME(panel->frame_image_list), buf);
+gtk_label_set_text(GTK_LABEL(panel->label_header), buf);
 
 g_free(workspace_name);
 }
@@ -1721,9 +1721,6 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 appearance_settings = GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
 
"alignment_settings"));
 
-panel->frame_image_list = 
GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
-
"frame_image_list"));
-
 /* Add the background tab widgets to the main window and don't display the
  * notebook label/tab */
 gtk_notebook_append_page(GTK_NOTEBOOK(appearance_container),
@@ -1731,8 +1728,8 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(appearance_container), FALSE);
 
 /* icon view area */
-panel->frame_image_list = 
GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
-
"frame_image_list"));
+panel->label_header = GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
+"label_header"));
 
 panel->image_iconview = GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
   
"iconview_imagelist"));
diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index a86ed18..100abea 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -34,312 +34,324 @@
 12
 6
 
-  
+  
 True
-0
-GTK_SHADOW_NONE
+6
 
-  
+  
 True
-6
+6
 
-  
+  
 True
-6
 
-  
+  
 True
-True
 GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-GTK_POLICY_AUTOMATIC
-GTK_POLICY_AUTOMATIC
-GTK_SHADOW_ETCHED_IN
-
-  
-True
-True
-GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-  
-
   
   
-True
+False
 0
   
 
+  
+  
+False
+0
+  
+
+
+  
+True
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+GTK_POLICY_AUTOMATIC
+GTK_POLICY_AUTOMATIC
+GTK_SHADOW_ETCHED_IN
 
-  
+  
 True
-8
-2
-6
-12
-
-  
-True
-GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-_

[Xfce4-commits] Make application source file strings translatable

2013-11-14 Thread Eric Koegel
Updating branch refs/heads/master
 to 4a33d012bb775c1d867f9dbd2431a5719a41e901 (commit)
   from 3df3613163fc6a0db624dbc86f743e5fd9983d4e (commit)

commit 4a33d012bb775c1d867f9dbd2431a5719a41e901
Author: Eric Koegel 
Date:   Fri Nov 15 02:16:28 2013 +0300

Make application source file strings translatable

 po/POTFILES.in |1 +
 1 file changed, 1 insertion(+)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 123841e..5410dea 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,6 +14,7 @@ src/xfce-backdrop.c
 src/xfce-desktop.c
 src/xfce-desktop-menu.c
 src/xfdesktop-app-menu-item.c
+src/xfdesktop-application.c
 src/xfdesktop-clipboard-manager.c
 src/xfdesktop-file-icon.c
 src/xfdesktop-file-icon-manager.c
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Improve how backdrops are choosen

2013-11-14 Thread Eric Koegel
Updating branch refs/heads/master
 to c033f2db3efd826723cc2c54f6d1970b2bf308e4 (commit)
   from 4a33d012bb775c1d867f9dbd2431a5719a41e901 (commit)

commit c033f2db3efd826723cc2c54f6d1970b2bf308e4
Author: Eric Koegel 
Date:   Fri Nov 15 02:17:47 2013 +0300

Improve how backdrops are choosen

The patch changes it so that xfdesktop keeps the list of possible
images in the same directory as the current file and sorts them
the same way as xfdesktop-settings. This is to help make it more
predicatable when xfdesktop advances the image. It will also monitor
the directory of images for image files being added or removed.

 src/xfce-backdrop.c |  356 ---
 1 file changed, 222 insertions(+), 134 deletions(-)

diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 11b950c..f0139f2 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -84,9 +84,9 @@ static void xfce_backdrop_file_input_stream_ready_cb(GObject 
*source_object,
 
 static void xfce_backdrop_image_data_release(XfceBackdropImageData 
*image_data);
 
-gchar *xfce_backdrop_choose_next (const gchar *filename);
-gchar *xfce_backdrop_choose_random   (const gchar *filename);
-gchar *xfce_backdrop_choose_chronological(const gchar *filename);
+gchar *xfce_backdrop_choose_next (XfceBackdrop *backdrop);
+gchar *xfce_backdrop_choose_random   (XfceBackdrop *backdrop);
+gchar *xfce_backdrop_choose_chronological(XfceBackdrop *backdrop);
 
 struct _XfceBackdropPriv
 {
@@ -103,6 +103,10 @@ struct _XfceBackdropPriv
 
 XfceBackdropImageStyle image_style;
 gchar *image_path;
+/* Cached list of images in the same folder as image_path */
+GList *image_files;
+/* monitor for the image_files directory */
+GFileMonitor *monitor;
 
 gboolean cycle_backdrop;
 guint cycle_timer;
@@ -241,9 +245,80 @@ xfce_backdrop_clear_cached_image(XfceBackdrop *backdrop)
 backdrop->priv->pix = NULL;
 }
 
-/* Returns a GList of all the files in the parent directory of filename */
+/* we compare by the collate key so the image listing is the same as how
+ * xfdesktop-settings displays the images */
+static gint
+compare_by_collate_key(const gchar *a, const gchar *b)
+{
+gint ret;
+gchar *a_key = g_utf8_collate_key_for_filename(a, -1);
+gchar *b_key = g_utf8_collate_key_for_filename(b, -1);
+
+ret = g_strcmp0(a_key, b_key);
+
+g_free(a_key);
+g_free(b_key);
+
+return ret;
+}
+
+static void
+cb_xfce_backdrop__image_files_changed(GFileMonitor *monitor,
+  GFile*file,
+  GFile*other_file,
+  GFileMonitorEvent event,
+  gpointer  user_data)
+{
+XfceBackdrop *backdrop = XFCE_BACKDROP(user_data);
+gchar *changed_file = NULL;
+GList *item;
+
+switch(event) {
+case G_FILE_MONITOR_EVENT_CREATED:
+changed_file = g_file_get_path(file);
+
+/* Make sure we don't already have the new file in the list */
+if(g_list_find(backdrop->priv->image_files, changed_file)) {
+g_free(changed_file);
+return;
+}
+
+/* If the new file is not an image then we don't have to do
+ * anything */
+if(!xfdesktop_image_file_is_valid(changed_file)) {
+g_free(changed_file);
+return;
+}
+
+/* It is an image file and we don't have it in our list, add it
+ * sorted to our list, don't free changed file, that will happen
+ * when it is removed */
+backdrop->priv->image_files = 
g_list_insert_sorted(backdrop->priv->image_files,
+   changed_file,
+   
(GCompareFunc)compare_by_collate_key);
+break;
+case G_FILE_MONITOR_EVENT_DELETED:
+changed_file = g_file_get_path(file);
+
+/* find the file in the list */
+item = g_list_find_custom(backdrop->priv->image_files,
+  changed_file,
+  (GCompareFunc)g_strcmp0);
+
+/* remove it */
+if(item)
+backdrop->priv->image_files = 
g_list_delete_link(backdrop->priv->image_files, item);
+
+g_free(changed_file);
+break;
+default:
+break;
+}
+}
+
+/* Returns a GList of all the image files in the parent directory of filename 
*/
 static GList *
-list_files_in_dir(const gchar *filename)
+list_image_files_in_dir(const gchar *filename)
 {
 GDir *dir;
 gboolean needs_slash = TRUE;
@@ -265,8 +340,10 @@ list_files_in_dir

[Xfce4-commits] Fix a couple warning messages

2013-11-15 Thread Eric Koegel
Updating branch refs/heads/master
 to 7eef5d322ad5092b5839e37aae3aab98a91064ff (commit)
   from 92abe3c5a0a1991eef78fb9ce903aa279ab24abb (commit)

commit 7eef5d322ad5092b5839e37aae3aab98a91064ff
Author: Eric Koegel 
Date:   Fri Nov 15 17:30:15 2013 +0300

Fix a couple warning messages

There were warning messages emitted when attempting to reload the
desktop icons before xfdesktop was ever started. Also --version
was unreffing the app object when it shouldn't.

 src/xfdesktop-application.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index bc95841..af98380 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -262,9 +262,6 @@ session_die(gpointer user_data)
 /* Cancel the wait for wm check if it's still running */
 g_cancellable_cancel(app->cancel);
 
-/* unhook our session quit function */
-g_signal_handlers_disconnect_by_func(app->sm_client, session_die, app);
-
 for(main_level = gtk_main_level(); main_level > 0; --main_level)
 gtk_main_quit();
 
@@ -356,7 +353,10 @@ reload_idle_cb(gpointer data)
 
 TRACE("entering");
 
-g_return_if_fail(app->desktops);
+/* If xfdesktop never started there's nothing to reload, xfdesktop will
+ * now startup */
+if(!app->desktops)
+return FALSE;
 
 /* reload all the desktops */
 for(i = 0; i < app->nscreens; ++i) {
@@ -434,7 +434,6 @@ 
xfdesktop_application_get_current_screen_number(XfdesktopApplication *app)
 screen_num = gdk_screen_get_number(screen);
 
 if(screen_num >= app->nscreens) {
-g_printerr("screen_num >= app->nscreens");
 return -1;
 }
 
@@ -833,8 +832,6 @@ xfdesktop_application_local_command_line(GApplication 
*g_application,
 #endif
 );
 
-/* free our memory and exit */
-g_object_unref(g_application);
 *exit_status = 0;
 return TRUE;
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Don't show the window until the background is ready.

2013-11-25 Thread Eric Koegel
Updating branch refs/heads/master
 to e47515567cecc02650e18ac1826fccc94da80857 (commit)
   from fc514be368a460b0946097236f58279dc7d6 (commit)

commit e47515567cecc02650e18ac1826fccc94da80857
Author: Alistair Buxton 
Date:   Mon Nov 25 22:31:12 2013 +

Don't show the window until the background is ready.

Instead of immediately showing the window, realize it instead.
This is pretty much the same thing except that it won't be visible
while the async background loading happens. Then show it after the
background is drawn.

Signed-off-by: Eric Koegel 

 src/xfce-desktop.c  |1 +
 src/xfdesktop-application.c |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index d93535c..27df359 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -517,6 +517,7 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 
 g_object_unref(G_OBJECT(pix));
 cairo_destroy(cr);
+gtk_widget_show(GTK_WIDGET(desktop));
 }
 
 if(clip_region != NULL)
diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index af98380..91d25e6 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -678,7 +678,7 @@ xfdesktop_application_start(XfdesktopApplication *app)
 windowlist_attach(XFCE_DESKTOP(app->desktops[i]));
 
 /* display the desktop and try to put it at the bottom */
-gtk_widget_show(app->desktops[i]);
+gtk_widget_realize(app->desktops[i]);
 gdk_window_lower(gtk_widget_get_window(app->desktops[i]));
 
 xfce_desktop_set_session_logout_func(XFCE_DESKTOP(app->desktops[i]),
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Don't set the root pixmap until it's been drawn

2013-11-27 Thread Eric Koegel
Updating branch refs/heads/master
 to a450d7b213754f8d9979b5324f315201a2929c98 (commit)
   from c9eaa4e01933e21a02ee2a4bf6ea4726cf70b755 (commit)

commit a450d7b213754f8d9979b5324f315201a2929c98
Author: Alistair Buxton 
Date:   Thu Nov 28 03:18:30 2013 +0300

Don't set the root pixmap until it's been drawn

Signed-off-by: Eric Koegel 

 src/xfce-desktop.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 27df359..ad8f533 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -349,8 +349,6 @@ create_bg_pixmap(GdkScreen *gscreen, gpointer user_data)
 if(!GDK_IS_PIXMAP(desktop->priv->bg_pixmap))
 return NULL;
 
-set_real_root_window_pixmap(desktop->priv->gscreen,
-desktop->priv->bg_pixmap);
 gdk_window_set_back_pixmap(gtk_widget_get_window(GTK_WIDGET(desktop)),
desktop->priv->bg_pixmap, FALSE);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Don't set ESETROOT.

2013-11-27 Thread Eric Koegel
Updating branch refs/heads/master
 to f4c2a90d89961e99d422cb59bb58322195976414 (commit)
   from a450d7b213754f8d9979b5324f315201a2929c98 (commit)

commit f4c2a90d89961e99d422cb59bb58322195976414
Author: Alistair Buxton 
Date:   Thu Nov 28 00:29:26 2013 +

Don't set ESETROOT.

This atom is used to inform other processes that the background
was set by a RetainPermanent client, which should be killed if
the background changes. Since xfdesktop is not RetainPermanent
and should not get killed, don't set this.

Signed-off-by: Eric Koegel 

 src/xfce-desktop.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index ad8f533..7ae3e0c 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -304,11 +304,6 @@ set_real_root_window_pixmap(GdkScreen *gscreen,
 gdk_atom_intern("_XROOTPMAP_ID", FALSE),
 gdk_atom_intern("PIXMAP", FALSE), 32,
 GDK_PROP_MODE_REPLACE, (guchar *)&xid, 1);
-/* set this other property because someone might need it sometime. */
-gdk_property_change(groot,
-gdk_atom_intern("ESETROOT_PMAP_ID", FALSE),
-gdk_atom_intern("PIXMAP", FALSE), 32,
-GDK_PROP_MODE_REPLACE, (guchar *)&xid, 1);
 /* and set the root window's BG pixmap, because aterm is somewhat lame. */
 gdk_window_set_back_pixmap(groot, pmap, FALSE);
 /* there really should be a standard for this crap... */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Update man page

2013-12-12 Thread Eric Koegel
Updating branch refs/heads/master
 to a83d43d32562c76754cbba3b5cbcabcd656c0081 (commit)
   from ce72d74bc4d339336e2e856097d9ef82fb5a4f59 (commit)

commit a83d43d32562c76754cbba3b5cbcabcd656c0081
Author: Eric Koegel 
Date:   Thu Dec 12 11:35:56 2013 +0300

Update man page

 xfdesktop.1 |   45 +
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/xfdesktop.1 b/xfdesktop.1
index e8638b2..e73ea50 100644
--- a/xfdesktop.1
+++ b/xfdesktop.1
@@ -1,4 +1,4 @@
-.TH XFDESKTOP 1 "Version 4.11.0" "29 September 2013"
+.TH XFDESKTOP 1 "December 2013"
 
 .SH NAME
 xfdesktop \- The Xfce 4 Desktop Environment's desktop manager
@@ -18,24 +18,49 @@ icons on the desktop.  Only one instance of xfdesktop can 
be running at
 a time, and should be started by running \fBxfdesktop\fP without any arguments.
 
 .SH OPTIONS
+
+.SS HELP OPTIONS:
+.TP
+.B \-h, --help
+Show help options
+.TP
+.B \--help-all
+Show all help options
+.TP
+.B \--help-gtk
+Show GTK+ Options
+.TP
+.B \--help-sm-client
+Show session management options
+
+.SS APPLICATION OPTIONS:
 .TP
-.B \--reload
+.B \-V, --version
+Display version information
+.TP
+.B \-R, --reload
 Causes an already-running instance of \fBxfdesktop\fP to reload all its
 settings, including loading a new random backdrop if using a backdrop list.
 .TP
-.B \--menu
+.B \-M, --menu
 Causes an already-running instance of \fBxfdesktop\fP to pop up the
 applications menu at the current position of the mouse cursor.
 .TP
-.B \--windowlist
+.B \-W, --windowlist
 Causes an already-running instance of \fBxfdesktop\fP to pop up the window
 list menu at the current position of the mouse cursor.
 .TP
-.B \--arrange
+.B \-A, --arrange
 Automatically arrange all the icons on the desktop
 .TP
-.B \--quit
+.B \-D, --disable-wm-check
+Do not wait for a window manager on startup
+.TP
+.B \-Q, --quit
 Cause \fBxfdesktop\fP to quit
+.TP
+.B \--display=[DISPLAY]
+X display to use
 
 .SH ENVIRONMENT
 \fBxfdesktop\fP's behavior is affected by the following environment variables.
@@ -61,9 +86,12 @@ If this environment variable is not present, it defaults to
 .SH BUGS
 Please report any bugs to
 .IR http://bugzilla.xfce.org/ .
+.br
 Development discussion should be conducted on the
 .IR xfce4-...@xfce.org
-mailing list.  Usage-related questions should be directed to the
+mailing list.
+.br
+Usage-related questions should be directed to the
 .IR x...@xfce.org
 mailing list.
 
@@ -72,7 +100,8 @@ mailing list.
 
 .SH AUTHOR
 Jasper Huijsmans , Benedikt Meurer
-, and Brian Tarricone .
+, Brian Tarricone , and Eric
+Koegel .
 
 This manual page was originally written by Brian Tarricone
 .br
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add xfconf property for add/remove workspace (Bug 4278, 7337)

2013-12-12 Thread Eric Koegel
Updating branch refs/heads/master
 to f12aa431c11f4aac2e9805f68e2f1d5b5424e079 (commit)
   from a83d43d32562c76754cbba3b5cbcabcd656c0081 (commit)

commit f12aa431c11f4aac2e9805f68e2f1d5b5424e079
Author: Eric Koegel 
Date:   Thu Dec 12 17:48:55 2013 +0300

Add xfconf property for add/remove workspace (Bug 4278, 7337)

An xfconf property /windowlist-menu/show-add-remove-workspaces
was added to allow the removal of the Add/Remove workspace buttons
on the windowlist menu. This will allow administrators to remove
those options when locking down xfconf properties for kiosk setups.
Also this patch updates the README.xfconf file with all the recent
xfconf property changes. It also revises the README.kiosk file
since xfdesktop relies on xfconf to lock properties rather than
the kioskrc file.

 doc/README.kiosk  |   58 +-
 doc/README.xfconf |   39 ++--
 src/windowlist.c  |   73 ++---
 3 files changed, 72 insertions(+), 98 deletions(-)

diff --git a/doc/README.kiosk b/doc/README.kiosk
index b0a175b..51728ab 100644
--- a/doc/README.kiosk
+++ b/doc/README.kiosk
@@ -1,52 +1,6 @@
-Xfdesktop supports a 'kiosk mode' in which you can restrict the actions users
-are allowed to take.  You can do this by creating a file called
-'xfdesktop.kioskrc' in $sysconfdir/xdg/xfce4/kiosk/ (usually
-/etc/xdg/xfce4/kiosk/). A sample file might look like this:
-
 begin xfdesktop.kioskrc ---
-UserMenu=%wheel
-CustomizeBackdrop=ALL
-CustomizeDesktopMenu=%wheel
-CustomizeWindowlist=NONE
-CustomizeDesktopIcons=brian
  end xfdesktop.kioskrc  ---
-
-Additionally, the above can be added to $sysconfdir/xdg/xfce4/kiosk/kioskrc
-if you put it in a section called '[xfdesktop]', like so:
-
 begin kioskrc ---
-[xfdesktop]
-UserMenu=%wheel
-CustomizeBackdrop=ALL
-CustomizeDesktopMenu=%wheel
-CustomizeWindowlist=NONE
-CustomizeDesktopIcons=brian
  end kioskrc  ---
-
-Entries in $sysconfdir/xdg/xfce4/kiosk/kioskrc will override any entries in
-$sysconfdir/xdg/xfce4/kiosk/xfdesktop.kioskrc.
-
-Each entry can have a user name, a group name (prefixed with '%'), or one of
-the two special values 'ALL' or 'NONE'.  Lists of names should be
-comma-separated.
-
-Here's an explanation of the keys:
-
-UserMenu:  Whether or not to allow user modifications to the desktop menu.  If
-   not, xfdesktop will ignore the menu.xml file in
-   ~/.config/xfce4/desktop/ and use the system menu in
-   $sysconfdir/xdg/xfce4/desktop/menu.xml.
-
-CustomizeBackdrop: Whether or not to allow user modifications to the desktop
-   backdrop.  If not, the Backdrop settings panel will be greyed out.
-
-CustomizeDesktopMenu: Whether or not to allow user modifications to the desktop
-   menu.  This includes showing or hiding application icons, as well
-   as showing or hiding the menu itself.
-
-CustomizeWindowlist: Whether or not to allow user modifications to the window
-   list.  This includes showing or hiding window icons, as well as
-   showing or hiding the menu itself.
-
-CustomizeDesktopIcons: Whether or not to allow the user to enable or disable
-   the display of desktop icons, or change their style.
+Any xfconf property or channel can be locked down to prevent
+specific users or groups from making changes. See the
+README.xfconf for the list of properties xfdesktop supports.
+Additional kiosk information is available at:
+http://docs.xfce.org/xfce/xfconf/start
+http://git.xfce.org/xfce/xfconf/tree/docs/spec/perchannel-xml.txt
diff --git a/doc/README.xfconf b/doc/README.xfconf
index 74bf96e..a762688 100644
--- a/doc/README.xfconf
+++ b/doc/README.xfconf
@@ -3,46 +3,57 @@ hierarchical configuration system.  The channel name that 
xfdesktop uses
 is 'xfce4-desktop'.  Property names below should be referred to with each
 component separated by a slash ('/') character.  The data type of each
 property is listd after the name.
+The monitor settings are referred to by name where possible so that when
+the same monitor is plugged in again those settings apply to it.
 
-
-  
-  
-
 
+  
+  
   
-
 
-  
-  
-  
-  
-  
-  
-  
+  
+
+
+
+
+
+
+
+
+
+  
 
   
 
 
 
+
 
 
 
+
 
 
 
-
+
 
 
 

[Xfce4-commits] Remove old GLIB/GTK macro checks

2013-12-14 Thread Eric Koegel
Updating branch refs/heads/master
 to 1a91076400b8f56126e654ccbd9751acc24974ed (commit)
   from f12aa431c11f4aac2e9805f68e2f1d5b5424e079 (commit)

commit 1a91076400b8f56126e654ccbd9751acc24974ed
Author: Eric Koegel 
Date:   Sat Dec 14 21:35:35 2013 +0300

Remove old GLIB/GTK macro checks

Remove old GLIB/GTK workarounds that were needed in the past. Also
GSEAL a context action and switch from GtkObject to GtkWidget as
GtkObject will be gone in the future.

 src/windowlist.c  |2 +-
 src/xfdesktop-app-menu-item.c |   19 +--
 src/xfdesktop-clipboard-manager.c |4 ++--
 src/xfdesktop-file-icon-manager.c |5 +
 src/xfdesktop-icon-view.c |2 +-
 src/xfdesktop-regular-file-icon.c |5 +
 src/xfdesktop-special-file-icon.c |5 +
 src/xfdesktop-volume-icon.c   |6 +-
 8 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/src/windowlist.c b/src/windowlist.c
index fd04573..09292e1 100644
--- a/src/windowlist.c
+++ b/src/windowlist.c
@@ -123,7 +123,7 @@ window_destroyed_cb(gpointer data, GObject 
*where_the_object_was)
 }
 
 static void
-mi_destroyed_cb(GtkObject *object, gpointer user_data)
+mi_destroyed_cb(GtkWidget *object, gpointer user_data)
 {
 g_object_weak_unref(G_OBJECT(user_data),
 (GWeakNotify)window_destroyed_cb, object);
diff --git a/src/xfdesktop-app-menu-item.c b/src/xfdesktop-app-menu-item.c
index f565c21..8485f4c 100644
--- a/src/xfdesktop-app-menu-item.c
+++ b/src/xfdesktop-app-menu-item.c
@@ -45,7 +45,7 @@ struct _XfdesktopAppMenuItem
 
 typedef struct _XfdesktopAppMenuItemClass
 {
-   GtkImageMenuItemClass parent;
+GtkImageMenuItemClass parent;
 } XfdesktopAppMenuItemClass;
 
 enum
@@ -228,9 +228,6 @@ static void
 xfdesktop_app_menu_item_changed(XfdesktopAppMenuItem *app_menu_item)
 {
 const gchar *label;
-#if !GTK_CHECK_VERSION (2, 16, 0)
-GtkWidget   *child;
-#endif
 
 g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
 g_return_if_fail(GARCON_IS_MENU_ITEM(app_menu_item->item));
@@ -242,21 +239,7 @@ xfdesktop_app_menu_item_changed(XfdesktopAppMenuItem 
*app_menu_item)
 if (G_UNLIKELY (label == NULL))
   label = "";
 
-#if GTK_CHECK_VERSION(2, 16, 0)
 gtk_menu_item_set_label(GTK_MENU_ITEM(app_menu_item), label);
-#else
-child = gtk_bin_get_child(GTK_BIN (app_menu_item));
-if (child == NULL) {
-child = gtk_accel_label_new(label);
-gtk_container_add(GTK_CONTAINER(app_menu_item), child);
-gtk_misc_set_alignment(GTK_MISC(child), 0.0, 0.5);
-gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(child), 
GTK_WIDGET(app_menu_item));
-gtk_widget_show(child);
-} else {
-g_return_if_fail(GTK_IS_LABEL(child));
-gtk_label_set_text(GTK_LABEL(child), label);
-}
-#endif
 }
 
 static void
diff --git a/src/xfdesktop-clipboard-manager.c 
b/src/xfdesktop-clipboard-manager.c
index 75a07cf..a02dacc 100644
--- a/src/xfdesktop-clipboard-manager.c
+++ b/src/xfdesktop-clipboard-manager.c
@@ -78,11 +78,11 @@ static void xfdesktop_clipboard_manager_file_destroyed
(XfdesktopClipboardMan
 static void xfdesktop_clipboard_manager_owner_changed (GtkClipboard
   *clipboard,
GdkEventOwnerChange 
   *event,

XfdesktopClipboardManager  *manager);
-#if 0
+
 static void xfdesktop_clipboard_manager_contents_received (GtkClipboard
   *clipboard,
GtkSelectionData
   *selection_data,
gpointer
user_data);
-#endif
+
 static void xfdesktop_clipboard_manager_targets_received  (GtkClipboard
   *clipboard,
GtkSelectionData
   *selection_data,
gpointer
user_data);
diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 239d064..f473701 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2739,11 +2739,8 @@ xfdesktop_file_icon_manager_files_ready(GFileEnumerator 
*enumerator,
 if(!files) {
 if(error) {
 GtkWidget *toplevel = 
gtk_widget_get_toplevel(GTK_WIDGET(fmanager->priv->icon_view));
-#if GTK_CHECK_VERSION (2, 18, 0)
+
 xfce_message_dialog(gtk_widget_is_toplevel(toplevel) ? 
GTK_WINDOW(toplevel) : NULL,
-#else
-xfce_message_dialog(GTK_WIDGET_TOPLEVEL(toplevel) ? 
GTK_WINDOW(toplevel) : NULL,
-#endif
 _("Load Error"),
 GTK_STOCK_DIALOG_WARNING, 
 _("Failed to

[Xfce4-commits] Add a settings option for the add/remove workspace property

2013-12-14 Thread Eric Koegel
Updating branch refs/heads/master
 to fb2bee20a297458adb1d00a4ea878a36d290b57a (commit)
   from e2e0d0feee28148e6786245b6ee47a64c9d1cc46 (commit)

commit fb2bee20a297458adb1d00a4ea878a36d290b57a
Author: Eric Koegel 
Date:   Sat Dec 14 22:04:30 2013 +0300

Add a settings option for the add/remove workspace property

 settings/main.c  |6 ++
 settings/xfdesktop-settings-ui.glade |   13 +
 2 files changed, 19 insertions(+)

diff --git a/settings/main.c b/settings/main.c
index d64bf81..dec5ea4 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -70,6 +70,7 @@
 #define WINLIST_SHOW_STICKY_WIN_ONCE_PROP
"/windowlist-menu/show-sticky-once"
 #define WINLIST_SHOW_WS_NAMES_PROP   
"/windowlist-menu/show-workspace-names"
 #define WINLIST_SHOW_WS_SUBMENUS_PROP"/windowlist-menu/show-submenus"
+#define WINLIST_SHOW_ADD_REMOVE_WORKSPACES_PROP 
"/windowlist-menu/show-add-remove-workspaces"
 
 #define DESKTOP_ICONS_STYLE_PROP "/desktop-icons/style"
 #define DESKTOP_ICONS_ICON_SIZE_PROP "/desktop-icons/icon-size"
@@ -1880,6 +1881,11 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
gtk_builder_get_object(main_gxml, 
"chk_show_winlist_sticky_once"),
"active");
 
+xfconf_g_property_bind(channel, WINLIST_SHOW_ADD_REMOVE_WORKSPACES_PROP,
+   G_TYPE_BOOLEAN,
+   gtk_builder_get_object(main_gxml, 
"chk_show_app_remove_workspaces"),
+   "active");
+
 w = GTK_WIDGET(gtk_builder_get_object(main_gxml, 
"chk_show_winlist_ws_names"));
 xfconf_g_property_bind(channel, WINLIST_SHOW_WS_NAMES_PROP, G_TYPE_BOOLEAN,
G_OBJECT(w), "active");
diff --git a/settings/xfdesktop-settings-ui.glade 
b/settings/xfdesktop-settings-ui.glade
index 16f7ae8..9630a31 100644
--- a/settings/xfdesktop-settings-ui.glade
+++ b/settings/xfdesktop-settings-ui.glade
@@ -488,6 +488,19 @@
 4
   
 
+
+  
+True
+True
+GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+Show a_dd and remove workspace options in list
+True
+True
+  
+  
+5
+  
+
   
 
   
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Move max-template-files xfconf property

2013-12-14 Thread Eric Koegel
Updating branch refs/heads/master
 to e2e0d0feee28148e6786245b6ee47a64c9d1cc46 (commit)
   from 1a91076400b8f56126e654ccbd9751acc24974ed (commit)

commit e2e0d0feee28148e6786245b6ee47a64c9d1cc46
Author: Eric Koegel 
Date:   Sat Dec 14 21:52:38 2013 +0300

Move max-template-files xfconf property

Put the max-template-files xfconf property under the desktop-menu
where it belongs.

 common/xfdesktop-common.h |3 ++-
 doc/README.xfconf |4 ++--
 src/xfdesktop-file-icon-manager.c |2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index 78f543b..f73606a 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -61,7 +61,8 @@
 #define DESKTOP_ICONS_SHOW_TRASH 
"/desktop-icons/file-icons/show-trash"
 #define DESKTOP_ICONS_SHOW_FILESYSTEM
"/desktop-icons/file-icons/show-filesystem"
 #define DESKTOP_ICONS_SHOW_REMOVABLE 
"/desktop-icons/file-icons/show-removable"
-#define DESKTOP_ICONS_MAX_TEMPLATE_FILES 
"/desktop-icons/file-icons/max-template-files"
+
+#define DESKTOP_MENU_MAX_TEMPLATE_FILES "/desktop-menu/max-template-files"
 
 /**
  * File information namespaces queried for #GFileInfo objects.
diff --git a/doc/README.xfconf b/doc/README.xfconf
index a762688..80f0ed8 100644
--- a/doc/README.xfconf
+++ b/doc/README.xfconf
@@ -32,10 +32,11 @@ the same monitor is plugged in again those settings apply 
to it.
 
 
 
-
+
 
 
 
+
 
 
 

[Xfce4-commits] Scale down oversize icons in menus (Bugs 10545, 10461)

2013-12-19 Thread Eric Koegel
Updating branch refs/heads/master
 to 596ac7b07939b3b93c6253b2db704a91e68e75d0 (commit)
   from 37baff27944ba6282e420069e0993f08953ff482 (commit)

commit 596ac7b07939b3b93c6253b2db704a91e68e75d0
Author: Eric Koegel 
Date:   Sun Dec 15 12:18:01 2013 +0300

Scale down oversize icons in menus (Bugs 10545, 10461)

Use exo_gdk_pixbuf_scale_down to ensure the icons in the menu don't
exceed the selected icon size.

 src/xfdesktop-app-menu-item.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/xfdesktop-app-menu-item.c b/src/xfdesktop-app-menu-item.c
index 8485f4c..ca19499 100644
--- a/src/xfdesktop-app-menu-item.c
+++ b/src/xfdesktop-app-menu-item.c
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 
 #include "xfdesktop-app-menu-item.h"
 
@@ -212,6 +213,11 @@ xfdesktop_app_menu_item_set_icon(XfdesktopAppMenuItem 
*app_menu_item)
 
 /* Turn the pixbuf into a gtk_image */
 if(G_LIKELY(pixbuf)) {
+/* scale the pixbuf down if it needs it */
+GdkPixbuf *tmp = exo_gdk_pixbuf_scale_down(pixbuf, TRUE, w, h);
+g_object_unref(pixbuf);
+pixbuf = tmp;
+
 image = gtk_image_new_from_pixbuf(pixbuf);
 g_object_unref(G_OBJECT(pixbuf));
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change thumbnail and padding in the settings app

2013-03-16 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 8e38b064c7c09c787d7af78efff4eaa59c235510 (commit)
   from f51d49ec663ae59c3c5c357eedd9c378a1fdfd13 (commit)

commit 8e38b064c7c09c787d7af78efff4eaa59c235510
Author: Eric Koegel 
Date:   Sat Mar 16 13:30:32 2013 +0300

Change thumbnail and padding in the settings app

Increase the thumbnail size and lower the padding between individual
thumbnails in xfdesktop-settings.

 settings/main.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 95ced14..71f917f 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -54,9 +54,8 @@
 #include "xfdesktop-settings-ui.h"
 #include "xfdesktop-settings-appearance-frame-ui.h"
 
-#define PREVIEW_HEIGHT  48
-#define MAX_ASPECT_RATIO 3.0f
-#define PREVIEW_WIDTH 128
+#define PREVIEW_HEIGHT  96
+#define MAX_ASPECT_RATIO 2.0f
 
 #define SHOW_DESKTOP_MENU_PROP   "/desktop-menu/show"
 #define DESKTOP_MENU_SHOW_ICONS_PROP "/desktop-menu/show-icons"
@@ -1126,9 +1125,11 @@ xfdesktop_settings_setup_image_iconview(AppearancePanel 
*panel)
 
 g_object_set(G_OBJECT(iconview),
 "pixbuf-column", COL_PIX,
-"item-width", PREVIEW_WIDTH,
 "tooltip-column", COL_NAME,
 "selection-mode", GTK_SELECTION_BROWSE,
+"column-spacing", 2,
+"item-padding", 2,
+"margin", 2,
 NULL);
 
 g_signal_connect(G_OBJECT(iconview), "selection-changed",
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix a warning message

2013-03-16 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 95542b215411106f404e21a443ddd1e7059fff1c (commit)
   from 8e38b064c7c09c787d7af78efff4eaa59c235510 (commit)

commit 95542b215411106f404e21a443ddd1e7059fff1c
Author: Eric Koegel 
Date:   Sun Mar 17 09:37:18 2013 +0300

Fix a warning message

 src/xfce-desktop.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 11df13d..09f2e53 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -409,7 +409,9 @@ screen_size_changed_cb(GdkScreen *gscreen, gpointer 
user_data)
 TRACE("entering");
 
 g_return_if_fail(XFCE_IS_DESKTOP(desktop));
-g_return_if_fail(desktop->priv->workspaces);
+
+if(desktop->priv->workspaces == NULL)
+return;
 
 w = gdk_screen_get_width(gscreen);
 h = gdk_screen_get_height(gscreen);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix memory leaks

2013-03-17 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 594ea3b79117c866b8d2358dc2b44303572e0578 (commit)
   from 95542b215411106f404e21a443ddd1e7059fff1c (commit)

commit 594ea3b79117c866b8d2358dc2b44303572e0578
Author: Eric Koegel 
Date:   Sun Mar 17 13:36:54 2013 +0300

Fix memory leaks

 settings/main.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 71f917f..3f00439 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -670,6 +670,7 @@ cb_image_selection_changed(GtkIconView *icon_view,
 xfconf_channel_set_string(panel->channel, buf, filename);
 }
 
+g_list_foreach (selected_items, (GFunc)gtk_tree_path_free, NULL);
 g_list_free(selected_items);
 g_free(current_filename);
 g_free(buf);
@@ -819,10 +820,13 @@ cb_folder_selection_changed(GtkWidget *button,
 TRACE("entering");
 
 /* Check to see if the folder actually did change */
-if(g_strcmp0(filename, previous_filename) == 0)
+if(g_strcmp0(filename, previous_filename) == 0) {
+g_free(filename);
 return;
+}
 
 TRACE("folder changed to: %s", filename);
+g_free(previous_filename);
 previous_filename = filename;
 
 xfdesktop_settings_stop_image_loading(panel);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Clip overlapping backdrops (Bug #9052)

2013-03-17 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 963d829f123b7cd4da36c25fa03cf5754897e195 (commit)
   from 594ea3b79117c866b8d2358dc2b44303572e0578 (commit)

commit 963d829f123b7cd4da36c25fa03cf5754897e195
Author: Eric Koegel 
Date:   Sun Mar 17 14:45:27 2013 +0300

Clip overlapping backdrops (Bug #9052)

In a multi-monitor setup each successive wallpaper drawn has the
previous area subtracted from it so that the wallpapers aren't
drawn over each other.

 src/xfce-desktop.c   |   89 ++---
 src/xfce-workspace.c |1 -
 2 files changed, 69 insertions(+), 21 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 09f2e53..2623547 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -321,6 +321,7 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 cairo_t *cr;
 GdkPixbuf *pix;
 GdkRectangle rect;
+GdkRegion *clip_region = NULL;
 gint i, monitor = -1, current_workspace;
 
 TRACE("entering");
@@ -376,27 +377,75 @@ backdrop_changed_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 
 xfce_backdrop_set_size(backdrop, rect.width, rect.height);
 
-/* create/get the composited backdrop pixmap */
-pix = xfce_backdrop_get_pixbuf(backdrop);
-if(!pix)
-return;
+if(monitor > 0
+   && 
!xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[current_workspace]))
 {
+clip_region = gdk_region_rectangle(&rect);
 
-cr = gdk_cairo_create(GDK_DRAWABLE(pmap));
-gdk_cairo_set_source_pixbuf(cr, pix, rect.x, rect.y);
-cairo_paint(cr);
-g_object_unref(G_OBJECT(pix));
-cairo_destroy(cr);
-
-/* tell gtk to redraw the repainted area */
-gtk_widget_queue_draw_area(GTK_WIDGET(desktop), rect.x, rect.y,
-   rect.width, rect.height);
-
-set_imgfile_root_property(desktop,
-  xfce_backdrop_get_image_filename(backdrop),
-  monitor);
-
-/* do this again so apps watching the root win notice the update */
-set_real_root_window_pixmap(gscreen, pmap);
+DBG("clip_region: x: %d, y: %d, w: %d, h: %d",
+rect.x, rect.y, rect.width, rect.height);
+
+/* If we are not monitor 0 on a multi-monitor setup we need to subtract
+ * all the previous monitor regions so we don't draw over them. This
+ * should prevent the overlap and double backdrop drawing bugs.
+ */
+for(i = 0; i < monitor; i++) {
+GdkRectangle previous_monitor;
+GdkRegion *previous_region;
+gdk_screen_get_monitor_geometry(gscreen, i, &previous_monitor);
+
+DBG("previous_monitor: x: %d, y: %d, w: %d, h: %d",
+previous_monitor.x, previous_monitor.y,
+previous_monitor.width, previous_monitor.height);
+
+previous_region = gdk_region_rectangle(&previous_monitor);
+
+gdk_region_subtract(clip_region, previous_region);
+
+gdk_region_destroy(previous_region);
+}
+}
+
+if(clip_region != NULL) {
+/* Update the area to redraw to limit the icons/area painted */
+gdk_region_get_clipbox(clip_region, &rect);
+DBG("area to update: x: %d, y: %d, w: %d, h: %d",
+rect.x, rect.y, rect.width, rect.height);
+}
+
+if(rect.width != 0 && rect.height != 0) {
+/* create/get the composited backdrop pixmap */
+pix = xfce_backdrop_get_pixbuf(backdrop);
+if(!pix)
+return;
+
+cr = gdk_cairo_create(GDK_DRAWABLE(pmap));
+gdk_cairo_set_source_pixbuf(cr, pix, rect.x, rect.y);
+
+/* clip the area so we don't draw over a previous wallpaper */
+if(clip_region != NULL) {
+gdk_cairo_region(cr, clip_region);
+cairo_clip(cr);
+}
+
+cairo_paint(cr);
+g_object_unref(G_OBJECT(pix));
+
+cairo_destroy(cr);
+
+/* tell gtk to redraw the repainted area */
+gtk_widget_queue_draw_area(GTK_WIDGET(desktop), rect.x, rect.y,
+   rect.width, rect.height);
+
+set_imgfile_root_property(desktop,
+  xfce_backdrop_get_image_filename(backdrop),
+  monitor);
+
+/* do this again so apps watching the root win notice the update */
+set_real_root_window_pixmap(gscreen, pmap);
+}
+
+if(clip_region != NULL)
+gdk_region_destroy(clip_region);
 }
 
 static void
diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c
index eeb131b..cdcae08 100644
--- a/src/xfce-workspace.c
+++ b/src/xfce-workspace.c
@@ -149,7 +149,6 @@ backdrop_cycle_cb(XfceBackdrop *backdrop, gpointer 
user_data)
 if(g_strcmp0(backdrop_file, new_b

[Xfce4-commits] Correctly handle workspaces being removed

2013-03-25 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 9f81066800a9de6a2a20f5436e69fad2492564e2 (commit)
   from 963d829f123b7cd4da36c25fa03cf5754897e195 (commit)

commit 9f81066800a9de6a2a20f5436e69fad2492564e2
Author: Eric Koegel 
Date:   Mon Mar 25 19:20:41 2013 +0300

Correctly handle workspaces being removed

When workspaces are removed the xfconf bindings need to be removed
and it also handles the single workspace number set to an invalid
workspace.

 src/xfce-desktop.c   |   67 +++--
 src/xfce-workspace.c |  199 ++
 2 files changed, 177 insertions(+), 89 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 2623547..bf00f2d 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -481,6 +481,9 @@ screen_size_changed_cb(GdkScreen *gscreen, gpointer 
user_data)
 if(desktop->priv->nworkspaces <= current_workspace)
 return;
 
+if(current_workspace < 0)
+return;
+
 /* special case for 1 backdrop to handle xinerama stretching */
 
if(xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[current_workspace]))
 {

backdrop_changed_cb(xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace],
 0), desktop);
@@ -549,33 +552,36 @@ workspace_changed_cb(WnckScreen *wnck_screen,
 TRACE("entering");
 
 current_workspace = desktop->priv->current_workspace;
-desktop->priv->current_workspace = 
xfce_desktop_get_current_workspace(desktop);
-new_workspace = desktop->priv->current_workspace;
+new_workspace = xfce_desktop_get_current_workspace(desktop);
 
-DBG("current_workspace %d, new_workspace %d",
-current_workspace, new_workspace);
+if(new_workspace < 0 || new_workspace >= desktop->priv->nworkspaces)
+return;
 
-/* special case for the spanning screen option */
-
if(xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[new_workspace]))
 {
-current_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace], 0);
-new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], 0);
+desktop->priv->current_workspace = new_workspace;
 
-if(!xfce_backdrop_compare_backdrops(current_backdrop, new_backdrop)) {
-backdrop_changed_cb(new_backdrop, user_data);
-return;
-}
-}
+DBG("current_workspace %d, new_workspace %d",
+current_workspace, new_workspace);
 
-/* We want to compare the current workspace backdrops with the new one
- * and see if we can avoid changing them if they are the same image/style 
*/
 for(i = 0; i < xfce_desktop_get_n_monitors(desktop); i++) {
-current_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace], i);
-new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
+/* We want to compare the current workspace backdrop with the new one
+ * and see if we can avoid changing them if they are the same 
image/style */
+if(current_workspace < desktop->priv->nworkspaces) {
+current_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[current_workspace], i);
+new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
 
-if(!xfce_backdrop_compare_backdrops(current_backdrop, new_backdrop)) {
-/* only update monitors that require it */
+if(!xfce_backdrop_compare_backdrops(current_backdrop, 
new_backdrop)) {
+/* only update monitors that require it */
+backdrop_changed_cb(new_backdrop, user_data);
+}
+} else {
+/* If current_workspace was removed, get the new backdrop and 
apply it */
+new_backdrop = 
xfce_workspace_get_backdrop(desktop->priv->workspaces[new_workspace], i);
 backdrop_changed_cb(new_backdrop, user_data);
 }
+
+/* When we're spanning screens we only care about the first monitor */
+
if(xfce_workspace_get_xinerama_stretch(desktop->priv->workspaces[new_workspace]))
+break;
 }
 }
 
@@ -638,6 +644,10 @@ workspace_destroyed_cb(WnckScreen *wnck_screen,
 /* deallocate it */
 desktop->priv->workspaces = g_realloc(desktop->priv->workspaces,
   desktop->priv->nworkspaces * 
sizeof(XfceWorkspace *));
+
+/* Make sure we stay within bounds now that we removed a workspace */
+if(desktop->priv->current_workspace > desktop->priv->nworkspaces)
+desktop->priv->current_workspace = desktop->priv->nworkspaces;
 }
 
 static void
@@ -787,7 +797,7 @@ xf

[Xfce4-commits] Fix for invalid single workspace number in settings app

2013-03-25 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to be0719f7c9e686ee52dc8a9a37f27e15f18203d1 (commit)
   from 02c53a331c02300134d66da376bcb6a85d90be63 (commit)

commit be0719f7c9e686ee52dc8a9a37f27e15f18203d1
Author: Eric Koegel 
Date:   Sun Mar 24 15:07:29 2013 +0300

Fix for invalid single workspace number in settings app

Xfdesktop-settings app now repsonds to workspaces being created
and destroyed because it can impact how the single workspace mode
operates. If the single workspace number is set to a workspace that
is destroyed it reverts back to per workspace wallpapers and toogles
the checkbox so that the user knows what is going on.

 settings/main.c |   52 +++-
 1 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index f33f543..d10dec2 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -101,6 +101,7 @@ typedef struct
 GtkWidget *frame_image_list;
 GtkWidget *image_iconview;
 GtkWidget *btn_folder;
+GtkWidget *chk_apply_to_all;
 GtkWidget *image_style_combo;
 GtkWidget *color_style_combo;
 GtkWidget *color1_btn;
@@ -141,6 +142,9 @@ enum
 N_ICON_COLS,
 };
 
+static void cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
+  gpointer user_data);
+
 
 /* assumes gdk lock is held on function enter, and should be held
  * on function exit */
@@ -683,7 +687,7 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
 {
 WnckWorkspace *wnck_workspace;
 gboolean single_workspace;
-gint workspace_num, active_workspace;
+gint workspace_num, single_workspace_num;
 
 wnck_workspace = wnck_window_get_workspace(wnck_window);
 
@@ -694,16 +698,22 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
TRUE);
 
 /* If we're in single_workspace mode we need to return the workspace that
- * it was set to, otherwise return the current workspace */
+ * it was set to, if that workspace exists, otherwise return the current
+ * workspace and turn off the single workspace mode */
 if(single_workspace) {
-active_workspace = xfconf_channel_get_int(panel->channel,
-  SINGLE_WORKSPACE_NUMBER,
-  0);
-} else {
-active_workspace = workspace_num;
+WnckScreen *wnck_screen = wnck_window_get_screen(wnck_window);
+single_workspace_num = xfconf_channel_get_int(panel->channel,
+  SINGLE_WORKSPACE_NUMBER,
+  0);
+if(single_workspace_num < 
wnck_screen_get_workspace_count(wnck_screen)) {
+return single_workspace_num;
+} else {
+
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all),
+ FALSE);
+}
 }
 
-return active_workspace;
+return workspace_num;
 }
 
 static void
@@ -1097,6 +1107,18 @@ cb_update_background_tab(WnckWindow *wnck_window,
 }
 
 static void
+cb_workspace_changed(WnckScreen *screen,
+   WnckWorkspace *workspace,
+   gpointer user_data)
+{
+AppearancePanel *panel = user_data;
+
+/* Call update background because the single workspace mode may have
+ * changed due to the addition/removal of a workspace */
+cb_update_background_tab(panel->wnck_window, user_data);
+}
+
+static void
 cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
   gpointer user_data)
 {
@@ -1153,7 +1175,7 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
 GtkWidget *appearance_container, *chk_custom_font_size,
   *spin_font_size, *w, *box, *spin_icon_size,
   *chk_show_thumbnails, *chk_single_click, *appearance_settings,
-  *bnt_exit, *chk_apply_to_all;
+  *bnt_exit;
 GtkBuilder *appearance_gxml;
 AppearancePanel *panel = g_new0(AppearancePanel, 1);
 GError *error = NULL;
@@ -1226,6 +1248,10 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  G_CALLBACK(cb_update_background_tab), panel);
 g_signal_connect(panel->wnck_window, "workspace-changed",
  G_CALLBACK(cb_update_background_tab), panel);
+g_signal_connect(wnck_screen, "workspace-created",
+ G_CALLBACK(cb_workspace_changed), panel);
+g_signal_connect(wnck_screen, "workspace-destroyed",
+ G_CALLBACK(cb_workspace_changed), panel);
 
 /* send invalid numbers so that the update_background_tab will update 
everything */
 panel->monitor = -1;
@@ -1296,14 +1322,14 @@ xfd

[Xfce4-commits] Make the image style default setting consistant

2013-03-25 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 02c53a331c02300134d66da376bcb6a85d90be63 (commit)
   from 9f81066800a9de6a2a20f5436e69fad2492564e2 (commit)

commit 02c53a331c02300134d66da376bcb6a85d90be63
Author: Eric Koegel 
Date:   Sun Mar 24 09:45:29 2013 +0300

Make the image style default setting consistant

 settings/main.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 3f00439..f33f543 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -77,8 +77,9 @@
 #define DESKTOP_ICONS_SHOW_FILESYSTEM
"/desktop-icons/file-icons/show-filesystem"
 #define DESKTOP_ICONS_SHOW_REMOVABLE 
"/desktop-icons/file-icons/show-removable"
 
-#define IMAGE_STLYE_SPANNING_SCREENS 6
 #define XFCE_BACKDROP_IMAGE_NONE 0
+#define XFCE_BACKDROP_IMAGE_SCALED   4
+#define XFCE_BACKDROP_IMAGE_SPANNING_SCREENS 6
 
 typedef struct
 {
@@ -1081,7 +1082,7 @@ cb_update_background_tab(WnckWindow *wnck_window,
  * Remove the spanning screens option before we potentially add it again
  */
 gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(panel->image_style_combo),
-  IMAGE_STLYE_SPANNING_SCREENS);
+  XFCE_BACKDROP_IMAGE_SPANNING_SCREENS);
 if(panel->monitor == 0 && gdk_screen_get_n_monitors(screen) > 1) {
 
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(panel->image_style_combo),
_("Spanning screens"));
@@ -1291,7 +1292,7 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  panel);
 
 /* Pick the first entries so something shows up */
-gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), 0);
+gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), 
XFCE_BACKDROP_IMAGE_SCALED);
 gtk_combo_box_set_active(GTK_COMBO_BOX(panel->color_style_combo), 0);
 
 /* Use these settings for all workspaces checkbox */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Remove unused code

2013-03-25 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 9ca8aea6d217d72f95287b9750d152eca734a3eb (commit)
   from be0719f7c9e686ee52dc8a9a37f27e15f18203d1 (commit)

commit 9ca8aea6d217d72f95287b9750d152eca734a3eb
Author: Eric Koegel 
Date:   Sun Mar 24 15:24:31 2013 +0300

Remove unused code

 src/xfce-backdrop.c   |   89 
 src/xfce-backdrop.h   |5 --
 src/xfdesktop-file-icon-manager.c |  116 -
 3 files changed, 0 insertions(+), 210 deletions(-)

diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 1a63426..f209c50 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -68,8 +68,6 @@ struct _XfceBackdropPriv
 XfceBackdropImageStyle image_style;
 gchar *image_path;
 
-gint brightness;
-
 gboolean cycle_backdrop;
 guint cycle_timer;
 guint cycle_timer_id;
@@ -102,52 +100,6 @@ static guint backdrop_signals[LAST_SIGNAL] = { 0, };
 /* helper functions */
 
 static GdkPixbuf *
-adjust_brightness(GdkPixbuf *src, gint amount)
-{
-GdkPixbuf *newpix;
-GdkPixdata pdata;
-gboolean has_alpha = FALSE;
-gint i, len;
-GError *err = NULL;
-
-g_return_val_if_fail(src != NULL, NULL);
-if(amount == 0)
-return src;
-
-gdk_pixdata_from_pixbuf(&pdata, src, FALSE);
-has_alpha = (pdata.pixdata_type & GDK_PIXDATA_COLOR_TYPE_RGBA);
-if(pdata.length < 1)
-len = pdata.width * pdata.height * (has_alpha?4:3);
-else
-len = pdata.length - GDK_PIXDATA_HEADER_LENGTH;
-
-for(i = 0; i < len; i++) {
-gshort scaled;
-
-if(has_alpha && (i+1)%4)
-continue;
-
-scaled = pdata.pixel_data[i] + amount;
-if(scaled > 255)
-scaled = 255;
-if(scaled < 0)
-scaled = 0;
-pdata.pixel_data[i] = scaled;
-}
-
-newpix = gdk_pixbuf_from_pixdata(&pdata, TRUE, &err);
-if(!newpix) {
-g_warning("%s: Unable to modify image brightness: %s", PACKAGE,
-err->message);
-g_error_free(err);
-return src;
-}
-g_object_unref(G_OBJECT(src));
-
-return newpix;
-}
-
-static GdkPixbuf *
 create_solid(GdkColor *color,
  gint width,
  gint height,
@@ -389,10 +341,6 @@ xfce_backdrop_set_property(GObject *object,
  g_value_get_string(value));
 break;
 
-case PROP_BRIGHTNESS:
-xfce_backdrop_set_brightness(backdrop, g_value_get_int(value));
-break;
-
 case PROP_BACKDROP_CYCLE_ENABLE:
 xfce_backdrop_set_cycle_backdrop(backdrop, 
g_value_get_boolean(value));
 break;
@@ -441,10 +389,6 @@ xfce_backdrop_get_property(GObject *object,
xfce_backdrop_get_image_filename(backdrop));
 break;
 
-case PROP_BRIGHTNESS:
-g_value_set_int(value, xfce_backdrop_get_brightness(backdrop));
-break;
-
 case PROP_BACKDROP_CYCLE_ENABLE:
 g_value_set_boolean(value, 
xfce_backdrop_get_cycle_backdrop(backdrop));
 break;
@@ -701,33 +645,6 @@ xfce_backdrop_get_image_filename(XfceBackdrop *backdrop)
 return backdrop->priv->image_path;
 }
 
-/**
- * xfce_backdrop_set_brightness:
- * @backdrop: An #XfceBackdrop.
- * @brightness: A brightness value.
- *
- * Modifies the brightness of the backdrop using a value between -128 and 127.
- * A value of 0 indicates that the brightness should not be changed.  This 
value
- * is applied to the entire image, after compositing.
- **/
-void
-xfce_backdrop_set_brightness(XfceBackdrop *backdrop, gint brightness)
-{
-g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
-
-if(brightness != backdrop->priv->brightness) {
-backdrop->priv->brightness = brightness;
-g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 
0);
-}
-}
-
-gint
-xfce_backdrop_get_brightness(XfceBackdrop *backdrop)
-{
-g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), 0);
-return backdrop->priv->brightness;
-}
-
 static gboolean
 xfce_backdrop_timer(XfceBackdrop *backdrop)
 {
@@ -878,9 +795,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
  *and if it doesn't then make the background the single colour*/
 if(!g_file_test(backdrop->priv->image_path, G_FILE_TEST_EXISTS) ||
backdrop->priv->image_style == XFCE_BACKDROP_IMAGE_NONE) {
-if(backdrop->priv->brightness != 0)
-final_image = adjust_brightness(final_image, 
backdrop->priv->brightness);
-
 return final_image;
 }
 
@@ -1006,9 +920,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
 if(image)
 g_object_unref(G_OBJECT(image));
 
-if(backdrop->priv->brightness

[Xfce4-commits] Respond to monitors-changed events

2013-03-30 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to bcd164f4e460f1cdaff1db4287a1109518f895e5 (commit)
   from 9ca8aea6d217d72f95287b9750d152eca734a3eb (commit)

commit bcd164f4e460f1cdaff1db4287a1109518f895e5
Author: Eric Koegel 
Date:   Sat Mar 30 09:03:43 2013 +0300

Respond to monitors-changed events

 settings/main.c |   23 +++
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index d10dec2..fab16f9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -1052,6 +1052,7 @@ cb_update_background_tab(WnckWindow *wnck_window,
 {
 AppearancePanel *panel = user_data;
 gint screen_num, monitor_num, workspace_num;
+gchar *monitor_name = NULL;
 WnckWorkspace *wnck_workspace = NULL;
 GdkScreen *screen;
 
@@ -1062,11 +1063,13 @@ cb_update_background_tab(WnckWindow *wnck_window,
 screen_num = gdk_screen_get_number(screen);
 monitor_num = gdk_screen_get_monitor_at_window(screen,

gtk_widget_get_window(panel->image_iconview));
+monitor_name = gdk_screen_get_monitor_plug_name(screen, monitor_num);
 
 /* Check to see if something changed */
 if(panel->workspace == workspace_num &&
panel->screen == screen_num &&
-   panel->monitor == monitor_num) {
+   panel->monitor_name != NULL &&
+   g_strcmp0(panel->monitor_name, monitor_name) == 0) {
return;
 }
 
@@ -1108,17 +,27 @@ cb_update_background_tab(WnckWindow *wnck_window,
 
 static void
 cb_workspace_changed(WnckScreen *screen,
-   WnckWorkspace *workspace,
-   gpointer user_data)
+ WnckWorkspace *workspace,
+ gpointer user_data)
 {
 AppearancePanel *panel = user_data;
 
-/* Call update background because the single workspace mode may have
+/* Update background because the single workspace mode may have
  * changed due to the addition/removal of a workspace */
 cb_update_background_tab(panel->wnck_window, user_data);
 }
 
 static void
+cb_monitor_changed(GdkScreen *gscreen,
+   gpointer user_data)
+{
+AppearancePanel *panel = user_data;
+
+/* Update background because the monitor we're on may have changed */
+cb_update_background_tab(panel->wnck_window, user_data);
+}
+
+static void
 cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
   gpointer user_data)
 {
@@ -1252,6 +1265,8 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  G_CALLBACK(cb_workspace_changed), panel);
 g_signal_connect(wnck_screen, "workspace-destroyed",
  G_CALLBACK(cb_workspace_changed), panel);
+g_signal_connect(G_OBJECT(screen), "monitors-changed",
+ G_CALLBACK(cb_monitor_changed), panel);
 
 /* send invalid numbers so that the update_background_tab will update 
everything */
 panel->monitor = -1;
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Cache wallpapers when they are loaded

2013-03-30 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 4e51013473eed4a9879267db7d48986061caddd9 (commit)
   from bcd164f4e460f1cdaff1db4287a1109518f895e5 (commit)

commit 4e51013473eed4a9879267db7d48986061caddd9
Author: Eric Koegel 
Date:   Sat Mar 30 10:08:50 2013 +0300

Cache wallpapers when they are loaded

This is to make workspace switching faster. It only cached when drawing the
wallpaper because the user may have lots of workspaces configured for 
whatever
reason and never use all of them, so this would save on the memory overhead.
This patch also improves the backdrop comparison check and simplifies the
unbinding of some settings.

 src/xfce-backdrop.c  |   65 +++---
 src/xfce-workspace.c |   52 +--
 2 files changed, 58 insertions(+), 59 deletions(-)

diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index f209c50..9122682 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -60,7 +60,9 @@ struct _XfceBackdropPriv
 {
 gint width, height;
 gint bpp;
-
+
+GdkPixbuf *pix;
+
 XfceBackdropColorStyle color_style;
 GdkColor color1;
 GdkColor color2;
@@ -179,6 +181,19 @@ create_gradient(GdkColor *color1, GdkColor *color2, gint 
width, gint height,
 return pix;
 }
 
+static void
+xfce_backdrop_clear_cached_image(XfceBackdrop *backdrop)
+{
+g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
+
+if(backdrop->priv->pix == NULL)
+return;
+
+g_object_unref(backdrop->priv->pix);
+backdrop->priv->pix = NULL;
+}
+
+
 /* gobject-related functions */
 
 
@@ -303,6 +318,8 @@ xfce_backdrop_finalize(GObject *object)
 backdrop->priv->cycle_timer_id = 0;
 }
 
+xfce_backdrop_clear_cached_image(backdrop);
+
 G_OBJECT_CLASS(xfce_backdrop_parent_class)->finalize(object);
 }
 
@@ -474,9 +491,13 @@ void
 xfce_backdrop_set_size(XfceBackdrop *backdrop, gint width, gint height)
 {
 g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
-
-backdrop->priv->width = width;
-backdrop->priv->height = height;
+
+if(backdrop->priv->width != width ||
+   backdrop->priv->height != height) {
+xfce_backdrop_clear_cached_image(backdrop);
+backdrop->priv->width = width;
+backdrop->priv->height = height;
+}
 }
 
 /**
@@ -494,6 +515,7 @@ xfce_backdrop_set_color_style(XfceBackdrop *backdrop,
 g_return_if_fail((int)style >= 0 && style <= 
XFCE_BACKDROP_COLOR_TRANSPARENT);
 
 if(style != backdrop->priv->color_style) {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->color_style = style;
 g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 
0);
 }
@@ -528,6 +550,7 @@ xfce_backdrop_set_first_color(XfceBackdrop *backdrop,
 || color->green != backdrop->priv->color1.green
 || color->blue != backdrop->priv->color1.blue)
 {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->color1.red = color->red;
 backdrop->priv->color1.green = color->green;
 backdrop->priv->color1.blue = color->blue;
@@ -564,6 +587,7 @@ xfce_backdrop_set_second_color(XfceBackdrop *backdrop,
 || color->green != backdrop->priv->color2.green
 || color->blue != backdrop->priv->color2.blue)
 {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->color2.red = color->red;
 backdrop->priv->color2.green = color->green;
 backdrop->priv->color2.blue = color->blue;
@@ -599,6 +623,7 @@ xfce_backdrop_set_image_style(XfceBackdrop *backdrop,
 g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
 
 if(style != backdrop->priv->image_style) {
+xfce_backdrop_clear_cached_image(backdrop);
 backdrop->priv->image_style = style;
 g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 
0);
 }
@@ -634,7 +659,9 @@ xfce_backdrop_set_image_filename(XfceBackdrop *backdrop, 
const gchar *filename)
 backdrop->priv->image_path = g_strdup(filename);
 else
 backdrop->priv->image_path = NULL;
-
+
+xfce_backdrop_clear_cached_image(backdrop);
+
 g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 0);
 }
 
@@ -763,9 +790,16 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
 gint dx, dy, xo, yo;
 gdouble xscale, yscale;
 GdkInterpType interp;
-
+
+TRACE("entering");
+
 g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), NULL);
-
+
+if(backdrop->priv->pix != NULL) {
+DBG("pixbuf cached");
+return g_object_ref(backdrop->priv->pix);
+}
+
 if(backdrop->priv->im

[Xfce4-commits] Use an async message queue to load preview images

2013-03-30 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 4d154b0614252950576b4ec49f067102f729c796 (commit)
   from 4e51013473eed4a9879267db7d48986061caddd9 (commit)

commit 4d154b0614252950576b4ec49f067102f729c796
Author: Eric Koegel 
Date:   Sat Mar 30 13:37:15 2013 +0300

Use an async message queue to load preview images

This patch uses the g_async_queue for message passing between the
main thread and the preview thread of the settings app. Doing this
gets rid of the idle timeout callback and a seperate thread loading
function. It also makes it easy to pop any pending previews when
the app changes what the icon view should display.

 settings/main.c |  173 +++
 1 files changed, 60 insertions(+), 113 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index fab16f9..d04904f 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -84,7 +84,7 @@
 typedef struct
 {
 GtkTreeModel *model;
-GSList *iters;
+GtkTreeIter *iter;
 } PreviewData;
 
 typedef struct
@@ -115,12 +115,10 @@ typedef struct
 GtkWidget *random_backdrop_order_chkbox;
 
 GThread *preview_thread;
-PreviewData *pdata;
+GAsyncQueue *preview_queue;
 
 XfdesktopThumbnailer *thumbnailer;
 
-gint request_timer_id;
-
 } AppearancePanel;
 
 enum
@@ -210,87 +208,62 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 }
 }
 
-static gpointer
-xfdesktop_settings_create_some_previews(gpointer data)
+static void
+xfdesktop_settings_free_pdata(gpointer data)
 {
 PreviewData *pdata = data;
-GSList *l;
-
-GDK_THREADS_ENTER ();
-
-for(l = pdata->iters; l && l->data != NULL; l = l->next)
-xfdesktop_settings_do_single_preview(pdata->model, l->data);
-
 g_object_unref(G_OBJECT(pdata->model));
-g_slist_foreach(pdata->iters, (GFunc)gtk_tree_iter_free, NULL);
-g_slist_free(pdata->iters);
+gtk_tree_iter_free(pdata->iter);
 g_free(pdata);
-
-GDK_THREADS_LEAVE ();
-
-return NULL;
 }
 
 static gpointer
-xfdesktop_settings_create_all_previews(gpointer data)
+xfdesktop_settings_create_previews(gpointer data)
 {
-GtkTreeModel *model = data;
-GtkTreeView *tree_view;
-GtkTreeIter iter;
-
-GDK_THREADS_ENTER ();
+AppearancePanel *panel = data;
+PreviewData *pdata = NULL;
 
-if(gtk_tree_model_get_iter_first(model, &iter)) {
-do {
-xfdesktop_settings_do_single_preview(model, &iter);
-} while(gtk_tree_model_iter_next(model, &iter));
-}
+while(panel->preview_queue != NULL) {
+pdata = g_async_queue_pop(panel->preview_queue);
 
-/* if possible, scroll to the selected image */
-tree_view = g_object_get_data(G_OBJECT(model), "xfdesktop-tree-view");
-if(tree_view) {
-GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
+GDK_THREADS_ENTER ();
 
-if(gtk_tree_selection_get_mode(selection) != GTK_SELECTION_MULTIPLE
-   && gtk_tree_selection_get_selected(selection, NULL, &iter))
-{
-GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
-gtk_tree_view_scroll_to_cell(tree_view, path, NULL, TRUE, 0.0, 
0.0);
-}
-}
-g_object_set_data(G_OBJECT(model), "xfdesktop-tree-view", NULL);
+xfdesktop_settings_do_single_preview(pdata->model, pdata->iter);
 
-GDK_THREADS_LEAVE ();
+xfdesktop_settings_free_pdata(pdata);
 
-g_object_unref(G_OBJECT(model));
+GDK_THREADS_LEAVE ();
+}
 
 return NULL;
 }
 
 static void
-cb_request_timer(gpointer data)
+xfdesktop_settings_add_file_to_queue(AppearancePanel *panel, PreviewData 
*pdata)
 {
-AppearancePanel *panel = data;
-PreviewData *pdata = panel->pdata;
-
 TRACE("entering");
 
-if(pdata == NULL)
-return;
+g_return_if_fail(panel != NULL);
+g_return_if_fail(pdata != NULL);
 
-panel->pdata = NULL;
-g_source_remove(panel->request_timer_id);
-panel->request_timer_id = 0;
+if(panel->preview_queue == NULL) {
+panel->preview_queue = 
g_async_queue_new_full(xfdesktop_settings_free_pdata);
+}
 
-if(!g_thread_try_new("xfdesktop_settings_create_some_previews",
- xfdesktop_settings_create_some_previews,
- pdata, NULL))
-{
-g_critical("Unable to create thread for image previews.");
-g_object_unref(G_OBJECT(pdata->model));
-g_slist_foreach(pdata->iters, (GFunc)gtk_tree_iter_free, NULL);
-g_slist_free(pdata->iters);
-g_free(pdata);
+g_async_queue_push(panel->preview_queue, pdata);
+
+if(panel->preview_thread == NULL) {
+panel->preview_thread = 
g_thread_try_new("xfdesktop_settings_create_previews"

[Xfce4-commits] xfdesktop-settings is more responsive

2013-04-06 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 3ea195b2ac3223a4c2de1e7eeb30b3461eb4994e (commit)
   from 4d154b0614252950576b4ec49f067102f729c796 (commit)

commit 3ea195b2ac3223a4c2de1e7eeb30b3461eb4994e
Author: Eric Koegel 
Date:   Sat Apr 6 15:45:38 2013 +0300

xfdesktop-settings is more responsive

Changed to using g_file_enumerate_children_async and enumerating
each file individually in an idle callback function to keep things
responsive while loading large directories of images. This is also
cancellable so that when the user moves the window to a different
monitor or workspace it will respond faster.

 settings/main.c |  268 ---
 1 files changed, 176 insertions(+), 92 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index d04904f..0f7f8d9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -119,15 +119,29 @@ typedef struct
 
 XfdesktopThumbnailer *thumbnailer;
 
+GFile *selected_file;
+GCancellable *cancel_enumeration;
+guint add_dir_idle_id;
+
 } AppearancePanel;
 
+typedef struct
+{
+GFileEnumerator *file_enumerator;
+GtkListStore *ls;
+GtkTreeIter *selected_iter;
+gchar *last_image;
+gchar *file_path;
+gchar *cur_image_file;
+AppearancePanel *panel;
+} AddDirData;
+
 enum
 {
 COL_PIX = 0,
 COL_NAME,
 COL_FILENAME,
 COL_THUMBNAIL,
-COL_COLLATE_KEY,
 N_COLS,
 };
 
@@ -142,10 +156,10 @@ enum
 
 static void cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
   gpointer user_data);
+static gchar 
*xfdesktop_settings_generate_per_workspace_binding_string(AppearancePanel 
*panel,
+   const 
gchar* property);
 
 
-/* assumes gdk lock is held on function enter, and should be held
- * on function exit */
 static void
 xfdesktop_settings_do_single_preview(GtkTreeModel *model,
  GtkTreeIter *iter)
@@ -153,11 +167,13 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 gchar *name = NULL, *new_name = NULL, *filename = NULL, *thumbnail = NULL;
 GdkPixbuf *pix, *pix_scaled = NULL;
 
+GDK_THREADS_ENTER ();
 gtk_tree_model_get(model, iter,
COL_NAME, &name,
COL_FILENAME, &filename,
COL_THUMBNAIL, &thumbnail,
-1);
+GDK_THREADS_LEAVE ();
 
 if(thumbnail == NULL) {
 pix = gdk_pixbuf_new_from_file(filename, NULL);
@@ -194,16 +210,20 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 g_free(name);
 
 if(new_name) {
+GDK_THREADS_ENTER ();
 gtk_list_store_set(GTK_LIST_STORE(model), iter,
COL_NAME, new_name,
-1);
+GDK_THREADS_LEAVE ();
 g_free(new_name);
 }
 
 if(pix_scaled) {
+GDK_THREADS_ENTER ();
 gtk_list_store_set(GTK_LIST_STORE(model), iter,
COL_PIX, pix_scaled,
-1);
+GDK_THREADS_LEAVE ();
 g_object_unref(G_OBJECT(pix_scaled));
 }
 }
@@ -224,15 +244,12 @@ xfdesktop_settings_create_previews(gpointer data)
 PreviewData *pdata = NULL;
 
 while(panel->preview_queue != NULL) {
+/* Block and wait for another preview to create */
 pdata = g_async_queue_pop(panel->preview_queue);
 
-GDK_THREADS_ENTER ();
-
 xfdesktop_settings_do_single_preview(pdata->model, pdata->iter);
 
 xfdesktop_settings_free_pdata(pdata);
-
-GDK_THREADS_LEAVE ();
 }
 
 return NULL;
@@ -246,12 +263,14 @@ xfdesktop_settings_add_file_to_queue(AppearancePanel 
*panel, PreviewData *pdata)
 g_return_if_fail(panel != NULL);
 g_return_if_fail(pdata != NULL);
 
+/* Create the queue if it doesn't exist */
 if(panel->preview_queue == NULL) {
 panel->preview_queue = 
g_async_queue_new_full(xfdesktop_settings_free_pdata);
 }
 
 g_async_queue_push(panel->preview_queue, pdata);
 
+/* Create the thread if it doesn't exist */
 if(panel->preview_thread == NULL) {
 panel->preview_thread = 
g_thread_try_new("xfdesktop_settings_create_previews",
  
xfdesktop_settings_create_previews,
@@ -259,10 +278,10 @@ xfdesktop_settings_add_file_to_queue(AppearancePanel 
*panel, PreviewData *pdata)
 if(panel->preview_thread == NULL)
 {
 g_critical("Unable to create thread for image previews.");
+/* Don't block but try to remove the data from the queue
+ * since we won't be creating previews */
 if(g_async_queue_try_pop(panel->preview_queue))
 xfdesktop_settings_

[Xfce4-commits] Select wallpaper on loading

2013-04-07 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 8385169faa534301b7131d842c062bb9971e5f67 (commit)
   from 3ea195b2ac3223a4c2de1e7eeb30b3461eb4994e (commit)

commit 8385169faa534301b7131d842c062bb9971e5f67
Author: Eric Koegel 
Date:   Sun Apr 7 11:11:13 2013 +0300

Select wallpaper on loading

Increases the icon view item padding size so the selected item stands out 
better.
cb_folder_selection_change is manually called because GTK introduced a bug 
where
changing the gtk file chooser folder in code no longer emits the correct 
signal.

 settings/main.c |   22 --
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 0f7f8d9..8debcb9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -132,7 +132,6 @@ typedef struct
 GtkTreeIter *selected_iter;
 gchar *last_image;
 gchar *file_path;
-gchar *cur_image_file;
 AppearancePanel *panel;
 } AddDirData;
 
@@ -527,13 +526,12 @@ xfdesktop_image_list_add_item(gpointer user_data)
 AddDirData *dir_data = user_data;
 AppearancePanel *panel = dir_data->panel;
 GFileInfo *info;
-GtkTreeIter *iter, *selected_iter = NULL;
+GtkTreeIter *iter;
 GtkTreePath *path;
 
 /* If the enumeration gets canceled/destroyed we need to clean up */
 if(!G_IS_FILE_ENUMERATOR(dir_data->file_enumerator)) {
 g_free(dir_data->file_path);
-g_free(dir_data->cur_image_file);
 g_free(dir_data->last_image);
 g_free(dir_data);
 
@@ -549,8 +547,7 @@ xfdesktop_image_list_add_item(gpointer user_data)
 
 iter = 
xfdesktop_settings_image_iconview_add(GTK_TREE_MODEL(dir_data->ls), buf, panel);
 if(iter) {
-if(dir_data->cur_image_file &&
-   !dir_data->selected_iter &&
+if(!dir_data->selected_iter &&
!strcmp(buf, dir_data->last_image))
 {
 dir_data->selected_iter = iter;
@@ -572,8 +569,8 @@ xfdesktop_image_list_add_item(gpointer user_data)
 GTK_TREE_MODEL(dir_data->ls));
 
 /* last_image is in the directory added then it should be selected */
-if(selected_iter) {
-path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_data->ls), 
selected_iter);
+if(dir_data->selected_iter) {
+path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_data->ls), 
dir_data->selected_iter);
 if(path) {
 gtk_icon_view_select_path(GTK_ICON_VIEW(panel->image_iconview), 
path);
 gtk_tree_iter_free(dir_data->selected_iter);
@@ -581,7 +578,6 @@ xfdesktop_image_list_add_item(gpointer user_data)
  }
 
 g_free(dir_data->file_path);
-g_free(dir_data->cur_image_file);
 g_free(dir_data->last_image);
 g_object_unref(dir_data->file_enumerator);
 g_free(dir_data);
@@ -617,7 +613,6 @@ xfdesktop_image_list_add_dir(GObject *source_object,
 dir_data->last_image = xfconf_channel_get_string(panel->channel, property, 
DEFAULT_BACKDROP);
 
 dir_data->file_path = g_file_get_path(panel->selected_file);
-dir_data->cur_image_file = g_file_get_parse_name(panel->selected_file);
 
 dir_data->file_enumerator = 
g_file_enumerate_children_finish(panel->selected_file,
  res,
@@ -965,14 +960,14 @@ xfdesktop_settings_update_iconview_folder(AppearancePanel 
*panel)
 
 prop_last = 
xfdesktop_settings_generate_per_workspace_binding_string(panel, "last-image");
 
-current_folder = xfconf_channel_get_string(panel->channel, prop_last, 
NULL);
-
-if(current_folder == NULL)
-current_folder = g_strdup(DEFAULT_BACKDROP);
+current_folder = xfconf_channel_get_string(panel->channel, prop_last, 
DEFAULT_BACKDROP);
 
 gtk_file_chooser_set_current_folder((GtkFileChooser*)panel->btn_folder,
   g_path_get_dirname(current_folder));
 
+/* Workaround for a bug in GTK */
+cb_folder_selection_changed(panel->btn_folder, panel);
+
 g_free(current_folder);
 g_free(prop_last);
 }
@@ -1197,7 +1192,6 @@ xfdesktop_settings_setup_image_iconview(AppearancePanel 
*panel)
 "tooltip-column", COL_NAME,
 "selection-mode", GTK_SELECTION_BROWSE,
 "column-spacing", 2,
-"item-padding", 2,
 "margin", 2,
 NULL);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Update icon view frame name based on monitor count

2013-04-12 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 6d78e6bc921b4a4b408af0e6c94aaf682ea3c5fd (commit)
   from 8385169faa534301b7131d842c062bb9971e5f67 (commit)

commit 6d78e6bc921b4a4b408af0e6c94aaf682ea3c5fd
Author: Eric Koegel 
Date:   Mon Apr 8 18:54:51 2013 +0300

Update icon view frame name based on monitor count

 settings/main.c |   45 +
 1 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 8debcb9..7c167ab 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -637,14 +637,37 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
 
 workspace_name = g_strdup(wnck_workspace_get_name(wnck_workspace));
 
-if(panel->monitor_name) {
-g_snprintf(buf, sizeof(buf),
-   _("Wallpaper for %s on Monitor %d (%s)"),
-   workspace_name, panel->monitor, panel->monitor_name);
-} else
-g_snprintf(buf, sizeof(buf),
-   _("Wallpaper for %s on Monitor %d"),
-   workspace_name, panel->monitor);
+
if(gdk_screen_get_n_monitors(gtk_widget_get_screen(panel->chk_apply_to_all)) > 
1) {
+
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all))) {
+/* Multi-monitor single workspace */
+if(panel->monitor_name) {
+g_snprintf(buf, sizeof(buf),
+   _("Wallpaper for Monitor %d (%s)"),
+   panel->monitor, panel->monitor_name);
+} else {
+g_snprintf(buf, sizeof(buf), _("Wallpaper for Monitor %d"), 
panel->monitor);
+}
+} else {
+/* Multi-monitor per workspace wallpaper */
+if(panel->monitor_name) {
+g_snprintf(buf, sizeof(buf),
+   _("Wallpaper for %s on Monitor %d (%s)"),
+   workspace_name, panel->monitor, 
panel->monitor_name);
+} else {
+g_snprintf(buf, sizeof(buf),
+   _("Wallpaper for %s on Monitor %d"),
+   workspace_name, panel->monitor);
+}
+}
+} else {
+
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel->chk_apply_to_all))) {
+/* Single monitor and single workspace */
+g_snprintf(buf, sizeof(buf), _("Wallpaper for my desktop"));
+} else {
+/* Single monitor and per workspace wallpaper */
+g_snprintf(buf, sizeof(buf), _("Wallpaper for %s"), 
workspace_name);
+}
+}
 
 gtk_frame_set_label(GTK_FRAME(panel->frame_image_list), buf);
 
@@ -1153,6 +1176,9 @@ cb_monitor_changed(GdkScreen *gscreen,
 
 /* Update background because the monitor we're on may have changed */
 cb_update_background_tab(panel->wnck_window, user_data);
+
+/* Update the frame name because we may change from/to a single monitor */
+xfdesktop_settings_update_iconview_frame_name(panel, 
wnck_window_get_workspace(panel->wnck_window));
 }
 
 static void
@@ -1176,6 +1202,9 @@ cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button,
 } else {
 cb_update_background_tab(panel->wnck_window, panel);
 }
+
+/* update the frame name to since we changed to/from single workspace mode 
*/
+xfdesktop_settings_update_iconview_frame_name(panel, 
wnck_window_get_workspace(panel->wnck_window));
 }
 
 static void
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change lable to read: Apply to all workspaces

2013-04-12 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 8b8cdbe39e3218eb59135681aae0f816849099f6 (commit)
   from 6d78e6bc921b4a4b408af0e6c94aaf682ea3c5fd (commit)

commit 8b8cdbe39e3218eb59135681aae0f816849099f6
Author: Eric Koegel 
Date:   Fri Apr 12 09:09:49 2013 +0300

Change lable to read: Apply to all workspaces

 .../xfdesktop-settings-appearance-frame-ui.glade   |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index b928932..d838190 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -221,7 +221,7 @@
 True
 True
 GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-_Use these settings 
for all workspaces
+Apply to all 
_workspaces
 True
 True
   
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Align folder and color style combo boxes

2013-04-12 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 9587dfd4a006c121ceceb068b969093956b24fc0 (commit)
   from 8b8cdbe39e3218eb59135681aae0f816849099f6 (commit)

commit 9587dfd4a006c121ceceb068b969093956b24fc0
Author: Eric Koegel 
Date:   Fri Apr 12 10:53:53 2013 +0300

Align folder and color style combo boxes

Packed the folder, color, and image styles into a GtkTable to
align things better. Also removed some unneeded Gtk containers
from the glade file and labeled the id's to be more descriptive.

 .../xfdesktop-settings-appearance-frame-ui.glade   |  503 +++-
 1 files changed, 269 insertions(+), 234 deletions(-)

diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index d838190..8f40ae8 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -34,261 +34,296 @@
 12
 6
 
-  
+  
 True
-6
+0
+GTK_SHADOW_NONE
 
-  
+  
 True
-12
+6
 
-  
+  
 True
-0
-GTK_SHADOW_NONE
+6
 
-  
+  
 True
-6
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+GTK_POLICY_AUTOMATIC
+GTK_POLICY_AUTOMATIC
+GTK_SHADOW_ETCHED_IN
 
-  
+  
 True
-6
-
-  
-True
-True
-GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-GTK_POLICY_AUTOMATIC
-GTK_POLICY_AUTOMATIC
-GTK_SHADOW_ETCHED_IN
-
-  
-True
-True
-GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-  
-
-  
-
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+  
+
+  
+  
+True
+0
+  
+
+
+  
+True
+8
+2
+6
+
+  
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+Folder:
+True
+  
+  
+0
+1
+0
+1
+GTK_SHRINK
+GTK_SHRINK
+  
+
+
+  
+True
+True
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+Add 
an image to the list
+GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+  
+  
+1
+2
+0
+1
+GTK_FILL|GTK_EXPAND
+GTK_SHRINK
+  
+
+
+  
+True
+  
+  
+4
+5
+0
+1
+GTK_FILL|GTK_EXPAND
+GTK_SHRINK
+  
+
+
+  
+True
+GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
+St_yle:
+True
+combo_

[Xfce4-commits] Change wallpaper iconview spacing and max width

2013-04-12 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 520f3055a62a5c125be42127bd81a6bf705d760c (commit)
   from 9587dfd4a006c121ceceb068b969093956b24fc0 (commit)

commit 520f3055a62a5c125be42127bd81a6bf705d760c
Author: Eric Koegel 
Date:   Fri Apr 12 11:08:51 2013 +0300

Change wallpaper iconview spacing and max width

Changed the max aspect ratio of the xfdesktop-settings iconview
so it would pack the images better. Removed some of the row and
column spacing and increased the item-padding so that the selected
item stands out better.

 settings/main.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 7c167ab..1e0df52 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -55,7 +55,7 @@
 #include "xfdesktop-settings-appearance-frame-ui.h"
 
 #define PREVIEW_HEIGHT  96
-#define MAX_ASPECT_RATIO 2.0f
+#define MAX_ASPECT_RATIO 1.5f
 
 #define SHOW_DESKTOP_MENU_PROP   "/desktop-menu/show"
 #define DESKTOP_MENU_SHOW_ICONS_PROP "/desktop-menu/show-icons"
@@ -1220,7 +1220,9 @@ xfdesktop_settings_setup_image_iconview(AppearancePanel 
*panel)
 "pixbuf-column", COL_PIX,
 "tooltip-column", COL_NAME,
 "selection-mode", GTK_SELECTION_BROWSE,
-"column-spacing", 2,
+"column-spacing", 1,
+"row-spacing", 1,
+"item-padding", 10,
 "margin", 2,
 NULL);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change tooltips in xfdesktop-settings

2013-04-12 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to b651fd1ebc1b4a93bb46c8dc265849a73155fe20 (commit)
   from 520f3055a62a5c125be42127bd81a6bf705d760c (commit)

commit b651fd1ebc1b4a93bb46c8dc265849a73155fe20
Author: Eric Koegel 
Date:   Fri Apr 12 14:10:56 2013 +0300

Change tooltips in xfdesktop-settings

Since the tooltips were reporting the image size of the thumbnails
and parsing the original file just to get the image dimensions is
slow, this patch changes it to pull the content type and file size
to populate the tooltip with. Also fixed how tooltips in the icon
view popped up so that it follows the mouse when it is sensitive.

 settings/main.c |   62 ++
 1 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 1e0df52..2365c90 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -163,12 +163,11 @@ static void
 xfdesktop_settings_do_single_preview(GtkTreeModel *model,
  GtkTreeIter *iter)
 {
-gchar *name = NULL, *new_name = NULL, *filename = NULL, *thumbnail = NULL;
+gchar *filename = NULL, *thumbnail = NULL;
 GdkPixbuf *pix, *pix_scaled = NULL;
 
 GDK_THREADS_ENTER ();
 gtk_tree_model_get(model, iter,
-   COL_NAME, &name,
COL_FILENAME, &filename,
COL_THUMBNAIL, &thumbnail,
-1);
@@ -188,10 +187,6 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 
 width = gdk_pixbuf_get_width(pix);
 height = gdk_pixbuf_get_height(pix);
-/* no need to escape markup; it's already done for us */
-new_name = g_strdup_printf(_("%s\nSize: %dx%d"),
-   name, width, height);
-
 aspect = (gdouble)width / height;
 
 /* Keep the aspect ratio sensible otherwise the treeview looks bad */
@@ -206,16 +201,6 @@ xfdesktop_settings_do_single_preview(GtkTreeModel *model,
 
 g_object_unref(G_OBJECT(pix));
 }
-g_free(name);
-
-if(new_name) {
-GDK_THREADS_ENTER ();
-gtk_list_store_set(GTK_LIST_STORE(model), iter,
-   COL_NAME, new_name,
-   -1);
-GDK_THREADS_LEAVE ();
-g_free(new_name);
-}
 
 if(pix_scaled) {
 GDK_THREADS_ENTER ();
@@ -469,12 +454,15 @@ image_list_compare(GtkTreeModel *model,
 static GtkTreeIter *
 xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
   const char *path,
+  GFileInfo *info,
   AppearancePanel *panel)
 {
 gboolean added = FALSE, found = FALSE, valid = FALSE;
 GtkTreeIter iter, search_iter;
-gchar *name = NULL, *name_utf8 = NULL, *name_markup = NULL;
+gchar *name = NULL, *name_utf8 = NULL, *name_markup = NULL, *size_string = 
NULL;
 gint position = 0;
+const gchar *content_type = g_file_info_get_content_type(info);
+goffset file_size = g_file_info_get_size(info);
 
 if(!xfdesktop_image_file_is_valid(path))
 return NULL;
@@ -484,8 +472,15 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 name_utf8 = g_filename_to_utf8(name, strlen(name),
NULL, NULL, NULL);
 if(name_utf8) {
-name_markup = g_markup_printf_escaped("%s",
-  name_utf8);
+#if GLIB_CHECK_VERSION (2, 30, 0)
+size_string = g_format_size(file_size);
+#else
+size_string = g_format_size_for_display(file_size);
+#endif
+
+/* Display the file name, file type, and file size in the tooltip. 
*/
+name_markup = g_markup_printf_escaped(_("%s\nType: 
%s\nSize: %s"),
+  name_utf8, content_type, 
size_string);
 
 /* Insert sorted */
 valid = gtk_tree_model_get_iter_first(model, &search_iter);
@@ -513,6 +508,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 g_free(name);
 g_free(name_utf8);
 g_free(name_markup);
+g_free(size_string);
 
 if(added)
 return gtk_tree_iter_copy(&iter);
@@ -545,7 +541,7 @@ xfdesktop_image_list_add_item(gpointer user_data)
 const gchar *file_name = g_file_info_get_name(info);
 gchar *buf = g_strconcat(dir_data->file_path, "/", file_name, NULL);
 
-iter = 
xfdesktop_settings_image_iconview_add(GTK_TREE_MODEL(dir_data->ls), buf, panel);
+iter = 
xfdesktop_settings_image_iconview_add(GTK_TREE_MODEL(dir_data->ls), buf, info, 
panel);
 if(iter) {
 if(!dir_data->selected_iter &&
!strcmp(buf, dir_data->last_image))
@@ -920,7 +916,7 @@ cb_folder

[Xfce4-commits] Support xfdesktop-settings as a pinned window

2013-04-12 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 066b3f13732fe54d2cf54cc031664a7b023235e0 (commit)
   from b651fd1ebc1b4a93bb46c8dc265849a73155fe20 (commit)

commit 066b3f13732fe54d2cf54cc031664a7b023235e0
Author: Eric Koegel 
Date:   Fri Apr 12 14:50:36 2013 +0300

Support xfdesktop-settings as a pinned window

 settings/main.c |   18 --
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 2365c90..5fdd184 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -535,6 +535,8 @@ xfdesktop_image_list_add_item(gpointer user_data)
 g_object_unref(panel->cancel_enumeration);
 panel->cancel_enumeration = NULL;
 }
+
+return FALSE;
 }
 
 if((info = g_file_enumerator_next_file(dir_data->file_enumerator, NULL, 
NULL))) {
@@ -631,6 +633,11 @@ 
xfdesktop_settings_update_iconview_frame_name(AppearancePanel *panel,
 if(panel->monitor < 0 && panel->workspace < 0)
 return;
 
+if(wnck_workspace == NULL) {
+WnckScreen *wnck_screen = wnck_window_get_screen(panel->wnck_window);
+wnck_workspace = wnck_screen_get_active_workspace(wnck_screen);
+}
+
 workspace_name = g_strdup(wnck_workspace_get_name(wnck_workspace));
 
 
if(gdk_screen_get_n_monitors(gtk_widget_get_screen(panel->chk_apply_to_all)) > 
1) {
@@ -750,10 +757,16 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
 WnckWorkspace *wnck_workspace;
 gboolean single_workspace;
 gint workspace_num, single_workspace_num;
+WnckScreen *wnck_screen = wnck_window_get_screen(wnck_window);
 
 wnck_workspace = wnck_window_get_workspace(wnck_window);
 
-workspace_num = wnck_workspace_get_number(wnck_workspace);
+if(wnck_workspace != NULL) {
+workspace_num = wnck_workspace_get_number(wnck_workspace);
+} else {
+workspace_num = 
wnck_workspace_get_number(wnck_screen_get_active_workspace(wnck_screen));
+}
+
 
 single_workspace = xfconf_channel_get_bool(panel->channel,
SINGLE_WORKSPACE_MODE,
@@ -763,7 +776,6 @@ xfdesktop_settings_get_active_workspace(AppearancePanel 
*panel,
  * it was set to, if that workspace exists, otherwise return the current
  * workspace and turn off the single workspace mode */
 if(single_workspace) {
-WnckScreen *wnck_screen = wnck_window_get_screen(wnck_window);
 single_workspace_num = xfconf_channel_get_int(panel->channel,
   SINGLE_WORKSPACE_NUMBER,
   0);
@@ -1335,6 +1347,8 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder 
*main_gxml,
  G_CALLBACK(cb_workspace_changed), panel);
 g_signal_connect(wnck_screen, "workspace-destroyed",
  G_CALLBACK(cb_workspace_changed), panel);
+g_signal_connect(wnck_screen, "active-workspace-changed",
+G_CALLBACK(cb_workspace_changed), panel);
 g_signal_connect(G_OBJECT(screen), "monitors-changed",
  G_CALLBACK(cb_monitor_changed), panel);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Decide on move/copy action before items have been dropped

2013-04-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 63df50d249bba0522b5bd2f0c23748ae38e9026b (commit)
   from b06e5bb6260b3ceb45e4266a6e47c49c73cc8aee (commit)

commit 63df50d249bba0522b5bd2f0c23748ae38e9026b
Author: Dennis Tomas 
Date:   Sun Apr 14 07:38:09 2013 +0300

Decide on move/copy action before items have been dropped

When files have been dropped as uri-list, the callback
function xfdesktop_file_icon_manager_drag_data_received()
decides whether they should be copied or moved depending on
their location, ignoring the selected drag action.

The comment preceding the code in charge reads:

/* If the user didn't pick whether to copy or move via
 * a GDK_ACTION_ASK then determine if we should move/copy
 * by checking if the files are on the same filesystem
 * and are writable by the user.
 */

I don't think this is the right place to make this decision,
because even if the user didn't pick the action via GDK_ACTION_ASK,
it could have been chosen using modifier keys and it has already
been indicated by the mouse cursor.

I've attached a patch where the move/copy action is proposed in the
drag-motion stage, e.g. before the items have been dropped, and can
be overridden by modifier keys.

    Signed-off-by: Eric Koegel 

 src/xfdesktop-file-icon-manager.c |  142 +---
 src/xfdesktop-icon-view-manager.c |   19 +
 src/xfdesktop-icon-view-manager.h |   12 +++
 src/xfdesktop-icon-view.c |   91 ++-
 4 files changed, 184 insertions(+), 80 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index d5e9ce3..a12c702 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -172,6 +172,12 @@ static void 
xfdesktop_file_icon_manager_drag_data_get(XfdesktopIconViewManager *
   GtkSelectionData *data,
   guint info,
   guint time_);
+static GdkDragAction 
xfdesktop_file_icon_manager_propose_drop_action(XfdesktopIconViewManager 
*manager,
+ 
XfdesktopIcon *drop_icon,
+ 
GdkDragAction action,
+ 
GdkDragContext *context,
+ 
GtkSelectionData *data,
+ guint 
info);
 
 static gboolean xfdesktop_file_icon_manager_check_create_desktop_folder(GFile 
*file);
 static void 
xfdesktop_file_icon_manager_load_desktop_folder(XfdesktopFileIconManager 
*fmanager);
@@ -419,6 +425,7 @@ 
xfdesktop_file_icon_manager_icon_view_manager_init(XfdesktopIconViewManagerIface
 iface->drag_drop = xfdesktop_file_icon_manager_drag_drop;
 iface->drag_data_received = xfdesktop_file_icon_manager_drag_data_received;
 iface->drag_data_get = xfdesktop_file_icon_manager_drag_data_get;
+iface->propose_drop_action = 
xfdesktop_file_icon_manager_propose_drop_action;
 }
 
 
@@ -3007,7 +3014,6 @@ 
xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
 gboolean copy_only = TRUE, drop_ok = FALSE;
 GList *file_list;
 GdkDragAction action;
-gboolean user_selected_action = FALSE;
 
 TRACE("entering");
 
@@ -3020,8 +3026,6 @@ 
xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
 gtk_drag_finish(context, FALSE, FALSE, time_);
 return;
 }
-/* The user picked whether to move or copy the files */
-user_selected_action = TRUE;
 }
 
 if(info == TARGET_XDND_DIRECT_SAVE0) {
@@ -3133,47 +3137,6 @@ 
xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
 base_dest_file = g_object_ref(fmanager->priv->folder);
 }
 
-/* If the user didn't pick whether to copy or move via
- * a GDK_ACTION_ASK then determine if we should move/copy
- * by checking if the files are on the same filesystem
- * and are writable by the user.
- */
-if(user_selected_action == FALSE) {
-GFileInfo *src_info, *dest_info;
-const gchar *src_name, *dest_name;
-
-dest_info = g_file_query_info(base_dest_file,
-  
XFDESKTOP_FILE_INFO_NAMESPACE,
-  G_FILE_QUERY_INFO_NONE,
-  NULL,
-  NULL);
- 

[Xfce4-commits] Remove unneeded warning messages

2013-04-13 Thread Eric Koegel
Updating branch refs/heads/master
 to 3884058acfdc5e29a2a660a4c2a5ee3689f4e606 (commit)
   from 63df50d249bba0522b5bd2f0c23748ae38e9026b (commit)

commit 3884058acfdc5e29a2a660a4c2a5ee3689f4e606
Author: Eric Koegel 
Date:   Sun Apr 14 08:19:45 2013 +0300

Remove unneeded warning messages

 src/xfdesktop-file-icon-manager.c |1 -
 src/xfdesktop-icon-view.c |7 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index a12c702..1f425ad 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -3195,7 +3195,6 @@ 
xfdesktop_file_icon_manager_drag_data_get(XfdesktopIconViewManager *manager,
 TRACE("entering");
 
 g_return_if_fail(drag_icons);
-g_return_if_fail(info == TARGET_TEXT_URI_LIST);
 
 file_list = xfdesktop_file_utils_file_icon_list_to_file_list(drag_icons);
 str = xfdesktop_file_utils_file_list_to_string(file_list);
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 5d5e20e..b2360cd 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -1587,8 +1587,11 @@ xfdesktop_icon_view_drag_data_get(GtkWidget *widget,
 XfdesktopIconView *icon_view = XFDESKTOP_ICON_VIEW(widget);
 
 TRACE("entering");
-
-g_return_if_fail(icon_view->priv->selected_icons);
+
+/* Sometimes during a ctrl+drag this is NULL
+ * but works when the file(s) are dropped */
+if(icon_view->priv->selected_icons == NULL)
+return;
 
 xfdesktop_icon_view_manager_drag_data_get(icon_view->priv->manager,
   icon_view->priv->selected_icons,
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Use a collation key when sorting wallpapers

2013-04-19 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to de3e0239693bbde88a32805541d5decdbef4b9b3 (commit)
   from 066b3f13732fe54d2cf54cc031664a7b023235e0 (commit)

commit de3e0239693bbde88a32805541d5decdbef4b9b3
Author: Eric Koegel 
Date:   Fri Apr 19 11:46:09 2013 +0300

Use a collation key when sorting wallpapers

 settings/main.c |   17 +
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index 5fdd184..b321a54 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -141,6 +141,7 @@ enum
 COL_NAME,
 COL_FILENAME,
 COL_THUMBNAIL,
+COL_COLLATE_KEY,
 N_COLS,
 };
 
@@ -442,7 +443,7 @@ image_list_compare(GtkTreeModel *model,
 gchar *key_b = NULL;
 gint ret;
 
-gtk_tree_model_get(model, b, COL_NAME, &key_b, -1);
+gtk_tree_model_get(model, b, COL_COLLATE_KEY, &key_b, -1);
 
 ret = g_strcmp0(a, key_b);
 
@@ -460,6 +461,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 gboolean added = FALSE, found = FALSE, valid = FALSE;
 GtkTreeIter iter, search_iter;
 gchar *name = NULL, *name_utf8 = NULL, *name_markup = NULL, *size_string = 
NULL;
+gchar *collate_key = NULL;
 gint position = 0;
 const gchar *content_type = g_file_info_get_content_type(info);
 goffset file_size = g_file_info_get_size(info);
@@ -469,7 +471,8 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 
 name = g_path_get_basename(path);
 if(name) {
-name_utf8 = g_filename_to_utf8(name, strlen(name),
+guint name_length = strlen(name);
+name_utf8 = g_filename_to_utf8(name, name_length,
NULL, NULL, NULL);
 if(name_utf8) {
 #if GLIB_CHECK_VERSION (2, 30, 0)
@@ -482,10 +485,14 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 name_markup = g_markup_printf_escaped(_("%s\nType: 
%s\nSize: %s"),
   name_utf8, content_type, 
size_string);
 
+/* create a case sensitive collation key for sorting filenames like
+ * Thunar does */
+collate_key = g_utf8_collate_key_for_filename(name, name_length);
+
 /* Insert sorted */
 valid = gtk_tree_model_get_iter_first(model, &search_iter);
 while(valid && !found) {
-if(image_list_compare(model, name_markup, &search_iter) <= 0) {
+if(image_list_compare(model, collate_key, &search_iter) <= 0) {
 found = TRUE;
 } else {
 valid = gtk_tree_model_iter_next(model, &search_iter);
@@ -498,6 +505,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
   position,
   COL_NAME, name_markup,
   COL_FILENAME, path,
+  COL_COLLATE_KEY, collate_key,
   -1);
 xfdesktop_settings_queue_preview(model, &iter, panel);
 
@@ -509,6 +517,7 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 g_free(name_utf8);
 g_free(name_markup);
 g_free(size_string);
+g_free(collate_key);
 
 if(added)
 return gtk_tree_iter_copy(&iter);
@@ -602,7 +611,7 @@ xfdesktop_image_list_add_dir(GObject *source_object,
 dir_data->panel = panel;
 
 dir_data->ls = gtk_list_store_new(N_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
-  G_TYPE_STRING, G_TYPE_STRING);
+  G_TYPE_STRING, G_TYPE_STRING, 
G_TYPE_STRING);
 
 /* Get the last image/current image displayed so we can select it in the
  * icon view */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix HTTP URL performance issue / wrong action proposed

2013-04-20 Thread Eric Koegel
Updating branch refs/heads/master
 to 7ff0477814096554ccd6c14a56c851bd1c32166b (commit)
   from c9ad3db47331b542f6a19de40b8c10238034e2ca (commit)

commit 7ff0477814096554ccd6c14a56c851bd1c32166b
Author: Dennis Tomas 
Date:   Sat Apr 20 13:21:45 2013 +0300

Fix HTTP URL performance issue / wrong action proposed

- only check "file" URLs for move/copy
- adding an optional output parameter "suggested_action" to the
icon's allowed_drop_actions()

The suggested actions are:

folder:   move if writable else none
volume:   copy if writable else none
file: copy (run) if executable else none
trash:move
    
Signed-off-by: Eric Koegel 

 src/xfdesktop-file-icon-manager.c |   32 +
 src/xfdesktop-icon-view.c |   40 +
 src/xfdesktop-icon.c  |   12 +++---
 src/xfdesktop-icon.h  |5 ++-
 src/xfdesktop-regular-file-icon.c |   23 
 src/xfdesktop-special-file-icon.c |   15 +++--
 src/xfdesktop-volume-icon.c   |   16 +++---
 7 files changed, 103 insertions(+), 40 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 1f425ad..d68ff73 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -3228,31 +3228,45 @@ 
xfdesktop_file_icon_manager_propose_drop_action(XfdesktopIconViewManager *manage
 file_icon = XFDESKTOP_FILE_ICON(drop_icon);
 tfile = xfdesktop_file_icon_peek_file(file_icon);
 tinfo = xfdesktop_file_icon_peek_file_info(file_icon);
-}
 
-if(tfile && !g_file_has_uri_scheme(tfile, "file")) {
-return action;
+/* if it's a volume, but we don't have |tinfo|, this just isn't
+ * going to work */
+if(!tinfo && XFDESKTOP_IS_VOLUME_ICON(drop_icon)) {
+return 0;
+}
+
+if(tfile && !g_file_has_uri_scheme(tfile, "file")) {
+return action;
+}
+
+if(tinfo && g_file_info_get_file_type(tinfo) != 
G_FILE_TYPE_DIRECTORY) {
+return action;
+}
 }
 
 file_list = xfdesktop_file_utils_file_list_from_string((const gchar 
*)gtk_selection_data_get_data(data));
 if(file_list) {
 GFile *base_dest_file = NULL;
-gboolean dest_is_volume = (drop_icon
-   && XFDESKTOP_IS_VOLUME_ICON(drop_icon));
 
-/* if it's a volume, but we don't have |tinfo|, this just isn't
- * going to work */
-if(!tinfo && dest_is_volume) {
+/* source must be local file */
+if(!g_file_has_uri_scheme(file_list->data, "file")) {
 xfdesktop_file_utils_file_list_free(file_list);
 return action;
 }
 
-if(tinfo && g_file_info_get_file_type(tinfo) == 
G_FILE_TYPE_DIRECTORY) {
+if(tinfo) {
 base_dest_file = g_object_ref(tfile);
 } else {
 base_dest_file = g_object_ref(fmanager->priv->folder);
 }
 
+/* dropping on ourselves? */
+if(g_strcmp0(g_file_get_uri(file_list->data), 
g_file_get_uri(base_dest_file)) == 0) {
+g_object_unref(base_dest_file);
+xfdesktop_file_utils_file_list_free(file_list);
+return 0;
+}
+
 /* Determine if we should move/copy by checking if the files
  * are on the same filesystem and are writable by the user.
  */
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index b2360cd..cf03485 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -1387,7 +1387,7 @@ xfdesktop_icon_view_drag_motion(GtkWidget *widget,
 icon_on_dest = xfdesktop_icon_view_icon_in_cell(icon_view, hover_row,
 hover_col);
 if(icon_on_dest) {
-if(!xfdesktop_icon_get_allowed_drop_actions(icon_on_dest))
+if(!xfdesktop_icon_get_allowed_drop_actions(icon_on_dest, NULL))
 return FALSE;
 } else if(!xfdesktop_grid_is_free_position(icon_view, hover_row, 
hover_col))
 return FALSE;
@@ -1407,7 +1407,7 @@ xfdesktop_icon_view_drag_motion(GtkWidget *widget,
 else  /* #3 */
 our_action = gdk_drag_context_get_suggested_action(context);
 } else {
-/* start with all available actions */
+/* start with all available actions (may be filtered by modifier keys) 
*/
 GdkDragAction allowed_actions = context->actions;
 
 if(is_local_drag) {  /* #2 */
@@ -1426,18 +1426,30 @@ xfdesktop_icon_view_

[Xfce4-commits] Fix memory leaks

2013-04-27 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 13fd293590da7934f61bf59129080ec535b5b9d8 (commit)
   from de3e0239693bbde88a32805541d5decdbef4b9b3 (commit)

commit 13fd293590da7934f61bf59129080ec535b5b9d8
Author: Eric Koegel 
Date:   Sat Apr 27 15:41:02 2013 +0300

Fix memory leaks

Use the destroy notify callback when adding items to remove duplicated
code. Also found and fixed a couple memory leaks.

 settings/main.c|   94 ++--
 src/xfce-desktop.c |   16 +
 2 files changed, 63 insertions(+), 47 deletions(-)

diff --git a/settings/main.c b/settings/main.c
index b321a54..675809c 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -119,7 +119,7 @@ typedef struct
 
 XfdesktopThumbnailer *thumbnailer;
 
-GFile *selected_file;
+GFile *selected_folder;
 GCancellable *cancel_enumeration;
 guint add_dir_idle_id;
 
@@ -226,9 +226,10 @@ static gpointer
 xfdesktop_settings_create_previews(gpointer data)
 {
 AppearancePanel *panel = data;
-PreviewData *pdata = NULL;
 
 while(panel->preview_queue != NULL) {
+PreviewData *pdata = NULL;
+
 /* Block and wait for another preview to create */
 pdata = g_async_queue_pop(panel->preview_queue);
 
@@ -525,6 +526,28 @@ xfdesktop_settings_image_iconview_add(GtkTreeModel *model,
 return NULL;
 }
 
+static void
+cb_destroy_add_dir_enumeration(gpointer user_data)
+{
+AddDirData *dir_data = user_data;
+AppearancePanel *panel = dir_data->panel;
+
+TRACE("entering");
+
+g_free(dir_data->file_path);
+g_free(dir_data->last_image);
+
+if(G_IS_FILE_ENUMERATOR(dir_data->file_enumerator))
+g_object_unref(dir_data->file_enumerator);
+
+g_free(dir_data);
+
+if(panel->cancel_enumeration) {
+g_object_unref(panel->cancel_enumeration);
+panel->cancel_enumeration = NULL;
+}
+}
+
 static gboolean
 xfdesktop_image_list_add_item(gpointer user_data)
 {
@@ -532,22 +555,13 @@ xfdesktop_image_list_add_item(gpointer user_data)
 AppearancePanel *panel = dir_data->panel;
 GFileInfo *info;
 GtkTreeIter *iter;
-GtkTreePath *path;
-
-/* If the enumeration gets canceled/destroyed we need to clean up */
-if(!G_IS_FILE_ENUMERATOR(dir_data->file_enumerator)) {
-g_free(dir_data->file_path);
-g_free(dir_data->last_image);
-g_free(dir_data);
-
-if(panel->cancel_enumeration) {
-g_object_unref(panel->cancel_enumeration);
-panel->cancel_enumeration = NULL;
-}
 
+/* If the enumeration gets canceled/destroyed return and
+ * cb_destroy_add_dir_enumeration will get called to clean up */
+if(!G_IS_FILE_ENUMERATOR(dir_data->file_enumerator))
 return FALSE;
-}
 
+/* Add one item to the icon view at a time so we don't block the UI */
 if((info = g_file_enumerator_next_file(dir_data->file_enumerator, NULL, 
NULL))) {
 const gchar *file_name = g_file_info_get_name(info);
 gchar *buf = g_strconcat(dir_data->file_path, "/", file_name, NULL);
@@ -577,23 +591,16 @@ xfdesktop_image_list_add_item(gpointer user_data)
 
 /* last_image is in the directory added then it should be selected */
 if(dir_data->selected_iter) {
+GtkTreePath *path;
 path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_data->ls), 
dir_data->selected_iter);
 if(path) {
 gtk_icon_view_select_path(GTK_ICON_VIEW(panel->image_iconview), 
path);
 gtk_tree_iter_free(dir_data->selected_iter);
+gtk_tree_path_free(path);
 }
  }
 
-g_free(dir_data->file_path);
-g_free(dir_data->last_image);
-g_object_unref(dir_data->file_enumerator);
-g_free(dir_data);
-
-if(panel->cancel_enumeration) {
-g_object_unref(panel->cancel_enumeration);
-panel->cancel_enumeration = NULL;
-}
-
+/* cb_destroy_add_dir_enumeration will get called to clean up */
 return FALSE;
 }
 
@@ -619,15 +626,18 @@ xfdesktop_image_list_add_dir(GObject *source_object,
 
 dir_data->last_image = xfconf_channel_get_string(panel->channel, property, 
DEFAULT_BACKDROP);
 
-dir_data->file_path = g_file_get_path(panel->selected_file);
+dir_data->file_path = g_file_get_path(panel->selected_folder);
 
-dir_data->file_enumerator = 
g_file_enumerate_children_finish(panel->selected_file,
+dir_data->file_enumerator = 
g_file_enumerate_children_finish(panel->selected_folder,
  res,
  NULL);
 
 /* Individual items are added in an idle callback so everything is more
  * responsive */
-

[Xfce4-commits] Fix some memory leaks

2013-04-27 Thread Eric Koegel
Updating branch refs/heads/master
 to c998210dc8cad6705843b37d1b72ae972a10671d (commit)
   from 9dbec5220ff4e60dbd9ec4c8b528429f40a82616 (commit)

commit c998210dc8cad6705843b37d1b72ae972a10671d
Author: Eric Koegel 
Date:   Sat Apr 27 16:05:31 2013 +0300

Fix some memory leaks

 src/xfdesktop-notify.c |   60 +++
 1 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/src/xfdesktop-notify.c b/src/xfdesktop-notify.c
index ae55a96..6cbcad3 100644
--- a/src/xfdesktop-notify.c
+++ b/src/xfdesktop-notify.c
@@ -215,27 +215,31 @@ xfdesktop_notify_unmount_finish (GMount *mount, gboolean 
unmount_successful)
   g_object_set_data (G_OBJECT (mount), "xfdesktop-notification", NULL);
 }
 
-  /* if the unmount operation wasn't successful then stop here, otherwise
-   * display a message letting the user know it has been removed */
-  if(!unmount_successful)
-return;
-
-  summary = _("Unmount Finished");
+  /* if the unmount operation was successful then display a message letting
+   * the user know it has been removed */
+  if (unmount_successful)
+{
+  summary = _("Unmount Finished");
 
-  message = g_strdup_printf (_("The device \"%s\" has been safely removed from 
the system. "), name);
+  message = g_strdup_printf (_("The device \"%s\" has been safely removed 
from the system. "), name);
 
 #ifdef NOTIFY_CHECK_VERSION
 #if NOTIFY_CHECK_VERSION (0, 7, 0)
-  notification = notify_notification_new (summary, message, icon_name);
+  notification = notify_notification_new (summary, message, icon_name);
 #else
-  notification = notify_notification_new (summary, message, icon_name, NULL);
+  notification = notify_notification_new (summary, message, icon_name, 
NULL);
 #endif
 #else
-  notification = notify_notification_new (summary, message, icon_name, NULL);
+  notification = notify_notification_new (summary, message, icon_name, 
NULL);
 #endif
-  notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
-  notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
-  notify_notification_show (notification, NULL);
+  notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
+  notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
+  notify_notification_show (notification, NULL);
+}
+
+  g_free (message);
+  g_free (icon_name);
+  g_free (name);
 }
 
 
@@ -395,27 +399,31 @@ xfdesktop_notify_eject_finish (GVolume *volume, gboolean 
eject_successful)
   g_object_set_data (G_OBJECT (volume), "xfdesktop-notification", NULL);
 }
 
-  /* if the eject operation wasn't successful then stop here, otherwise
-   * display a message letting the user know it has been removed */
-  if(!eject_successful)
-return;
-
-  summary = _("Eject Finished");
+  /* if the eject operation was successful then display a message letting the
+   * user know it has been removed */
+  if(eject_successful)
+{
+  summary = _("Eject Finished");
 
-  message = g_strdup_printf (_("The device \"%s\" has been safely removed from 
the system. "), name);
+  message = g_strdup_printf (_("The device \"%s\" has been safely removed 
from the system. "), name);
 
 #ifdef NOTIFY_CHECK_VERSION
 #if NOTIFY_CHECK_VERSION (0, 7, 0)
-  notification = notify_notification_new (summary, message, icon_name);
+  notification = notify_notification_new (summary, message, icon_name);
 #else
-  notification = notify_notification_new (summary, message, icon_name, NULL);
+  notification = notify_notification_new (summary, message, icon_name, 
NULL);
 #endif
 #else
-  notification = notify_notification_new (summary, message, icon_name, NULL);
+  notification = notify_notification_new (summary, message, icon_name, 
NULL);
 #endif
-  notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
-  notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
-  notify_notification_show (notification, NULL);
+  notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
+  notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
+  notify_notification_show (notification, NULL);
+}
+
+  g_free (message);
+  g_free (icon_name);
+  g_free (name);
 }
 
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Set the column spacing to 12

2013-04-30 Thread Eric Koegel
Updating branch refs/heads/eric/wallpaper-and-settings-improvements
 to 799811c5b53c53552067af5418f2ae7b7ceddff9 (commit)
   from 13fd293590da7934f61bf59129080ec535b5b9d8 (commit)

commit 799811c5b53c53552067af5418f2ae7b7ceddff9
Author: Eric Koegel 
Date:   Tue Apr 30 19:01:31 2013 +0300

Set the column spacing to 12

 .../xfdesktop-settings-appearance-frame-ui.glade   |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade 
b/settings/xfdesktop-settings-appearance-frame-ui.glade
index 8f40ae8..32e10c0 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -73,6 +73,7 @@
 8
 2
 6
+12
 
   
 True
@@ -270,7 +271,7 @@
   
 True
 GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK
-4
+12
 
   
 True
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Updates for release.

2013-12-22 Thread Eric Koegel
Updating branch refs/heads/master
 to 9e7c92a9701efa4c262c26bb48b427651e47c9c1 (commit)
   from a893ba38b656d6a76ff2c93050d19526419641a2 (commit)

commit 9e7c92a9701efa4c262c26bb48b427651e47c9c1
Author: Eric Koegel 
Date:   Sun Dec 22 15:22:27 2013 +0300

Updates for release.

 NEWS|   57 +++
 configure.ac.in |4 ++--
 2 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 4dbfc8f..fa4481a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,60 @@
+4.11.2
+==
+[Please note that this is a development release.]
+
+Third development release of xfdesktop targeting for Xfce 4.12.
+Please report all problems at bugzilla.xfce.org.
+
+* Xfdesktop-settings:
+  - Add xfconf property to toggle the display of the add/remove
+workspace menu items in the middle click menu (Bug 4278, 7337)
+  - Add an info bar to xfdesktop-settings so it is clearer on how
+to customize additional workspaces and monitors (Bug 10460)
+  - Keyboard navigation has been improved in xfdesktop-settings
+
+* Port Xfdesktop to the GApplication API:
+  - Xfdesktop now uses the GApplication API to handle process
+uniqueness, message passing, and life cycle management.
+
+* Improve how Xfdesktop transitions from the login manager to
+  the initial wallpaper display; all bugs were reported and
+  resolved by Alistair Buxton:
+- Don't set the root pixmap until it's been drawn
+- Don't show the window until the background is ready.
+- Don't set ESETROOT.
+
+* Miscellaneous fixes:
+- Scale down over-sized icons in menus so they have a uniform
+  appearance (Bugs 10545, 10461)
+- Move max-template-files xfconf property
+- Remove old GLIB/GTK macro checks
+- Update man page
+- Wait for the window manager to prevent issues where the
+  wallpaper and icons won't show up on additional screens
+  during startup (Bug 7769)
+- Fix icon renames causing duplicate icons
+- Fix icons for .desktop files with absolute paths
+- Don't show hidden or backup files on the desktop (Bug 9001)
+- Fix a couple warning messages that happen when xfdesktop is
+  shutdown while it's still starting up
+- Improve how backdrops are chosen
+
+* Translation updates:
+  Arabic (ar), Basque (eu), Bulgarian (bg), Catalan (ca),
+  Chinese (China) (zh_CN), Chinese (Hong Kong) (zh_HK),
+  Chinese (Taiwan) (zh_TW), Croatian (hr), Czech (cs),
+  Danish (da), Dutch (Flemish) (nl), English (Australia) (en_AU),
+  English (United Kingdom) (en_GB), Estonian (et), French (fr),
+  Galician (gl), German (de), Greek (el), Hebrew (he),
+  Hungarian (hu), Icelandic (is), Indonesian (id), Italian (it),
+  Japanese (ja), Kazakh (kk), Korean (ko), Lithuanian (lt),
+  Malay (ms), Norwegian Bokmål (nb), Norwegian Nynorsk (nn),
+  Occitan (post 1500) (oc), Persian (Iran) (fa_IR), Polish (pl),
+  Portuguese (pt), Portuguese (Brazilian) (pt_BR), Romanian (ro),
+  Russian (ru), Serbian (sr), Slovak (sk), Slovenian (sl),
+  Spanish (Castilian) (es), Swedish (sv), Thai (th),
+  Turkish (tr), Ukrainian (uk), Uyghur (ug), and Uzbek (uz).
+
 4.11.1
 ==
 - Wrong g_return_if_fail macro used
diff --git a/configure.ac.in b/configure.ac.in
index ca310f2..41e4e3d 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -6,10 +6,10 @@ dnl
 dnl version info
 m4_define([xfdesktop_version_major], [4])
 m4_define([xfdesktop_version_minor], [11])
-m4_define([xfdesktop_version_micro], [1])
+m4_define([xfdesktop_version_micro], [2])
 m4_define([xfdesktop_version_nano], [])
 m4_define([xfdesktop_version_build], [@REVISION@])
-m4_define([xfdesktop_version_tag],[git])
+m4_define([xfdesktop_version_tag],[])
 m4_define([xfdesktop_version], 
[xfdesktop_version_major().xfdesktop_version_minor().xfdesktop_version_micro()ifelse(xfdesktop_version_nano(),
 [], [], [.xfdesktop_version_nano()])ifelse(xfdesktop_version_tag(), [git], 
[xfdesktop_version_tag()-xfdesktop_version_build()], 
[xfdesktop_version_tag()])])
 
 dnl minimum required versions
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Creating annotated tag xfdesktop-4.11.2

2013-12-22 Thread Eric Koegel
Updating annotated tag refs/tags/xfdesktop-4.11.2
 as new annotated tag
 to 4afbee8262d3fd67d052220e972207f6baf4f464 (tag)
   succeeds xfdesktop-4.11.1-137-ga893ba3
  tagged by Eric Koegel 
 on 2013-12-22 13:23 +0100

Eric Koegel (1):
  Updates for release.

___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Post release tag bump.

2013-12-22 Thread Eric Koegel
Updating branch refs/heads/master
 to b275ed97f978c8fda037c185efbdd01d56738b48 (commit)
   from 9e7c92a9701efa4c262c26bb48b427651e47c9c1 (commit)

commit b275ed97f978c8fda037c185efbdd01d56738b48
Author: Eric Koegel 
Date:   Sun Dec 22 15:28:31 2013 +0300

Post release tag bump.

 configure.ac.in |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac.in b/configure.ac.in
index 41e4e3d..4043d9f 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -9,7 +9,7 @@ m4_define([xfdesktop_version_minor], [11])
 m4_define([xfdesktop_version_micro], [2])
 m4_define([xfdesktop_version_nano], [])
 m4_define([xfdesktop_version_build], [@REVISION@])
-m4_define([xfdesktop_version_tag],[])
+m4_define([xfdesktop_version_tag],[git])
 m4_define([xfdesktop_version], 
[xfdesktop_version_major().xfdesktop_version_minor().xfdesktop_version_micro()ifelse(xfdesktop_version_nano(),
 [], [], [.xfdesktop_version_nano()])ifelse(xfdesktop_version_tag(), [git], 
[xfdesktop_version_tag()-xfdesktop_version_build()], 
[xfdesktop_version_tag()])])
 
 dnl minimum required versions
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Only use thunarx_menu_provider_get_file_actions (Bug 10492)

2013-12-31 Thread Eric Koegel
Updating branch refs/heads/master
 to b13d47e52d3755f9e9c424339063370a8ca7234b (commit)
   from ff207e4a68c3308083c3fc8dab48700672d9f061 (commit)

commit b13d47e52d3755f9e9c424339063370a8ca7234b
Author: Eric Koegel 
Date:   Sun Dec 29 22:39:07 2013 +0300

Only use thunarx_menu_provider_get_file_actions (Bug 10492)

Using thunarx_menu_provider_get_file_actions on both folders and
files allows all the options to display. Using both files_actions
and folder_actions would cause some duplicate entires. This allows
the thunar-archive-plugin to provide the 'create archive' menu
option for folders on the desktop.

 src/xfdesktop-file-icon-manager.c |   26 +-
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index b263c01..1b424d9 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1620,24 +1620,16 @@ 
xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
 GList *menu_actions = NULL;
 ThunarxMenuProvider *provider;
 
-if(g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY) {
-for(l = fmanager->priv->thunarx_menu_providers; l; l = 
l->next) {
-provider = THUNARX_MENU_PROVIDER(l->data);
-menu_actions = g_list_concat(menu_actions,
- 
thunarx_menu_provider_get_folder_actions(provider,
-   
   toplevel,
-   
   THUNARX_FILE_INFO(file_icon)));
-}
-} else {
-for(l = fmanager->priv->thunarx_menu_providers; l; l = 
l->next) {
-provider = THUNARX_MENU_PROVIDER(l->data);
-menu_actions = g_list_concat(menu_actions,
- 
thunarx_menu_provider_get_file_actions(provider,
-   
 toplevel,
-   
 selected));
-}
+/* thunar file specific actions (allows them to operate on folders
+ * as well) */
+for(l = fmanager->priv->thunarx_menu_providers; l; l = l->next) {
+provider = THUNARX_MENU_PROVIDER(l->data);
+menu_actions = g_list_concat(menu_actions,
+ 
thunarx_menu_provider_get_file_actions(provider,
+   
 toplevel,
+   
 selected));
 }
-
+
 if(menu_actions) {
 xfdesktop_menu_shell_append_action_list(GTK_MENU_SHELL(menu),
 menu_actions);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Use get_folder_actions for clicks on the desktop itself

2014-01-05 Thread Eric Koegel
Updating branch refs/heads/master
 to c4782e358f100f33c665e67d47425f77c9655ec4 (commit)
   from 1028f607551254cca5db4951e9e52d4bb4d09c6d (commit)

commit c4782e358f100f33c665e67d47425f77c9655ec4
Author: Eric Koegel 
Date:   Sun Jan 5 21:47:39 2014 +0300

Use get_folder_actions for clicks on the desktop itself

Call thunarx_menu_provider_get_folder_actions when the menu is
popped up and no icons are selected. This prevents showing some
thunar actions that make little sense in that context.

 src/xfdesktop-file-icon-manager.c |   27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 1b424d9..857329a 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1620,14 +1620,25 @@ 
xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
 GList *menu_actions = NULL;
 ThunarxMenuProvider *provider;
 
-/* thunar file specific actions (allows them to operate on folders
- * as well) */
-for(l = fmanager->priv->thunarx_menu_providers; l; l = l->next) {
-provider = THUNARX_MENU_PROVIDER(l->data);
-menu_actions = g_list_concat(menu_actions,
- 
thunarx_menu_provider_get_file_actions(provider,
-   
 toplevel,
-   
 selected));
+if(selected->data == fmanager->priv->desktop_icon) {
+/* click on the desktop itself, only show folder actions */
+for(l = fmanager->priv->thunarx_menu_providers; l; l = 
l->next) {
+provider = THUNARX_MENU_PROVIDER(l->data);
+menu_actions = g_list_concat(menu_actions,
+ 
thunarx_menu_provider_get_folder_actions(provider,
+   
   toplevel,
+   
   THUNARX_FILE_INFO(file_icon)));
+}
+} else {
+/* thunar file specific actions (allows them to operate on 
folders
+ * that are on the desktop as well) */
+for(l = fmanager->priv->thunarx_menu_providers; l; l = 
l->next) {
+provider = THUNARX_MENU_PROVIDER(l->data);
+menu_actions = g_list_concat(menu_actions,
+ 
thunarx_menu_provider_get_file_actions(provider,
+   
 toplevel,
+   
 selected));
+}
 }
 
 if(menu_actions) {
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix icon labels in RTL languages (Bug 10604)

2014-01-08 Thread Eric Koegel
Updating branch refs/heads/master
 to 3cbad61da8ed5ef919d3e1ce38a483134eca8044 (commit)
   from be66a78f2a43de278411bd02bdde1cc0764bb03e (commit)

commit 3cbad61da8ed5ef919d3e1ce38a483134eca8044
Author: Eric Koegel 
Date:   Mon Jan 6 16:01:50 2014 +0300

Fix icon labels in RTL languages (Bug 10604)

 src/xfdesktop-icon-view.c |   48 +++--
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 595d25e..ee39f82 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -267,7 +267,8 @@ static gboolean 
xfdesktop_icon_view_update_icon_extents(XfdesktopIconView *icon_
 XfdesktopIcon *icon,
 GdkRectangle 
*pixbuf_extents,
 GdkRectangle 
*text_extents,
-GdkRectangle 
*total_extents);
+GdkRectangle 
*total_extents,
+gint *rtl_offset);
 static void xfdesktop_icon_view_invalidate_icon(XfdesktopIconView *icon_view,
 XfdesktopIcon *icon,
 gboolean recalc_extents);
@@ -2757,6 +2758,7 @@ xfdesktop_icon_view_invalidate_icon(XfdesktopIconView 
*icon_view,
 {
 GdkRectangle extents;
 gboolean invalidated_something = FALSE;
+gint rtl_offset;
 
 g_return_if_fail(icon);
 
@@ -2779,7 +2781,8 @@ xfdesktop_icon_view_invalidate_icon(XfdesktopIconView 
*icon_view,
 if(!xfdesktop_icon_view_update_icon_extents(icon_view, icon,
 &pixbuf_extents,
 &text_extents,
-&total_extents))
+&total_extents,
+&rtl_offset))
 {
 g_warning("Trying to invalidate icon, but can't recalculate 
extents");
 } else if(gtk_widget_get_realized(GTK_WIDGET(icon_view))) {
@@ -2986,14 +2989,15 @@ 
xfdesktop_icon_view_update_icon_extents(XfdesktopIconView *icon_view,
 XfdesktopIcon *icon,
 GdkRectangle *pixbuf_extents,
 GdkRectangle *text_extents,
-GdkRectangle *total_extents)
+GdkRectangle *total_extents,
+gint *rtl_offset)
 {
 GdkRectangle tmp_text;
 
 g_return_val_if_fail(XFDESKTOP_IS_ICON_VIEW(icon_view)
  && XFDESKTOP_IS_ICON(icon)
  && pixbuf_extents && text_extents
- && total_extents, FALSE);
+ && total_extents && rtl_offset, FALSE);
 
 if(!xfdesktop_icon_view_calculate_icon_pixbuf_area(icon_view, icon,
pixbuf_extents)
@@ -3005,14 +3009,17 @@ 
xfdesktop_icon_view_update_icon_extents(XfdesktopIconView *icon_view,
 pixbuf_extents->x += CELL_PADDING + ((CELL_SIZE - CELL_PADDING * 2) - 
pixbuf_extents->width) / 2;
 pixbuf_extents->y += CELL_PADDING;
 
-if(!xfdesktop_icon_view_calculate_icon_text_area(icon_view, icon,
- text_extents)
-   || !xfdesktop_icon_view_shift_area_to_cell(icon_view, icon,
-  text_extents))
-{
+if(!xfdesktop_icon_view_calculate_icon_text_area(icon_view, icon, 
text_extents))
 return FALSE;
-}
-text_extents->x += (CELL_SIZE - text_extents->width) / 2;
+
+/* text_extents->x right now includes the padding needed for rtl languages
+ * to display properly if it's set */
+*rtl_offset = text_extents->x;
+
+if(!xfdesktop_icon_view_shift_area_to_cell(icon_view, icon, text_extents))
+return FALSE;
+
+text_extents->x += (CELL_SIZE - text_extents->width) / 2 - *rtl_offset;
 text_extents->y += ICON_SIZE + SPACING + LABEL_RADIUS + CELL_PADDING;
 
 tmp_text = *text_extents;
@@ -3043,11 +3050,11 @@ xfdesktop_icon_view_draw_image(cairo_t *cr, GdkPixbuf 
*pix, GdkRectangle *rect)
 
 static void
 xfdesktop_icon_view_draw_text(cairo_t *cr, PangoLayout *playout,
-  gint x, gint y, GdkColor *color)
+  gint x, gint y, gint rtl_offset, GdkColor *color)
 {
 cairo_save(cr);
 
-cairo_move_to(cr, x, y);
+cairo_move_to(cr, x - rtl_o

[Xfce4-commits] Ensure a quit signal causes xfdesktop to shutdown

2014-01-08 Thread Eric Koegel
Updating branch refs/heads/master
 to cfe5a0ad88b84a23a4cd6d18a25635ec84cbaf68 (commit)
   from 3cbad61da8ed5ef919d3e1ce38a483134eca8044 (commit)

commit cfe5a0ad88b84a23a4cd6d18a25635ec84cbaf68
Author: Eric Koegel 
Date:   Wed Jan 8 20:36:16 2014 +0300

Ensure a quit signal causes xfdesktop to shutdown

 src/xfdesktop-application.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c
index 91d25e6..5756df0 100644
--- a/src/xfdesktop-application.c
+++ b/src/xfdesktop-application.c
@@ -252,12 +252,8 @@ session_die(gpointer user_data)
 
 TRACE("entering");
 
-/* If we somehow got here after the app has been released we don't need
- * to do anything */
-if(user_data == NULL || !XFDESKTOP_IS_APPLICATION(user_data))
-return;
-
-app = XFDESKTOP_APPLICATION(user_data);
+/* Ensure we always have a valid reference so we can quit xfdesktop */
+app = xfdesktop_application_get();
 
 /* Cancel the wait for wm check if it's still running */
 g_cancellable_cancel(app->cancel);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix some runtime warnings

2014-01-12 Thread Eric Koegel
Updating branch refs/heads/master
 to ae085d7a1b961870b70e0b22916d7cae67b992eb (commit)
   from 8e84a7f57a3d3c8dfe788d537e4b14ae16d22608 (commit)

commit ae085d7a1b961870b70e0b22916d7cae67b992eb
Author: Eric Koegel 
Date:   Sun Jan 12 15:04:02 2014 +0300

Fix some runtime warnings

This patch fixes it so that the file icon manager won't attempt to
remove pending icons from the icon view as they won't be there yet.
It also removes an icon migration function that shouldn't be needed
anymore.

 src/xfdesktop-file-icon-manager.c |  102 -
 1 file changed, 32 insertions(+), 70 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 857329a..a3201e6 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -502,62 +502,6 @@ 
xfdesktop_file_icon_manager_icon_view_manager_init(XfdesktopIconViewManagerIface
 iface->propose_drop_action = 
xfdesktop_file_icon_manager_propose_drop_action;
 }
 
-
-
-/* FIXME: remove this before 4.4.0; leave it for now to migrate older beta
-* installs from the old location */
-static void
-__migrate_old_icon_positions(XfdesktopFileIconManager *fmanager)
-{
-gchar relpath[PATH_MAX], *old_file;
-
-g_snprintf(relpath, PATH_MAX, "xfce4/desktop/icons.screen%d-%dx%d.rc",
-   gdk_screen_get_number(fmanager->priv->gscreen),
-   gdk_screen_get_width(fmanager->priv->gscreen),
-   gdk_screen_get_height(fmanager->priv->gscreen));
-
-old_file = xfce_resource_save_location(XFCE_RESOURCE_CACHE, relpath, 
FALSE);
-
-if(G_UNLIKELY(old_file) && g_file_test(old_file, G_FILE_TEST_EXISTS)) {
-gchar *new_file = xfce_resource_save_location(XFCE_RESOURCE_CONFIG,
-  relpath, FALSE);
-if(G_LIKELY(new_file)) {
-if(rename(old_file, new_file)) {
-/* grumble, have to do this the hard way */
-gchar *contents = NULL;
-gsize length = 0;
-GError *error = NULL;
-
-if(g_file_get_contents(old_file, &contents, &length, &error)) {
-if(!g_file_set_contents(new_file, contents, length,
-&error))
-{
-g_critical("Unable to write to %s: %s", new_file,
-   error->message);
-g_error_free(error);
-}
-
-g_free(contents);
-} else {
-g_critical("Unable to read from %s: %s", old_file,
-   error->message);
-g_error_free(error);
-}
-}
-} else
-g_critical("Unable to migrate icon position file to new 
location.");
-
-/* i debate removing the old file even if the migration failed,
- * but i think this is the best way to avoid bug reports that
- * aren't my problem. */
-unlink(old_file);
-
-g_free(new_file);
-}
-
-g_free(old_file);
-}
-
 static gboolean
 xfdesktop_file_icon_manager_check_create_desktop_folder(GFile *folder)
 {
@@ -2341,8 +2285,20 @@ xfdesktop_remove_icons_ht(gpointer key,
   gpointer value,
   gpointer user_data)
 {
-xfdesktop_icon_view_remove_item(XFDESKTOP_ICON_VIEW(user_data),
-XFDESKTOP_ICON(value));
+XfdesktopFileIconManager *fmanager = 
XFDESKTOP_FILE_ICON_MANAGER(user_data);
+XfdesktopIcon *icon = XFDESKTOP_ICON(value);
+GList *item = NULL;
+
+/* find out if the icon was pending creation */
+if(fmanager->priv->pending_icons)
+item = g_queue_find(fmanager->priv->pending_icons, icon);
+
+/* Remove the icon if it was in the icon view */
+if(item == NULL) {
+xfdesktop_icon_view_remove_item(fmanager->priv->icon_view,
+XFDESKTOP_ICON(value));
+}
+
 return TRUE;
 }
 
@@ -2377,7 +2333,7 @@ 
xfdesktop_file_icon_manager_refresh_icons(XfdesktopFileIconManager *fmanager)
 if(fmanager->priv->icons) {
 g_hash_table_foreach_remove(fmanager->priv->icons,
 (GHRFunc)xfdesktop_remove_icons_ht,
-fmanager->priv->icon_view);
+fmanager);
 }
 
 #if defined(DEBUG) && DEBUG > 0
@@ -2730,12 +2686,19 @@ xfdesktop_file_icon_manager_files_ready(GFileEnumerator 
*enumerator,
 GAsyncResult *result,
 gpointer user_data)
 {
-  

  1   2   3   4   >