Commit 2f474c4f authored by Johannes Schmid's avatar Johannes Schmid Committed by Johannes Schmid

Get the file path from the file-chooser instead of the ui

2008-07-09  Johannes Schmid  <jhs@gnome.org>

	* libanjuta/anjuta-preferences.c (get_property_value_as_string):
	Get the file path from the file-chooser instead of the ui
	
	* plugins/symbol-db/anjuta-symbol-db.glade:
	* plugins/symbol-db/plugin.c (symbol_db_activate):
	* plugins/symbol-db/symbol-db-engine.c (sdb_engine_scan_files_1),
	(symbol_db_engine_new):
	* plugins/symbol-db/symbol-db-engine.h:
	Fixed symbol-db prefs
	
	* scripts/glade2schema.pl:
	Support for \"folder\" and \"file\" preferences
	
	* configure.in: Require latest libgda-4.0

svn path=/trunk/; revision=4072
parent 33e87a1f
2008-07-09 Johannes Schmid <jhs@gnome.org>
* libanjuta/anjuta-preferences.c (get_property_value_as_string):
Get the file path from the file-chooser instead of the ui
* plugins/symbol-db/anjuta-symbol-db.glade:
* plugins/symbol-db/plugin.c (symbol_db_activate):
* plugins/symbol-db/symbol-db-engine.c (sdb_engine_scan_files_1),
(symbol_db_engine_new):
* plugins/symbol-db/symbol-db-engine.h:
Fixed symbol-db prefs
* scripts/glade2schema.pl:
Support for "folder" and "file" preferences
* configure.in: Require latest libgda-4.0
2008-07-07 Massimo Cora' <maxcvs@email.it>
* libanjuta/interfaces/libanjuta.idl:
......@@ -51,7 +51,7 @@ GTKSOURCEVIEW_GNOME_REQUIRED=2.14
GTKSOURCEVIEW_GTK_REQUIRED=2.10
BINUTILS_REQUIRED=2.15.92
LIBWNCK_REQUIRED=2.12
GDA_REQUIRED=3.99.1
GDA_REQUIRED=3.99.3
dnl LIBGTODO_REQUIRED=0.15
......
......@@ -621,10 +621,7 @@ get_property_value_as_string (AnjutaProperty *prop)
}
break;
case ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER:
uri = gtk_file_chooser_get_uri (
GTK_FILE_CHOOSER (prop->object));
text_value = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
text_value = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (prop->object));
break;
case ANJUTA_PROPERTY_OBJECT_TYPE_FILE:
text_value = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prop->object));
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.4 on Mon Jul 7 23:02:54 2008 -->
<?xml version="1.0"?>
<glade-interface>
<requires-version lib="gtk+" version="2.12"/>
<widget class="GtkWindow" id="symbol_db_pref_window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
......@@ -37,12 +36,12 @@
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="preferences_folder:text:/:0:symboldb.root">
<widget class="GtkFileChooserButton" id="preferences_file:text:/usr/bin/ctags:0:symboldb.ctags">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="preview_widget_active">False</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Choose Ctags executable</property>
<property name="preview_widget_active">False</property>
<property name="title" translatable="yes">Choose ctags executable</property>
</widget>
<packing>
<property name="padding">5</property>
......@@ -81,73 +80,23 @@
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="top_padding">2</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkHBox" id="hbox2">
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<widget class="GtkTreeView" id="tags_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkTreeView" id="tags_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</widget>
</child>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkVButtonBox" id="vbuttonbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">button</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">button</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">button</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
......
......@@ -53,8 +53,6 @@
#define TIMEOUT_INTERVAL_SYMBOLS_UPDATE 10000
#define TIMEOUT_SECONDS_AFTER_LAST_TIP 5
#define CTAGS_PREFS_KEY "ctags.executable"
#define CTAGS_PATH "/usr/bin/ctags"
#define CHOOSER_WIDGET "preferences_folder:text:/:0:symboldb.root"
#define PROJECT_GLOBALS "/"
......@@ -1233,10 +1231,10 @@ symbol_db_activate (AnjutaPlugin *plugin)
/* symbol_db->engine_mutex = g_mutex_new ();*/
/* create SymbolDBEngine(s) */
symbol_db->sdbe_project = symbol_db_engine_new ();
symbol_db->sdbe_project = symbol_db_engine_new (plugin);
/* the globals one too */
symbol_db->sdbe_globals = symbol_db_engine_new ();
symbol_db->sdbe_globals = symbol_db_engine_new (plugin);
/* open it */
anjuta_cache_path = anjuta_util_get_user_cache_file_path (".");
symbol_db_engine_open_db (symbol_db->sdbe_globals,
......@@ -1377,10 +1375,7 @@ symbol_db_activate (AnjutaPlugin *plugin)
/* Determine session state */
g_signal_connect (plugin->shell, "load_session",
G_CALLBACK (on_session_load), plugin);
/* FIXME: get path from preferences */
anjuta_util_prog_is_installed ("ctags", TRUE);
return TRUE;
}
......
......@@ -130,15 +130,14 @@ select symbol_id_base, symbol.name from heritage
#define SHARED_MEMORY_PREFIX "/dev/shm"
// FIXME: detect it by prefs
#define CTAGS_PATH "/usr/bin/ctags"
#define THREADS_MONITOR_TIMEOUT 10
#define THREADS_MAX_CONCURRENT 15
#define TRIGGER_SIGNALS_DELAY 100
#define TRIGGER_MAX_CLOSURE_RETRIES 50
#define THREAD_MAX_CLOSURE_RETRIES 20
#define CTAGS_PREFS_KEY "symboldb.ctags"
enum {
DO_UPDATE_SYMS = 1,
DO_UPDATE_SYMS_AND_EXIT,
......@@ -274,6 +273,8 @@ static unsigned int signals[LAST_SIGNAL] = { 0 };
struct _SymbolDBEnginePriv
{
AnjutaPlugin* plugin;
GdaConnection *db_connection;
GdaSqlParser *sql_parser;
gchar *db_directory;
......@@ -1494,6 +1495,8 @@ sdb_engine_scan_files_1 (SymbolDBEngine * dbe, const GPtrArray * files_list,
{
SymbolDBEnginePriv *priv;
gint i;
gchar* ctags_path;
AnjutaPreferences* prefs;
g_return_val_if_fail (dbe != NULL, FALSE);
g_return_val_if_fail (files_list != NULL, FALSE);
......@@ -1502,8 +1505,14 @@ sdb_engine_scan_files_1 (SymbolDBEngine * dbe, const GPtrArray * files_list,
return FALSE;
/* Check if ctags is really installed */
if (!anjuta_util_prog_is_installed (CTAGS_PATH, TRUE))
prefs = anjuta_shell_get_preferences (dbe->priv->plugin->shell,
NULL);
ctags_path = anjuta_preferences_get (prefs, CTAGS_PREFS_KEY);
if (!anjuta_util_prog_is_installed (ctags_path, TRUE))
{
g_free (ctags_path);
return FALSE;
}
/* start process in server mode */
priv = dbe->priv;
......@@ -1511,6 +1520,7 @@ sdb_engine_scan_files_1 (SymbolDBEngine * dbe, const GPtrArray * files_list,
if (real_files_list != NULL && (files_list->len != real_files_list->len))
{
g_warning ("no matched size between real_files_list and files_list");
g_free (ctags_path);
return FALSE;
}
......@@ -1530,13 +1540,14 @@ sdb_engine_scan_files_1 (SymbolDBEngine * dbe, const GPtrArray * files_list,
exe_string = g_strdup_printf ("%s --fields=afmiKlnsStz --c++-kinds=+p "
"--filter=yes --filter-terminator='"CTAGS_MARKER"'",
CTAGS_PATH);
ctags_path);
anjuta_launcher_execute (priv->ctags_launcher,
exe_string, sdb_engine_ctags_output_callback_1,
dbe);
g_free (exe_string);
}
g_free (ctags_path);
/* what about the scan_queue? is it initialized? It will contain mainly
* ints that refers to the force_update status.
......@@ -2257,7 +2268,7 @@ sdb_engine_get_type (void)
}
SymbolDBEngine *
symbol_db_engine_new (void)
symbol_db_engine_new (AnjutaPlugin* plugin)
{
SymbolDBEngine *sdbe;
SymbolDBEnginePriv *priv;
......@@ -2266,6 +2277,7 @@ symbol_db_engine_new (void)
priv = sdbe->priv;
priv->mutex = g_mutex_new ();
priv->plugin = plugin;
return sdbe;
}
......
......@@ -28,6 +28,7 @@
#include <glib-object.h>
#include <glib.h>
#include <libanjuta/interfaces/ianjuta-symbol.h>
#include <libanjuta/anjuta-plugin.h>
#include "symbol-db-engine-iterator.h"
G_BEGIN_DECLS
......@@ -82,7 +83,7 @@ typedef enum {
GType sdb_engine_get_type (void) G_GNUC_CONST;
SymbolDBEngine* symbol_db_engine_new (void);
SymbolDBEngine* symbol_db_engine_new (AnjutaPlugin* plugin);
/**
......
......@@ -9,7 +9,9 @@ use XML::Parser;
"text" => "string",
"float" => "float",
"color" => "string",
"font" => "string"
"font" => "string",
"folder" => "string",
"file" => "string"
);
%boolean = (
......@@ -34,7 +36,7 @@ sub StartTag {
my $key = shift;
if ($key =~ /widget/) {
my $k = $_{"id"};
if ($k =~ /(preferences_color|entry|font|spin|text|toggle|menu):(.*):(.*):(\d):(.*)/) {
if ($k =~ /(preferences_color|entry|font|spin|text|toggle|menu|folder|file):(.*):(.*):(\d):(.*)/) {
my $type = $2;
my $default = $3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment