anjuta r4437 - in trunk: . libanjuta plugins/document-manager plugins/editor plugins/symbol-db



Author: jhs
Date: Wed Dec 10 23:07:06 2008
New Revision: 4437
URL: http://svn.gnome.org/viewvc/anjuta?rev=4437&view=rev

Log:
2008-12-11  Johannes Schmid <jhs gnome org>

	* libanjuta/anjuta-status.c (anjuta_status):
	* plugins/document-manager/plugin.c (on_gconf_notify_timer):
	* plugins/editor/text_editor.c (on_text_editor_uri_changed):
	* plugins/symbol-db/plugin.c
	(on_editor_buffer_symbol_update_scan_end),
	(on_editor_buffer_symbols_update_timeout),
	(value_added_current_editor), (on_prefs_buffer_update_toggled):
	Save some uW (http://gould.cx/ted/blog/Saving_the_world_one__w_at_a_time) by
	using g_timeout_add_seconds instead of g_timeout_add where possible.

	* plugins/symbol-db/symbol-db-engine.c (gtree_compare_func),
	(sdb_engine_get_dyn_query_node_by_id),
	(sdb_engine_insert_dyn_query_node_by_id),
	(sdb_engine_ctags_output_thread),
	(sdb_engine_timeout_trigger_signals),
	(sdb_engine_get_unique_scan_id), (sdb_engine_add_new_symbol),
	(sdb_engine_detects_removed_ids),
	(symbol_db_engine_update_buffer_symbols):
	* plugins/symbol-db/symbol-db-view-locals.c (gtree_compare_func),
	(traverse_on_scan_end), (consume_symbols_inserted_queue_idle):
	* plugins/symbol-db/symbol-db-view.c (gtree_compare_func),
	(symbol_db_view_row_collapsed):
	Fix lots of 64-bit problems by using GPOINTER_TO_INT and GINT_TO_POINTER instead
	of direct (unsave) casts.
	
	* plugins/document-manager/anjuta-document-manager.ui:
	Remove "Print" and "Reload" from toolbar as they are not common enough.

Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-status.c
   trunk/plugins/document-manager/anjuta-document-manager.ui
   trunk/plugins/document-manager/plugin.c
   trunk/plugins/editor/text_editor.c
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-view-locals.c
   trunk/plugins/symbol-db/symbol-db-view.c

Modified: trunk/libanjuta/anjuta-status.c
==============================================================================
--- trunk/libanjuta/anjuta-status.c	(original)
+++ trunk/libanjuta/anjuta-status.c	Wed Dec 10 23:07:06 2008
@@ -601,7 +601,7 @@
 	g_return_if_fail (ANJUTA_IS_STATUS (status));
 	g_return_if_fail (mesg != NULL);
 	anjuta_status_push (status, "%s", mesg);
-	g_timeout_add (timeout * 1000, (void*) anjuta_status_timeout, status);
+	g_timeout_add_seconds (timeout, (void*) anjuta_status_timeout, status);
 }
 
 void

Modified: trunk/plugins/document-manager/anjuta-document-manager.ui
==============================================================================
--- trunk/plugins/document-manager/anjuta-document-manager.ui	(original)
+++ trunk/plugins/document-manager/anjuta-document-manager.ui	Wed Dec 10 23:07:06 2008
@@ -126,12 +126,9 @@
 	<toolbar name="ToolbarMain">
 		<placeholder name="PlaceholderFileToolbar">
 			<toolitem name="Save" action="ActionFileSave" />
-			<toolitem name="Reload" action="ActionFileReload" />
 			<separator name="separator16"/>
 			<toolitem name="Undo" action="ActionEditUndo" />
 			<toolitem name="Redo" action="ActionEditRedo" />
-			<separator name="separator17" />
-			<toolitem name="Print" action="ActionPrintFile" />
 		</placeholder>
 	</toolbar>
 	<toolbar name="ToolbarBookmark">

Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c	(original)
+++ trunk/plugins/document-manager/plugin.c	Wed Dec 10 23:07:06 2008
@@ -1602,23 +1602,15 @@
 			{
 				g_source_remove (plugin->autosave_id);
 				plugin->autosave_id =
-#if GLIB_CHECK_VERSION (2,14,0)
 					g_timeout_add_seconds (auto_save_timer * 60,
-#else
-					g_timeout_add (auto_save_timer * 60000,
-#endif
-									on_docman_auto_save, plugin);
+										   on_docman_auto_save, plugin);
 			}
 		}
 		else
 		{
 			plugin->autosave_id =
-#if GLIB_CHECK_VERSION (2,14,0)
 				g_timeout_add_seconds (auto_save_timer * 60,
-#else
-				g_timeout_add (auto_save_timer * 60000,
-#endif
-							 on_docman_auto_save, plugin);
+									   on_docman_auto_save, plugin);
 		}
 		plugin->autosave_it = auto_save_timer;
 		plugin->autosave_on = TRUE;

Modified: trunk/plugins/editor/text_editor.c
==============================================================================
--- trunk/plugins/editor/text_editor.c	(original)
+++ trunk/plugins/editor/text_editor.c	Wed Dec 10 23:07:06 2008
@@ -392,8 +392,8 @@
 	/* Set up 1 sec timer */
 	if (te->file_modified_timer > 0)
  		g_source_remove (te->file_modified_timer);
-	te->file_modified_timer = g_timeout_add (1000,
-							(GSourceFunc)on_text_editor_uri_changed_prompt, te);
+	te->file_modified_timer = g_timeout_add_seconds (1,
+													 (GSourceFunc)on_text_editor_uri_changed_prompt, te);
 }
 
 static void

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Wed Dec 10 23:07:06 2008
@@ -50,7 +50,7 @@
 
 #define ICON_FILE "anjuta-symbol-db-plugin-48.png"
 
-#define TIMEOUT_INTERVAL_SYMBOLS_UPDATE		10000
+#define TIMEOUT_INTERVAL_SYMBOLS_UPDATE		10
 #define TIMEOUT_SECONDS_AFTER_LAST_TIP		5
 
 #define PROJECT_GLOBALS		"/"
@@ -91,7 +91,7 @@
 }
 
 static void
-on_editor_buffer_symbol_update_scan_end (SymbolDBEngine *dbe, gint process_id, 
+on_editor_buffer_symbol_update_scan_end (SymbolDBEngine *dbe, gsize process_id, 
 										  gpointer data)
 {
 	SymbolDBPlugin *sdb_plugin;
@@ -129,7 +129,7 @@
 	SymbolDBPlugin *sdb_plugin;
 	IAnjutaEditor *ed;
 	gchar *current_buffer = NULL;
-	gint buffer_size = 0;
+	gsize buffer_size = 0;
 	gdouble seconds_elapsed;
 	GFile* file;
 	gchar * local_path;
@@ -209,7 +209,7 @@
 	g_ptr_array_add (buffer_sizes, (gpointer)buffer_size);	
 
 	
-	gint proc_id = symbol_db_engine_update_buffer_symbols (sdb_plugin->sdbe_project,
+	gsize proc_id = symbol_db_engine_update_buffer_symbols (sdb_plugin->sdbe_project,
 											sdb_plugin->project_opened,
 											real_files_list,
 											text_buffers,
@@ -425,9 +425,9 @@
 				
 	if (tags_update)
 		sdb_plugin->buf_update_timeout_id = 
-				g_timeout_add (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
-								on_editor_buffer_symbols_update_timeout,
-								plugin);
+				g_timeout_add_seconds (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
+									   on_editor_buffer_symbols_update_timeout,
+									   plugin);
 	sdb_plugin->need_symbols_update = FALSE;
 }
 
@@ -2378,9 +2378,9 @@
 	{
 		if (sdb_plugin->buf_update_timeout_id == 0)
 			sdb_plugin->buf_update_timeout_id = 
-				g_timeout_add (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
-								on_editor_buffer_symbols_update_timeout,
-								sdb_plugin);			
+				g_timeout_add_seconds (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
+									   on_editor_buffer_symbols_update_timeout,
+									   sdb_plugin);			
 		
 	}
 	

Modified: trunk/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.c	Wed Dec 10 23:07:06 2008
@@ -639,7 +639,7 @@
 static gint
 gtree_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
 {
-	return (gint)a - (gint)b;
+	return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
 }
 
 /**
@@ -647,7 +647,7 @@
  */
 static inline const DynChildQueryNode *
 sdb_engine_get_dyn_query_node_by_id (SymbolDBEngine *dbe, dyn_query_type query_id,
-									 SymExtraInfo sym_info, gint other_parameters)
+									 SymExtraInfo sym_info, gsize other_parameters)
 {
 	dyn_query_node *node;
 	SymbolDBEnginePriv *priv;
@@ -704,7 +704,7 @@
  */
 static inline const DynChildQueryNode *
 sdb_engine_insert_dyn_query_node_by_id (SymbolDBEngine *dbe, dyn_query_type query_id,
-									 	SymExtraInfo sym_info, gint other_parameters,
+									 	SymExtraInfo sym_info, gsize other_parameters,
 										const gchar *sql)
 {
 	dyn_query_node *node;
@@ -1431,7 +1431,7 @@
 		{
 			if (marker_ptr != NULL) 
 			{
-				gint scan_flag;
+				int scan_flag;
 				gchar *real_file;
 		
 				/* set the length of the string parsed */
@@ -1447,7 +1447,7 @@
 				
 				/* get the scan flag from the queue. We need it to know whether
 				 * an update of symbols must be done or not */
-				scan_flag = (int)g_async_queue_try_pop (priv->scan_queue);
+				scan_flag = GPOINTER_TO_INT(g_async_queue_try_pop (priv->scan_queue));
 				real_file = g_async_queue_try_pop (priv->scan_queue);
 				
 				/* and now call the populating function */
@@ -1455,18 +1455,18 @@
 					scan_flag == DO_UPDATE_SYMS_AND_EXIT)
 				{
 					sdb_engine_populate_db_by_tags (dbe, priv->shared_mem_file,
-								(int)real_file == DONT_FAKE_UPDATE_SYMS ? NULL : real_file, 
+								(gsize)real_file == DONT_FAKE_UPDATE_SYMS ? NULL : real_file, 
 								TRUE);
 				}
 				else 
 				{
 					sdb_engine_populate_db_by_tags (dbe, priv->shared_mem_file,
-								(int)real_file == DONT_FAKE_UPDATE_SYMS ? NULL : real_file, 
+								(gsize)real_file == DONT_FAKE_UPDATE_SYMS ? NULL : real_file, 
 								FALSE);					
 				}
 				
 				/* don't forget to free the real_file, if it's a char */
-				if ((int)real_file != DONT_FAKE_UPDATE_SYMS)
+				if ((gsize)real_file != DONT_FAKE_UPDATE_SYMS)
 					g_free (real_file);
 				
 				/* check also if, together with an end file marker, we have an 
@@ -1492,39 +1492,39 @@
 					 * about out fresh new inserted/updated symbols...
 					 * Go on by emitting them.
 					 */
-					while ((tmp_inserted = (int)
-							g_async_queue_try_pop (priv->inserted_symbols_id)) > 0)
+					while ((tmp_inserted = GPOINTER_TO_INT(
+							g_async_queue_try_pop (priv->inserted_symbols_id))) > 0)
 					{
 						/* we must be sure to insert both signals at once */
 						g_async_queue_lock (priv->signals_queue);
 						
 						/* the +1 is because asyn_queue doesn't want NULL values */
 						g_async_queue_push_unlocked (priv->signals_queue, 
-													 (gpointer)(SYMBOL_INSERTED + 1));
+													 GINT_TO_POINTER(SYMBOL_INSERTED + 1));
 						g_async_queue_push_unlocked (priv->signals_queue, 
-													 (gpointer) tmp_inserted);
+													 GINT_TO_POINTER(tmp_inserted));
 						g_async_queue_unlock (priv->signals_queue);
 					}
 					
-					while ((tmp_updated = (int)
-							g_async_queue_try_pop (priv->updated_symbols_id)) > 0)
+					while ((tmp_updated = GPOINTER_TO_INT(
+							g_async_queue_try_pop (priv->updated_symbols_id))) > 0)
 					{
 						g_async_queue_lock (priv->signals_queue);
-						g_async_queue_push_unlocked (priv->signals_queue, (gpointer)
+						g_async_queue_push_unlocked (priv->signals_queue, GINT_TO_POINTER
 													 (SYMBOL_UPDATED + 1));
 						g_async_queue_push_unlocked (priv->signals_queue, 
-													 (gpointer) tmp_updated);
+													 GINT_TO_POINTER(tmp_updated));
 						g_async_queue_unlock (priv->signals_queue);
 					}
 
-					while ((tmp_updated = (int)
-							g_async_queue_try_pop (priv->updated_scope_symbols_id)) > 0)
+					while ((tmp_updated = GPOINTER_TO_INT(
+							g_async_queue_try_pop (priv->updated_scope_symbols_id))) > 0)
 					{
 						g_async_queue_lock (priv->signals_queue);
 						g_async_queue_push_unlocked (priv->signals_queue, (gpointer)
 													 (SYMBOL_SCOPE_UPDATED + 1));
 						g_async_queue_push_unlocked (priv->signals_queue, 
-													 (gpointer) tmp_updated);
+													GINT_TO_POINTER(tmp_updated));
 						g_async_queue_unlock (priv->signals_queue);
 					}
 					
@@ -1533,7 +1533,7 @@
 					 * determined by the caller. This is the only way.
 					 */
 					DEBUG_PRINT ("%s", "EMITTING scan-end");
-					g_async_queue_push (priv->signals_queue, (gpointer)(SCAN_END + 1));
+					g_async_queue_push (priv->signals_queue, GINT_TO_POINTER(SCAN_END + 1));
 				}
 				
 				/* truncate the file to 0 length */
@@ -1592,7 +1592,7 @@
 	{
 		gpointer tmp;
 		gpointer sign = NULL;
-		gint real_signal;
+		gsize real_signal;
 	
 		while ((sign = g_async_queue_try_pop (priv->signals_queue)) != NULL)  
 		{
@@ -1601,7 +1601,7 @@
 				return g_async_queue_length (priv->signals_queue) > 0 ? TRUE : FALSE;
 			}
 	
-			real_signal = (gint)sign -1;
+			real_signal = (gsize)sign -1;
 	
 			switch (real_signal) 
 			{
@@ -1612,8 +1612,8 @@
 				case SCAN_END:
 				{
 					/* get the process id from the queue */
-					gint tmp = (gint)g_async_queue_pop (priv->scan_process_id_queue);
-					g_signal_emit (dbe, signals[SCAN_END], 0, tmp);
+					gint int_tmp = GPOINTER_TO_INT(g_async_queue_pop (priv->scan_process_id_queue));
+					g_signal_emit (dbe, signals[SCAN_END], 0, int_tmp);
 				}
 					break;
 	
@@ -3437,7 +3437,7 @@
 	
 	/* add the current scan_process id into a queue */
 	g_async_queue_push (priv->scan_process_id_queue, 
-						(gpointer)priv->scan_process_id);
+						GINT_TO_POINTER(priv->scan_process_id));
 
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
@@ -4916,7 +4916,7 @@
 		MP_LEND_OBJ_INT (priv, value4);		
 		g_value_set_int (value4, file_position);
 
-		sym_list = g_tree_lookup (priv->file_symbols_cache, (gpointer)type_id);
+		sym_list = g_tree_lookup (priv->file_symbols_cache, GINT_TO_POINTER(type_id));
 		
 		symbol_id = sdb_engine_get_tuple_id_by_unique_name4 (dbe,
 								  PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY_EXT,
@@ -4940,8 +4940,8 @@
 			 * symbols we'll be ready to check the lists with more than an element:
 			 * those for sure will have an high probability for an updated scope.
 			 */
-			sym_list = g_list_prepend (sym_list, (gpointer) symbol_id);
-			g_tree_insert (priv->file_symbols_cache, (gpointer)type_id, 
+			sym_list = g_list_prepend (sym_list, GINT_TO_POINTER(symbol_id));
+			g_tree_insert (priv->file_symbols_cache, GINT_TO_POINTER(type_id), 
 							   sym_list);
 		}
 		
@@ -5123,7 +5123,7 @@
 		 	 * *not* calculated.
 		 	 * So add the symbol id into a queue that will be parsed once and emitted.
 		 	 */		
-			g_async_queue_push (priv->inserted_symbols_id, (gpointer) table_id);			
+			g_async_queue_push (priv->inserted_symbols_id, GINT_TO_POINTER(table_id));			
 		}
 		else
 		{
@@ -5136,7 +5136,7 @@
 		{
 			table_id = symbol_id;
 						
-			g_async_queue_push (priv->updated_symbols_id, (gpointer) table_id);
+			g_async_queue_push (priv->updated_symbols_id, GINT_TO_POINTER(table_id));
 		}
 		else 
 		{
@@ -5209,8 +5209,8 @@
 		tmp = g_value_get_int (val);
 	
 		DEBUG_PRINT ("%s", "EMITTING symbol-removed");
-		g_async_queue_push (priv->signals_queue, (gpointer)(SYMBOL_REMOVED + 1));
-		g_async_queue_push (priv->signals_queue, (gpointer)tmp);
+		g_async_queue_push (priv->signals_queue, GINT_TO_POINTER(SYMBOL_REMOVED + 1));
+		g_async_queue_push (priv->signals_queue, GINT_TO_POINTER(tmp));
 	}
 
 	g_object_unref (data_model);
@@ -5943,7 +5943,7 @@
 		buffer_mem_file = fdopen (buffer_mem_fd, "w+b");
 		
 		temp_buffer = g_ptr_array_index (text_buffers, i);
-		temp_size = (gint)g_ptr_array_index (buffer_sizes, i);
+		temp_size = GPOINTER_TO_INT(g_ptr_array_index (buffer_sizes, i));
 		
 		fwrite (temp_buffer, sizeof(gchar), temp_size, buffer_mem_file);
 		fflush (buffer_mem_file);

Modified: trunk/plugins/symbol-db/symbol-db-view-locals.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.c	Wed Dec 10 23:07:06 2008
@@ -91,7 +91,7 @@
 static gint
 gtree_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
 {
-	return (gint)a - (gint)b;
+	return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
 }
 
 static void
@@ -479,7 +479,7 @@
 
 	priv = dbvl->priv;
 
-	parent_id = (gint) key;
+	parent_id = GPOINTER_TO_INT(key);
 	/*DEBUG_PRINT ("traverse_on_scan_end (): something has been left on "
 				"waiting_for_tree.. checking for %d", parent_id);*/
 
@@ -883,7 +883,7 @@
 	/* consume a symbol */
 	if (queue_length > 0)
 	{
-		consumed_symbol_id = (gint) g_queue_pop_head (priv->symbols_inserted_ids);
+		consumed_symbol_id = GPOINTER_TO_INT(g_queue_pop_head (priv->symbols_inserted_ids));
 	}
 	else {
 		return FALSE;

Modified: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view.c	Wed Dec 10 23:07:06 2008
@@ -83,7 +83,7 @@
 static gint
 gtree_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
 {
-	return (gint)a - (gint)b;
+	return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
 }
 
 static void
@@ -1366,7 +1366,7 @@
 		return;
 	}
 	else {		
-		g_source_remove ((gint)node);
+		g_source_remove (GPOINTER_TO_INT(node));
 		g_tree_remove (priv->expanding_gfunc_ids, GINT_TO_POINTER (collapsed_symbol_id));
 	}	
 }



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