1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 Copyright (C) 2004 Naba Kumar
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <sys/types.h>
26 #include <gtk/gtktreeview.h>
27 #include <gtk/gtkliststore.h>
28 #include <libgnomevfs/gnome-vfs.h>
29 #include <libanjuta/anjuta-debug.h>
30 #include <libanjuta/anjuta-launcher.h>
31 #include <libanjuta/anjuta-utils.h>
33 #include "an_symbol_prefs.h"
34 #include "tm_tagmanager.h"
36 #define GLADE_FILE PACKAGE_DATA_DIR"/glade/anjuta-symbol-browser-plugin.glade"
37 #define ICON_FILE "anjuta-symbol-browser-plugin-48.png"
38 #define LOCAL_TAGS_SUBDIR "tags/"
39 #define SYSTEM_TAGS_CACHE "system-tags.cache"
40 #define SYMBOL_BROWSER_TAGS "symbol.browser.tags"
41 #define CREATE_GLOBAL_TAGS PACKAGE_DATA_DIR"/scripts/create_global_tags.sh"
52 update_system_tags (GList
*tags_files
)
56 output_file
= anjuta_util_get_user_cache_file_path (SYSTEM_TAGS_CACHE
, NULL
);
58 DEBUG_PRINT ("Recreating system tags cache: %s", output_file
);
60 if (!tm_workspace_merge_global_tags (output_file
, tags_files
))
62 g_warning ("Error while re-creating system tags cache");
66 tm_workspace_reload_global_tags(output_file
);
72 update_system_tags_only_add (const gchar
*tag_file
)
77 output_file
= anjuta_util_get_user_cache_file_path (SYSTEM_TAGS_CACHE
, NULL
);
79 DEBUG_PRINT ("Recreating system tags cache: %s", output_file
);
81 tags_files
= g_list_append (NULL
, output_file
);
82 tags_files
= g_list_append (tags_files
, (gpointer
) tag_file
);
83 if (!tm_workspace_merge_global_tags (output_file
, tags_files
))
85 g_warning ("Error while re-creating system tags cache");
88 tm_workspace_reload_global_tags(output_file
);
94 str_has_suffix (const char *haystack
, const char *needle
)
101 if (haystack
== NULL
) {
102 return needle
[0] == '\0';
105 /* Eat one character at a time. */
106 h
= haystack
+ strlen(haystack
);
107 n
= needle
+ strlen(needle
);
115 } while (*--h
== *--n
);
120 select_loaded_tags (GtkListStore
* store
, AnjutaPreferences
*prefs
)
123 gchar
*all_tags_path
;
124 gchar
**tags_paths
, **tags_path
;
125 GHashTable
*path_hash
;
127 all_tags_path
= anjuta_preferences_get (prefs
, SYMBOL_BROWSER_TAGS
);
128 if (all_tags_path
== NULL
)
131 tags_paths
= g_strsplit (all_tags_path
, ":", -1);
132 path_hash
= g_hash_table_new (g_str_hash
, g_str_equal
);
133 tags_path
= tags_paths
;
136 g_hash_table_insert (path_hash
, *tags_path
, *tags_path
);
140 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store
), &iter
))
146 gtk_tree_model_get (GTK_TREE_MODEL (store
), &iter
,
147 COLUMN_PATH
, &tag_path
,
149 if (g_hash_table_lookup (path_hash
, tag_path
))
150 gtk_list_store_set (store
, &iter
, COLUMN_LOAD
, TRUE
, -1);
152 gtk_list_store_set (store
, &iter
, COLUMN_LOAD
, FALSE
, -1);
155 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store
), &iter
));
157 g_hash_table_destroy (path_hash
);
158 g_strfreev (tags_paths
);
159 g_free (all_tags_path
);
162 static GtkListStore
*
163 create_store (AnjutaPreferences
*prefs
)
166 gchar
*local_tags_dir
;
167 GList
*tags_dirs
= NULL
;
171 store
= gtk_list_store_new (N_COLUMNS
, G_TYPE_BOOLEAN
, G_TYPE_STRING
,
174 local_tags_dir
= anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR
, NULL
);
175 tags_dirs
= g_list_prepend (tags_dirs
, local_tags_dir
);
177 /* Load the tags files */
182 struct dirent
*entry
;
183 const gchar
*dirname
;
185 dirname
= (const gchar
*)node
->data
;
186 node
= g_list_next (node
);
188 dir
= opendir (dirname
);
192 for (entry
= readdir (dir
); entry
!= NULL
; entry
= readdir (dir
))
194 if (str_has_suffix (entry
->d_name
, ".anjutatags.gz"))
200 tag_name
= g_strndup (entry
->d_name
,
201 strlen (entry
->d_name
) -
202 strlen (".anjutatags.gz"));
203 pathname
= g_build_filename (dirname
, entry
->d_name
, NULL
);
205 gtk_list_store_append (store
, &iter
);
206 gtk_list_store_set (store
, &iter
, COLUMN_LOAD
, FALSE
,
207 COLUMN_NAME
, tag_name
,
208 COLUMN_PATH
, pathname
, -1);
215 g_list_foreach (tags_dirs
, (GFunc
)g_free
, NULL
);
216 g_list_free (tags_dirs
);
218 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store
),
219 COLUMN_NAME
, GTK_SORT_ASCENDING
);
220 select_loaded_tags (store
, prefs
);
225 on_tag_load_toggled (GtkCellRendererToggle
*cell
, char *path_str
,
226 SymbolBrowserPlugin
*plugin
)
231 AnjutaPreferences
*prefs
;
233 GList
*enabled_paths
;
235 AnjutaStatus
*status
;
237 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
, NULL
);
238 store
= GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (plugin
->pref_tree_view
)));
239 prefs
= plugin
->prefs
;
241 anjuta_status_busy_push (status
);
243 path
= gtk_tree_path_new_from_string (path_str
);
244 gtk_tree_model_get_iter (GTK_TREE_MODEL (store
), &iter
, path
);
245 gtk_tree_model_get (GTK_TREE_MODEL (store
), &iter
,
246 COLUMN_LOAD
, &enabled
,
249 gtk_list_store_set (store
, &iter
, COLUMN_LOAD
, enabled
, -1);
250 gtk_tree_path_free (path
);
252 enabled_paths
= NULL
;
253 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store
), &iter
))
257 gtk_tree_model_get (GTK_TREE_MODEL (store
), &iter
,
258 COLUMN_LOAD
, &enabled
,
259 COLUMN_PATH
, &tag_path
,
262 enabled_paths
= g_list_prepend (enabled_paths
, tag_path
);
265 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store
), &iter
));
275 enabled_paths
= g_list_sort (enabled_paths
, (GCompareFunc
)strcmp
);
276 node
= enabled_paths
;
277 str
= g_string_new ("");
284 str
= g_string_append (str
, (const gchar
*) node
->data
);
288 str
= g_string_append (str
, ":");
289 str
= g_string_append (str
, (const gchar
*) node
->data
);
291 node
= g_list_next (node
);
294 /* Update preferences */
295 final_str
= g_string_free (str
, FALSE
);
296 anjuta_preferences_set (prefs
, SYMBOL_BROWSER_TAGS
, final_str
);
298 /* Update system tags cache */
301 update_system_tags_only_add (tag_path
);
305 update_system_tags (enabled_paths
);
311 /* Unset key and clear all tags */
312 anjuta_preferences_set (prefs
, SYMBOL_BROWSER_TAGS
, "");
314 g_list_foreach (enabled_paths
, (GFunc
)g_free
, NULL
);
315 g_list_free (enabled_paths
);
316 anjuta_status_busy_pop (status
);
320 on_add_directory_clicked (GtkWidget
*button
, GtkListStore
*store
)
323 GtkWidget
*fileselection
;
326 parent
= gtk_widget_get_toplevel (button
);
327 fileselection
= gtk_file_chooser_dialog_new (_("Select directory"),
329 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
,
335 if (gtk_dialog_run (GTK_DIALOG (fileselection
)) == GTK_RESPONSE_OK
)
339 /* Only local files since we can only create tags for local files */
340 dirs
= gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (fileselection
));
345 gchar
*dir
= node
->data
;
346 gtk_list_store_append (store
, &iter
);
347 gtk_list_store_set (store
, &iter
, 0, dir
, -1);
349 node
= g_slist_next (node
);
353 gtk_widget_destroy (fileselection
);
357 refresh_tags_list (SymbolBrowserPlugin
*plugin
)
359 GtkListStore
*new_tags_store
;
360 if (plugin
->pref_tree_view
)
362 new_tags_store
= create_store (plugin
->prefs
);
363 gtk_tree_view_set_model (GTK_TREE_VIEW (plugin
->pref_tree_view
),
364 GTK_TREE_MODEL (new_tags_store
));
365 g_object_unref (new_tags_store
);
370 on_create_tags_clicked (GtkButton
*widget
, SymbolBrowserPlugin
*plugin
)
372 GtkWidget
*treeview
, *button
, *dlg
, *name_entry
;
373 GtkCellRenderer
*renderer
;
374 GtkTreeViewColumn
*column
;
376 AnjutaPreferences
*pref
;
379 pref
= plugin
->prefs
;
380 gxml
= glade_xml_new (GLADE_FILE
, "create.symbol.tags.dialog", NULL
);
382 dlg
= glade_xml_get_widget (gxml
, "create.symbol.tags.dialog");
383 treeview
= glade_xml_get_widget (gxml
, "directory_list_treeview");
384 name_entry
= glade_xml_get_widget (gxml
, "symbol_tags_name_entry");
386 store
= gtk_list_store_new (1, G_TYPE_STRING
);
387 gtk_tree_view_set_model (GTK_TREE_VIEW (treeview
),
388 GTK_TREE_MODEL (store
));
390 /* Add the column for stock treeview */
391 renderer
= gtk_cell_renderer_text_new ();
392 column
= gtk_tree_view_column_new_with_attributes (_("Directories to scan"),
396 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview
), column
);
397 gtk_tree_view_column_set_sizing (column
, GTK_TREE_VIEW_COLUMN_AUTOSIZE
);
398 gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview
),
401 button
= glade_xml_get_widget (gxml
, "add_directory_button");
402 g_signal_connect (G_OBJECT (button
), "clicked",
403 G_CALLBACK (on_add_directory_clicked
), store
);
405 button
= glade_xml_get_widget (gxml
, "clear_list_button");
406 g_signal_connect_swapped (G_OBJECT (button
), "clicked",
407 G_CALLBACK (gtk_list_store_clear
), store
);
409 gtk_window_set_transient_for (GTK_WINDOW (dlg
), GTK_WINDOW (plugin
->prefs
));
410 while (gtk_dialog_run (GTK_DIALOG (dlg
)) == GTK_RESPONSE_OK
)
418 name
= gtk_entry_get_text (GTK_ENTRY (name_entry
));
420 argc
= gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store
),
423 if (name
== NULL
|| strlen (name
) <= 0 || argc
<= 3)
425 /* Validation failed */
428 edlg
= gtk_message_dialog_new (GTK_WINDOW (dlg
),
429 GTK_DIALOG_DESTROY_WITH_PARENT
,
432 _("Please enter a name and at least one directory."));
433 gtk_dialog_run (GTK_DIALOG (edlg
));
434 gtk_widget_destroy (edlg
);
438 argv
= g_new0 (gchar
*, argc
);
440 argv
[0] = g_strdup ("anjuta-tags");
444 tmp
= anjuta_util_get_user_cache_file_path ("tags", name
, NULL
);
445 argv
[1] = g_strconcat (tmp
, ".anjutatags", NULL
);
450 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store
), &iter
))
457 gtk_tree_model_get (GTK_TREE_MODEL (store
), &iter
,
460 files
= g_build_filename (dir
, "*.h", NULL
);
461 DEBUG_PRINT ("%d: Adding scan files '%s'", argc
, files
);
462 argv
[argc
++] = g_strconcat ("\"", files
, "\"", NULL
);
465 files
= g_build_filename (dir
, "*", "*.h", NULL
);
466 DEBUG_PRINT ("%d: Adding scan files '%s'", argc
, files
);
467 argv
[argc
++] = g_strconcat ("\"", files
, "\"", NULL
);
470 files
= g_build_filename (dir
, "*", "*", "*.h", NULL
);
471 DEBUG_PRINT ("%d: Adding scan files '%s'", argc
, files
);
472 argv
[argc
++] = g_strconcat ("\"", files
, "\"", NULL
);
477 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store
), &iter
));
480 /* Create local tags directory */
482 tmp
= anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR
, NULL
);
486 /* Execute anjuta-tags to create tags for the given files */
487 if ((pid
= fork()) == 0)
489 execvp (g_build_filename (PACKAGE_LIB_DIR
,
490 "anjuta-tags", NULL
), argv
);
491 perror ("Could not execute anjuta-tags");
493 waitpid (pid
, NULL
, 0);
495 /* Compress the tags file */
496 if ((pid
= fork()) == 0)
498 execlp ("gzip", "gzip", "-f", argv
[1], NULL
);
499 perror ("Could not execute gzip");
501 waitpid (pid
, NULL
, 0);
505 /* Refresh the tags list */
506 refresh_tags_list (plugin
);
509 g_object_unref (store
);
510 g_object_unref (gxml
);
511 gtk_widget_destroy (dlg
);
515 on_add_tags_clicked (GtkWidget
*button
, SymbolBrowserPlugin
*plugin
)
517 GtkWidget
*fileselection
;
519 GtkFileFilter
*filter
;
521 parent
= gtk_widget_get_toplevel (button
);
523 fileselection
= gtk_file_chooser_dialog_new (_("Select directory"),
525 GTK_FILE_CHOOSER_ACTION_OPEN
,
531 filter
= gtk_file_filter_new ();
532 gtk_file_filter_set_name (filter
, _("Anjuta tags files"));
533 gtk_file_filter_add_pattern (filter
, "*.anjutatags.gz");
534 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fileselection
), filter
);
536 if (gtk_dialog_run (GTK_DIALOG (fileselection
)) == GTK_RESPONSE_OK
)
542 uris
= gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (fileselection
));
552 basename
= g_path_get_basename (src
);
553 dest
= anjuta_util_get_user_cache_file_path ("tags", basename
, NULL
);
557 /* Copy the tags file in local tags directory */
558 GnomeVFSURI
* source_uri
= gnome_vfs_uri_new(src
);
559 GnomeVFSURI
* dest_uri
= gnome_vfs_uri_new(dest
);
561 GnomeVFSResult error
= gnome_vfs_xfer_uri (source_uri
,
563 GNOME_VFS_XFER_DEFAULT
,
564 GNOME_VFS_XFER_ERROR_MODE_ABORT
,
565 GNOME_VFS_XFER_OVERWRITE_MODE_ABORT
,
568 if (error
!= GNOME_VFS_OK
)
572 err
= gnome_vfs_result_to_string (error
);
573 anjuta_util_dialog_error (GTK_WINDOW (fileselection
),
574 "Adding tags file '%s' failed: %s",
577 gnome_vfs_uri_unref (source_uri
);
578 gnome_vfs_uri_unref (dest_uri
);
581 node
= g_slist_next (node
);
585 refresh_tags_list (plugin
);
589 gtk_widget_destroy (fileselection
);
593 on_remove_tags_clicked (GtkWidget
*button
, SymbolBrowserPlugin
*plugin
)
596 GtkTreeSelection
*sel
;
600 parent
= gtk_widget_get_toplevel (button
);
601 sel
= gtk_tree_view_get_selection (GTK_TREE_VIEW (plugin
->pref_tree_view
));
602 if (gtk_tree_selection_get_selected (sel
, &model
, &iter
))
604 gchar
*tags_filename
;
605 gtk_tree_model_get (model
, &iter
, 1, &tags_filename
, -1);
608 gchar
*file_path
, *path
;
609 path
= anjuta_util_get_user_cache_file_path ("tags", tags_filename
, NULL
);
610 file_path
= g_strconcat (path
, ".anjutatags.gz", NULL
);
612 if (!g_file_test (file_path
, G_FILE_TEST_EXISTS
))
614 anjuta_util_dialog_error (GTK_WINDOW (parent
),
615 "Can not remove tags file '%s': "
616 "You can only remove tags you created or added",
619 else if (anjuta_util_dialog_boolean_question (GTK_WINDOW (parent
),
620 "Are you sure you want to remove the tags file '%s'?",
624 refresh_tags_list (plugin
);
628 g_free (tags_filename
);
634 on_message (AnjutaLauncher
*launcher
,
635 AnjutaLauncherOutputType output_type
,
636 const gchar
* mesg
, gpointer user_data
)
638 AnjutaStatus
*status
;
639 gchar
**lines
, **line
;
640 SymbolBrowserPlugin
* plugin
= ANJUTA_PLUGIN_SYMBOL_BROWSER (user_data
);
642 lines
= g_strsplit (mesg
, "\n", -1);
646 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
, NULL
);
654 if (sscanf (*line
, "Scanning %d packages", &packages_count
) == 1)
655 anjuta_status_progress_add_ticks (status
, packages_count
+ 1);
656 else if ((pos
= strstr (*line
, ".anjutatags.gz")))
658 const gchar
*package_name
;
660 /* Get the name of the package */
662 package_name
= g_strrstr (*line
, "/");
667 status_mesg
= g_strdup_printf (_("Scanning package: %s"),
669 anjuta_status_progress_tick (status
, NULL
, status_mesg
);
670 g_free (status_mesg
);
673 anjuta_status_progress_tick (status
, NULL
, *line
);
681 on_system_tags_update_finished (AnjutaLauncher
*launcher
, gint child_pid
,
682 gint status
, gulong time_taken
,
683 SymbolBrowserPlugin
*plugin
)
685 AnjutaStatus
*statusbar
;
686 GList
*enabled_paths
= NULL
;
687 gchar
*all_tags_path
;
688 gchar
**tags_paths
, **tags_path
;
690 all_tags_path
= anjuta_preferences_get (plugin
->prefs
,
691 SYMBOL_BROWSER_TAGS
);
694 tags_paths
= g_strsplit (all_tags_path
, ":", -1);
695 tags_path
= tags_paths
;
698 enabled_paths
= g_list_prepend (enabled_paths
,
699 g_strdup (*tags_path
));
702 g_free (all_tags_path
);
703 g_strfreev (tags_paths
);
704 enabled_paths
= g_list_reverse (enabled_paths
);
707 /* Refresh the list */
708 refresh_tags_list(plugin
);
710 /* Regenerate system-tags.cache */
713 update_system_tags (enabled_paths
);
714 g_list_foreach (enabled_paths
, (GFunc
)g_free
, NULL
);
715 g_list_free (enabled_paths
);
718 g_object_unref (plugin
->launcher
);
719 plugin
->launcher
= NULL
;
720 statusbar
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
, NULL
);
721 anjuta_status_progress_tick (statusbar
, NULL
,
722 _("Completed system tags generation"));
726 on_update_global_clicked (GtkWidget
*button
, SymbolBrowserPlugin
*plugin
)
731 if (plugin
->launcher
)
732 return; /* Already running */
734 /* Create local tags directory */
735 tmp
= anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR
,NULL
);
738 plugin
->launcher
= anjuta_launcher_new ();
739 g_signal_connect (G_OBJECT (plugin
->launcher
), "child-exited",
740 G_CALLBACK (on_system_tags_update_finished
), plugin
);
741 anjuta_launcher_set_buffered_output (plugin
->launcher
, TRUE
);
742 anjuta_launcher_execute (plugin
->launcher
, CREATE_GLOBAL_TAGS
,
747 prefs_page_init (SymbolBrowserPlugin
*plugin
)
749 GtkWidget
*treeview
, *button
;
750 GtkCellRenderer
*renderer
;
751 GtkTreeViewColumn
*column
;
753 AnjutaPreferences
*pref
= plugin
->prefs
;
754 GladeXML
*gxml
= glade_xml_new (GLADE_FILE
, NULL
, NULL
);
756 anjuta_preferences_add_page (pref
, gxml
, "Symbol Browser",
757 _("Symbol Browser"), ICON_FILE
);
758 treeview
= glade_xml_get_widget (gxml
, "tags_treeview");
760 store
= create_store (pref
);
761 gtk_tree_view_set_model (GTK_TREE_VIEW (treeview
),
762 GTK_TREE_MODEL (store
));
764 /* Add the column for stock treeview */
765 renderer
= gtk_cell_renderer_toggle_new ();
766 g_signal_connect (G_OBJECT (renderer
), "toggled",
767 G_CALLBACK (on_tag_load_toggled
), plugin
);
768 column
= gtk_tree_view_column_new_with_attributes (_("Load"),
773 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview
), column
);
775 renderer
= gtk_cell_renderer_text_new ();
776 column
= gtk_tree_view_column_new_with_attributes (_("API Tags"),
780 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview
), column
);
781 gtk_tree_view_column_set_sizing (column
, GTK_TREE_VIEW_COLUMN_AUTOSIZE
);
782 gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview
),
785 button
= glade_xml_get_widget (gxml
, "create_tags_button");
786 g_signal_connect (G_OBJECT (button
), "clicked",
787 G_CALLBACK (on_create_tags_clicked
), plugin
);
789 button
= glade_xml_get_widget (gxml
, "add_tags_button");
790 g_signal_connect (G_OBJECT (button
), "clicked",
791 G_CALLBACK (on_add_tags_clicked
), plugin
);
793 button
= glade_xml_get_widget (gxml
, "remove_tags_button");
794 g_signal_connect (G_OBJECT (button
), "clicked",
795 G_CALLBACK (on_remove_tags_clicked
), plugin
);
797 button
= glade_xml_get_widget (gxml
, "update_tags_button");
798 g_signal_connect (G_OBJECT (button
), "clicked",
799 G_CALLBACK (on_update_global_clicked
), plugin
);
802 g_object_unref (store
);
803 g_object_unref (gxml
);
808 on_gconf_notify_tags_list_changed (GConfClient
*gclient
, guint cnxn_id
,
809 GConfEntry
*entry
, gpointer user_data
)
812 SymbolBrowserPlugin
*plugin
= ANJUTA_PLUGIN_SYMBOL_BROWSER (user_data
);
814 if (plugin
->pref_tree_view
)
816 store
= GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (plugin
->pref_tree_view
)));
817 select_loaded_tags (store
, plugin
->prefs
);
822 symbol_browser_prefs_init (SymbolBrowserPlugin
*plugin
)
825 plugin
->pref_tree_view
= prefs_page_init (plugin
);
826 g_object_add_weak_pointer (G_OBJECT (plugin
->pref_tree_view
),
827 (gpointer
)&plugin
->pref_tree_view
);
828 plugin
->gconf_notify_ids
= NULL
;
829 notify_id
= anjuta_preferences_notify_add (plugin
->prefs
,
831 on_gconf_notify_tags_list_changed
,
833 plugin
->gconf_notify_ids
= g_list_prepend (plugin
->gconf_notify_ids
,
834 GUINT_TO_POINTER (notify_id
));
838 symbol_browser_prefs_finalize (SymbolBrowserPlugin
*plugin
)
841 node
= plugin
->gconf_notify_ids
;
844 anjuta_preferences_notify_remove (plugin
->prefs
,
845 GPOINTER_TO_UINT (node
->data
));
846 node
= g_list_next (node
);
848 g_list_free (plugin
->gconf_notify_ids
);
849 plugin
->gconf_notify_ids
= NULL
;
851 anjuta_preferences_remove_page(plugin
->prefs
, _("Symbol Browser"));
855 symbol_browser_prefs_create_global_tags (gpointer user_data
)
857 SymbolBrowserPlugin
*plugin
= ANJUTA_PLUGIN_SYMBOL_BROWSER (user_data
);
858 on_update_global_clicked (NULL
, plugin
);
859 return FALSE
; /* Stop g_idle */
863 symbol_browser_load_global_tags (gpointer plugin
)
865 gchar
*system_tags_path
;
866 /* Load gloabal tags on gtk idle */
867 system_tags_path
= anjuta_util_get_user_cache_file_path (SYSTEM_TAGS_CACHE
,NULL
);
868 if (!tm_workspace_load_global_tags (system_tags_path
))
870 g_message ("Added idle loop to create global tags");
871 g_idle_add((GSourceFunc
) symbol_browser_prefs_create_global_tags
,
874 g_free (system_tags_path
);