gnome-utils r7904 - in trunk/baobab: . src



Author: pborelli
Date: Fri May  2 16:00:54 2008
New Revision: 7904
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=7904&view=rev

Log:
2008-05-02  Paolo Borelli  <pborelli katamail com>

	* src/baobab.c:
	Ref the location before rescanning otherwise the current location
	gets finalized. Also make sure the Rescan button is insensitive when
	there is no current location. 



Modified:
   trunk/baobab/ChangeLog
   trunk/baobab/src/baobab-utils.c
   trunk/baobab/src/baobab-utils.h
   trunk/baobab/src/baobab.c

Modified: trunk/baobab/src/baobab-utils.c
==============================================================================
--- trunk/baobab/src/baobab-utils.c	(original)
+++ trunk/baobab/src/baobab-utils.c	Fri May  2 16:00:54 2008
@@ -158,39 +158,6 @@
 	gtk_widget_set_sensitive (w, sens);
 }
 
-/* menu & toolbar sensitivity */
-void
-check_menu_sens (gboolean scanning)
-{
-	if (scanning) {
-
-		while (gtk_events_pending ())
-			gtk_main_iteration ();
-
-		set_statusbar (_("Scanning..."));
-		set_glade_widget_sens ("menu_treemap", FALSE);
-		set_glade_widget_sens ("expand_all", TRUE);
-		set_glade_widget_sens ("collapse_all", TRUE);		
-	}
-
-	set_glade_widget_sens ("tbscanhome", !scanning);
-	set_glade_widget_sens ("tbscanall", !scanning);
-	set_glade_widget_sens ("tbscandir", !scanning);
-	set_glade_widget_sens ("menuscanhome", !scanning);
-	set_glade_widget_sens ("menuallfs", !scanning);
-	set_glade_widget_sens ("menuscandir", !scanning);
-	set_glade_widget_sens ("tbstop", scanning);
-	set_glade_widget_sens ("tbrescan", !scanning);
-	set_glade_widget_sens ("menustop", scanning);
-	set_glade_widget_sens ("menurescan", !scanning);
-	set_glade_widget_sens ("preferenze1", !scanning);
-	set_glade_widget_sens ("menu_scan_rem", !scanning);
-	set_glade_widget_sens ("tb_scan_remote", !scanning);
-	set_glade_widget_sens ("ck_allocated",
-			       !scanning &&
-			       baobab.is_local && !g_noactivescans);
-}
-
 gboolean
 show_bars (GtkTreeModel *mdl,
 	   GtkTreePath *path,

Modified: trunk/baobab/src/baobab-utils.h
==============================================================================
--- trunk/baobab/src/baobab-utils.h	(original)
+++ trunk/baobab/src/baobab-utils.h	Fri May  2 16:00:54 2008
@@ -28,7 +28,6 @@
 void baobab_get_filesystem (baobab_fs *fs);
 gchar* dir_select (gboolean, GtkWidget *);
 void on_toggled (GtkToggleButton *, gpointer);
-void check_menu_sens (gboolean);
 void stop_scan (void);
 gboolean show_bars (GtkTreeModel *model,
 		    GtkTreePath *path,

Modified: trunk/baobab/src/baobab.c
==============================================================================
--- trunk/baobab/src/baobab.c	(original)
+++ trunk/baobab/src/baobab.c	Fri May  2 16:00:54 2008
@@ -99,6 +99,39 @@
 	}
 }
 
+/* menu & toolbar sensitivity */
+static void
+check_menu_sens (gboolean scanning)
+{
+	if (scanning) {
+
+		while (gtk_events_pending ())
+			gtk_main_iteration ();
+
+		set_statusbar (_("Scanning..."));
+		set_glade_widget_sens ("menu_treemap", FALSE);
+		set_glade_widget_sens ("expand_all", TRUE);
+		set_glade_widget_sens ("collapse_all", TRUE);		
+	}
+
+	set_glade_widget_sens ("tbscanhome", !scanning);
+	set_glade_widget_sens ("tbscanall", !scanning);
+	set_glade_widget_sens ("tbscandir", !scanning);
+	set_glade_widget_sens ("menuscanhome", !scanning);
+	set_glade_widget_sens ("menuallfs", !scanning);
+	set_glade_widget_sens ("menuscandir", !scanning);
+	set_glade_widget_sens ("tbstop", scanning);
+	set_glade_widget_sens ("tbrescan", !scanning && current_location != NULL);
+	set_glade_widget_sens ("menustop", scanning);
+	set_glade_widget_sens ("menurescan", !scanning && current_location != NULL);
+	set_glade_widget_sens ("preferenze1", !scanning);
+	set_glade_widget_sens ("menu_scan_rem", !scanning);
+	set_glade_widget_sens ("tb_scan_remote", !scanning);
+	set_glade_widget_sens ("ck_allocated",
+			       !scanning &&
+			       baobab.is_local && !g_noactivescans);
+}
+
 void
 baobab_scan_location (GFile *file)
 {
@@ -182,7 +215,9 @@
 	set_label_scan (&g_fs);
 	show_label ();
 
+	g_object_ref (current_location);
 	baobab_scan_location (current_location);
+	g_object_unref (current_location);
 }
 
 void
@@ -788,14 +823,18 @@
 main (int argc, char *argv[])
 {
 	GnomeProgram *program;
+	GOptionContext *context;
 
 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
+	context = g_option_context_new (NULL);
+
 	program = gnome_program_init ("baobab", VERSION,
 				      LIBGNOMEUI_MODULE,
 				      argc, argv,
+				      GNOME_PARAM_GOPTION_CONTEXT, context,
 				      GNOME_PARAM_APP_DATADIR,
 				      BAOBAB_DATA_DIR, NULL);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]