[gthumb/ext] allow to reorder only if the source is reorderable
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] allow to reorder only if the source is reorderable
- Date: Sat, 29 Aug 2009 09:12:34 +0000 (UTC)
commit b456c554420545625beb61f5c2d55a4e060f7487
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Aug 29 10:55:20 2009 +0200
allow to reorder only if the source is reorderable
extensions/file_manager/callbacks.c | 14 ++++++++++----
gthumb/gth-browser.c | 34 +++++++++++++++++++---------------
gthumb/gth-file-source.c | 1 -
gthumb/gth-file-view.c | 15 ---------------
gthumb/gth-file-view.h | 6 ------
gthumb/gth-icon-view.c | 20 --------------------
6 files changed, 29 insertions(+), 61 deletions(-)
---
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 4fb3c01..920d713 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -393,10 +393,6 @@ fm__gth_browser_construct_cb (GthBrowser *browser)
set_action_sensitive (data, "Edit_PasteInFolder", FALSE);
file_view = gth_file_list_get_view (GTH_FILE_LIST (gth_browser_get_file_list (browser)));
- gth_file_view_enable_drag_dest (GTH_FILE_VIEW (file_view),
- drag_dest_targets,
- G_N_ELEMENTS (drag_dest_targets),
- GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
g_signal_connect (file_view,
"drag_data_received",
G_CALLBACK (gth_file_list_drag_data_received),
@@ -490,12 +486,22 @@ fm__gth_browser_load_location_after_cb (GthBrowser *browser,
const GError *error)
{
BrowserData *data;
+ GtkWidget *file_view;
if (location == NULL)
return;
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
file_manager_update_ui (data, browser);
+
+ file_view = gth_file_list_get_view (GTH_FILE_LIST (gth_browser_get_file_list (browser)));
+ if (gth_file_source_is_reorderable (gth_browser_get_location_source (browser)))
+ gth_file_view_enable_drag_dest (GTH_FILE_VIEW (file_view),
+ drag_dest_targets,
+ G_N_ELEMENTS (drag_dest_targets),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+ else
+ gth_file_view_unset_drag_dest (GTH_FILE_VIEW (file_view));
}
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index f94846b..13657a0 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1265,31 +1265,29 @@ _gth_browser_set_sort_order (GthBrowser *browser,
gboolean inverse,
gboolean save)
{
+ g_return_if_fail (sort_type != NULL);
+
if (save) {
browser->priv->sort_type = sort_type;
browser->priv->sort_inverse = inverse;
}
- if (sort_type != NULL)
- gth_file_list_set_sort_func (GTH_FILE_LIST (browser->priv->file_list),
- sort_type->cmp_func,
- inverse);
- else
- gth_file_list_set_sort_func (GTH_FILE_LIST (browser->priv->file_list),
- NULL,
- FALSE);
+ gth_file_list_set_sort_func (GTH_FILE_LIST (browser->priv->file_list),
+ sort_type->cmp_func,
+ inverse);
gth_browser_update_title (browser);
if (! browser->priv->constructed)
return;
+ g_file_info_set_attribute_string (browser->priv->location->info, "sort::type", sort_type != NULL ? sort_type->name : "general::unsorted");
+ g_file_info_set_attribute_boolean (browser->priv->location->info, "sort::inverse", sort_type != NULL ? inverse : FALSE);
+
if (! save) {
write_sort_order_ready_cb (G_OBJECT (browser->priv->location_source), NULL, browser);
return;
}
- g_file_info_set_attribute_string (browser->priv->location->info, "sort::type", sort_type != NULL ? sort_type->name : "manual");
- g_file_info_set_attribute_boolean (browser->priv->location->info, "sort::inverse", sort_type != NULL ? inverse : FALSE);
gth_file_source_write_metadata (browser->priv->location_source,
browser->priv->location,
"sort::type,sort::inverse",
@@ -2625,16 +2623,20 @@ entry_points_changed_cb (GthMonitor *monitor,
static void
-order_changed_cb (GthMonitor *monitor,
- GFile *file,
- int *new_order,
- GthBrowser *browser)
+order_changed_cb (GthMonitor *monitor,
+ GFile *file,
+ int *new_order,
+ GthBrowser *browser)
{
if (browser->priv->location == NULL)
return;
- if (g_file_equal (file, browser->priv->location->file))
+ if (g_file_equal (file, browser->priv->location->file)) {
+ g_file_info_set_attribute_string (browser->priv->location->info, "sort::type", "general::unsorted");
+ g_file_info_set_attribute_boolean (browser->priv->location->info, "sort::inverse", FALSE);
gth_file_store_reorder (gth_browser_get_file_store (browser), new_order);
+ gth_browser_update_title (browser);
+ }
}
@@ -3658,6 +3660,8 @@ gth_browser_set_sort_order (GthBrowser *browser,
GthFileDataSort *sort_type,
gboolean inverse)
{
+ g_return_if_fail (sort_type != NULL);
+
_gth_browser_set_sort_order (browser, sort_type, inverse, TRUE);
}
diff --git a/gthumb/gth-file-source.c b/gthumb/gth-file-source.c
index 75ea724..350e96a 100644
--- a/gthumb/gth-file-source.c
+++ b/gthumb/gth-file-source.c
@@ -609,7 +609,6 @@ static gboolean
base_is_reorderable (GthFileSource *file_source)
{
return FALSE;
-
}
diff --git a/gthumb/gth-file-view.c b/gthumb/gth-file-view.c
index 0f0625b..cfd6282 100644
--- a/gthumb/gth-file-view.c
+++ b/gthumb/gth-file-view.c
@@ -117,21 +117,6 @@ gth_file_view_get_cursor (GthFileView *self)
void
-gth_file_view_set_reorderable (GthFileView *self,
- gboolean value)
-{
- GTH_FILE_VIEW_GET_INTERFACE (self)->set_reorderable (self, value);
-}
-
-
-gboolean
-gth_file_view_get_reorderable (GthFileView *self)
-{
- return GTH_FILE_VIEW_GET_INTERFACE (self)->get_reorderable (self);
-}
-
-
-void
gth_file_view_enable_drag_source (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
diff --git a/gthumb/gth-file-view.h b/gthumb/gth-file-view.h
index e1470a5..3ec3732 100644
--- a/gthumb/gth-file-view.h
+++ b/gthumb/gth-file-view.h
@@ -79,9 +79,6 @@ struct _GthFileViewIface {
void (*set_cursor) (GthFileView *self,
int pos);
int (*get_cursor) (GthFileView *self);
- void (*set_reorderable) (GthFileView *self,
- gboolean value);
- gboolean (*get_reorderable) (GthFileView *self);
void (*enable_drag_source) (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
@@ -123,9 +120,6 @@ void gth_file_view_activated (GthFileView *self,
void gth_file_view_set_cursor (GthFileView *self,
int pos);
int gth_file_view_get_cursor (GthFileView *self);
-void gth_file_view_set_reorderable (GthFileView *self,
- gboolean value);
-gboolean gth_file_view_get_reorderable (GthFileView *self);
void gth_file_view_enable_drag_source (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
diff --git a/gthumb/gth-icon-view.c b/gthumb/gth-icon-view.c
index e9c967b..da98c7a 100644
--- a/gthumb/gth-icon-view.c
+++ b/gthumb/gth-icon-view.c
@@ -189,24 +189,6 @@ gth_icon_view_real_get_cursor (GthFileView *base)
static void
-gth_icon_view_real_set_reorderable (GthFileView *base,
- gboolean value)
-{
- GthIconView * self;
- self = GTH_ICON_VIEW (base);
-}
-
-
-static gboolean
-gth_icon_view_real_get_reorderable (GthFileView *base)
-{
- GthIconView * self;
- self = GTH_ICON_VIEW (base);
- return FALSE;
-}
-
-
-static void
gth_icon_view_enable_drag_source (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
@@ -471,8 +453,6 @@ gth_icon_view_gth_file_view_interface_init (GthFileViewIface *iface)
iface->activated = gth_icon_view_real_activated;
iface->set_cursor = gth_icon_view_real_set_cursor;
iface->get_cursor = gth_icon_view_real_get_cursor;
- iface->set_reorderable = gth_icon_view_real_set_reorderable;
- iface->get_reorderable = gth_icon_view_real_get_reorderable;
iface->enable_drag_source = gth_icon_view_enable_drag_source;
iface->unset_drag_source = gth_icon_view_unset_drag_source;
iface->enable_drag_dest = gth_icon_view_enable_drag_dest;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]