gnome-system-tools r4163 - trunk/src/common



Author: carlosg
Date: Sun Feb 17 17:00:09 2008
New Revision: 4163
URL: http://svn.gnome.org/viewvc/gnome-system-tools?rev=4163&view=rev

Log:
2008-02-17  Carlos Garnacho  <carlosg gnome org>

        * gst-tool.[ch] (gst_tool_add_configuration_object)
        (configuration_object_committed) (configuration_object_changed)
        (gst_tool_commit_async): Do not reload the configuration if there's a
        quite certain possibility that the tool is the one that caused the
        change.


Modified:
   trunk/src/common/ChangeLog
   trunk/src/common/gst-tool.c
   trunk/src/common/gst-tool.h

Modified: trunk/src/common/gst-tool.c
==============================================================================
--- trunk/src/common/gst-tool.c	(original)
+++ trunk/src/common/gst-tool.c	Sun Feb 17 17:00:09 2008
@@ -25,6 +25,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gconf/gconf-client.h>
+#include <time.h>
 
 #ifdef ENABLE_GNOME
 #include <libgnomeui/libgnomeui.h>
@@ -516,6 +517,8 @@
 	user_data->func = func;
 	user_data->data = data;
 
+	tool->last_commit_time = time (NULL);
+
 	if (message)
 		gst_tool_show_report_window (tool, message);
 
@@ -565,6 +568,18 @@
 			      GstTool    *tool)
 {
 	gboolean do_update = TRUE;
+	time_t current_time;
+
+	current_time = time (NULL);
+
+	/* If we get ::changed shortly after having committed,
+	 * there's a good chance that the tool has been the
+	 * origin of the change. Of course there could be the
+	 * possibility that this isn't true, but will happen
+	 * quite rarely.
+	 */
+	if (current_time - tool->last_commit_time <= 2)
+		return;
 
 	if (gst_dialog_get_editing (tool->main_dialog)) {
 		GtkWidget *parent, *dialog;
@@ -596,6 +611,13 @@
 	}
 }
 
+static void
+configuration_object_committed (OobsObject *object,
+				GstTool    *tool)
+{
+	tool->last_commit_time = time (NULL);
+}
+
 void
 gst_tool_add_configuration_object (GstTool    *tool,
 				   OobsObject *object)
@@ -607,4 +629,6 @@
 
 	g_signal_connect (object, "changed",
 			  G_CALLBACK (configuration_object_changed), tool);
+	g_signal_connect (object, "committed",
+			  G_CALLBACK (configuration_object_committed), tool);
 }

Modified: trunk/src/common/gst-tool.h
==============================================================================
--- trunk/src/common/gst-tool.h	(original)
+++ trunk/src/common/gst-tool.h	Sun Feb 17 17:00:09 2008
@@ -60,6 +60,8 @@
 	GstDialog *main_dialog;
 	GtkWidget *configuration_changed_dialog;
 
+	time_t last_commit_time;
+
 	/* Progress report widgets */
 	GtkWidget *report_window;
 	GtkWidget *report_label;



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