[gnome-utils] Store current location in the app struct
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] Store current location in the app struct
- Date: Sat, 24 Jul 2010 20:02:36 +0000 (UTC)
commit 74d1264526509267a081e8d1e95c8c347845bd1b
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Jul 24 22:02:09 2010 +0200
Store current location in the app struct
baobab/src/baobab.c | 29 +++++++++++++++--------------
baobab/src/baobab.h | 2 ++
2 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c
index 673dd38..c460099 100644
--- a/baobab/src/baobab.c
+++ b/baobab/src/baobab.c
@@ -46,8 +46,6 @@ static GtkTreeIter currentiter;
static GtkTreeIter firstiter;
static GQueue *iterstack = NULL;
-static GFile *current_location = NULL;
-
enum {
DND_TARGET_URI_LIST
};
@@ -127,8 +125,9 @@ set_drop_target (GtkWidget *target, gboolean active) {
static void
check_menu_sens (gboolean scanning)
{
- if (scanning) {
+ gboolean has_current_location;
+ if (scanning) {
while (gtk_events_pending ())
gtk_main_iteration ();
@@ -137,11 +136,13 @@ check_menu_sens (gboolean scanning)
set_ui_action_sens ("collapse_all", TRUE);
}
+ has_current_location = baobab.current_location != NULL;
+
set_ui_action_sens ("menuscanhome", !scanning);
set_ui_action_sens ("menuallfs", !scanning);
set_ui_action_sens ("menuscandir", !scanning);
set_ui_action_sens ("menustop", scanning);
- set_ui_action_sens ("menurescan", !scanning && current_location != NULL);
+ set_ui_action_sens ("menurescan", !scanning && has_current_location);
set_ui_action_sens ("preferenze1", !scanning);
set_ui_action_sens ("menu_scan_rem", !scanning);
set_ui_action_sens ("ck_allocated", !scanning && baobab.is_local);
@@ -150,7 +151,7 @@ check_menu_sens (gboolean scanning)
set_ui_widget_sens ("tbscanall", !scanning);
set_ui_widget_sens ("tbscandir", !scanning);
set_ui_widget_sens ("tbstop", scanning);
- set_ui_widget_sens ("tbrescan", !scanning && current_location != NULL);
+ set_ui_widget_sens ("tbrescan", !scanning && has_current_location);
set_ui_widget_sens ("tb_scan_remote", !scanning);
}
@@ -172,9 +173,9 @@ baobab_scan_location (GFile *file)
if (iterstack !=NULL)
return;
- if (current_location)
- g_object_unref (current_location);
- current_location = g_object_ref (file);
+ if (baobab.current_location)
+ g_object_unref (baobab.current_location);
+ baobab.current_location = g_object_ref (file);
baobab.STOP_SCANNING = FALSE;
baobab_set_busy (TRUE);
@@ -242,15 +243,15 @@ baobab_scan_root (void)
void
baobab_rescan_current_dir (void)
{
- g_return_if_fail (current_location != NULL);
+ g_return_if_fail (baobab.current_location != NULL);
baobab_get_filesystem (&g_fs);
set_label_scan (&g_fs);
show_label ();
- g_object_ref (current_location);
- baobab_scan_location (current_location);
- g_object_unref (current_location);
+ g_object_ref (baobab.current_location);
+ baobab_scan_location (baobab.current_location);
+ g_object_unref (baobab.current_location);
}
void
@@ -901,8 +902,8 @@ baobab_shutdown (void)
{
g_free (baobab.label_scan);
- if (current_location)
- g_object_unref (current_location);
+ if (baobab.current_location)
+ g_object_unref (baobab.current_location);
if (baobab.monitor_vol) {
g_object_unref (baobab.monitor_vol);
diff --git a/baobab/src/baobab.h b/baobab/src/baobab.h
index 26b8aa7..ba91828 100644
--- a/baobab/src/baobab.h
+++ b/baobab/src/baobab.h
@@ -82,6 +82,8 @@ struct _BaobabApplication {
char *selected_path;
+ GFile *current_location;
+
GVolumeMonitor *monitor_vol;
GFileMonitor *monitor_home;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]