anjuta r3445 - in trunk: . libanjuta plugins/document-manager plugins/search
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r3445 - in trunk: . libanjuta plugins/document-manager plugins/search
- Date: Thu, 10 Jan 2008 13:20:34 +0000 (GMT)
Author: jhs
Date: Thu Jan 10 13:20:34 2008
New Revision: 3445
URL: http://svn.gnome.org/viewvc/anjuta?rev=3445&view=rev
Log:
2008-01-10 Johannes Schmid <jhs gnome org>
Patch from Tom <tpgww onepost net>:
* libanjuta/anjuta-utils.c: (anjuta_util_get_real_path),
(anjuta_util_glist_path_dedup):
* libanjuta/anjuta-utils.h:
Give the method a proper prefixed name
* plugins/document-manager/action-callbacks.c:
(get_current_popup_active),
(on_editor_command_select_all_activate),
(on_editor_command_cut_activate),
(on_editor_command_paste_activate),
(on_editor_command_copy_activate),
(on_editor_command_clear_activate), (on_show_search),
(on_repeat_quicksearch):
* plugins/document-manager/action-callbacks.h:
* plugins/document-manager/anjuta-docman.c:
(anjuta_docman_add_editor), (anjuta_docman_get_current_popup),
(anjuta_docman_goto_file_line_mark),
(anjuta_docman_get_full_filename):
* plugins/document-manager/anjuta-docman.h:
* plugins/document-manager/anjuta-document-manager.ui:
* plugins/document-manager/plugin.c:
(update_document_ui_interface_items):
Better way to fix the popup-menu items (Cut/Copy/Paste)
and various clean-ups.
* plugins/document-manager/search-box.c: (on_document_changed),
(search_box_fill_search_focus):
* plugins/document-manager/search-box.h:
* plugins/search/plugin.c:
Add a menu item to repeat the quick search
Modified:
trunk/ChangeLog
trunk/libanjuta/anjuta-utils.c
trunk/libanjuta/anjuta-utils.h
trunk/plugins/document-manager/action-callbacks.c
trunk/plugins/document-manager/action-callbacks.h
trunk/plugins/document-manager/anjuta-docman.c
trunk/plugins/document-manager/anjuta-docman.h
trunk/plugins/document-manager/anjuta-document-manager.ui
trunk/plugins/document-manager/plugin.c
trunk/plugins/document-manager/search-box.c
trunk/plugins/document-manager/search-box.h
trunk/plugins/search/plugin.c
Modified: trunk/libanjuta/anjuta-utils.c
==============================================================================
--- trunk/libanjuta/anjuta-utils.c (original)
+++ trunk/libanjuta/anjuta-utils.c Thu Jan 10 13:20:34 2008
@@ -591,18 +591,28 @@
return new_list;
}
-static gchar*
-get_real_path(const gchar *file_name)
+gchar*
+anjuta_util_get_real_path (const gchar *path)
{
- if (file_name)
+ if (path != NULL)
{
- gchar path[PATH_MAX+1];
- memset(path, '\0', PATH_MAX+1);
- realpath(file_name, path);
- return g_strdup(path);
+#ifdef PATH_MAX
+ gchar *result;
+ gchar buf[PATH_MAX+1];
+
+ result = realpath (path, buf);
+ if (result != NULL)
+ {
+ *(buf + PATH_MAX) = '\0'; /* ensure a terminator */
+ return g_strdup (buf);
+ }
+#else
+ /* strictly, the string returned from this should be cleaned with
+ free(), not g_free() */
+ return (realpath (path, NULL));
+#endif
}
- else
- return NULL;
+ return NULL;
}
/* Dedup a list of paths - duplicates are removed from the tail.
@@ -615,24 +625,27 @@
struct stat s;
for (tmp = list; tmp; tmp = g_list_next(tmp))
{
- path = get_real_path((const gchar *) tmp->data);
- if (0 != stat(path, &s))
- {
- g_free(path);
- }
- else
+ path = anjuta_util_get_real_path ((const gchar *) tmp->data);
+ if (path)
{
- for (tmp1 = nlist; tmp1; tmp1 = g_list_next(tmp1))
+ if (stat (path, &s) != 0)
+ {
+ g_free(path);
+ }
+ else
{
- if (0 == strcmp((const char *) tmp1->data, path))
+ for (tmp1 = nlist; tmp1; tmp1 = g_list_next(tmp1))
{
- g_free(path);
- path = NULL;
- break;
+ if (0 == strcmp((const char *) tmp1->data, path))
+ {
+ g_free(path);
+ path = NULL;
+ break;
+ }
}
+ if (path)
+ nlist = g_list_prepend(nlist, path);
}
- if (path)
- nlist = g_list_prepend(nlist, path);
}
}
anjuta_util_glist_strings_free(list);
Modified: trunk/libanjuta/anjuta-utils.h
==============================================================================
--- trunk/libanjuta/anjuta-utils.h (original)
+++ trunk/libanjuta/anjuta-utils.h Thu Jan 10 13:20:34 2008
@@ -108,6 +108,7 @@
gchar* anjuta_util_escape_quotes(const gchar* str);
gboolean anjuta_util_path_has_extension (const gchar *path, const gchar *ext);
+gchar* anjuta_util_get_real_path (const gchar *path);
gchar* anjuta_util_get_uri_mime_type (const gchar *uri);
Modified: trunk/plugins/document-manager/action-callbacks.c
==============================================================================
--- trunk/plugins/document-manager/action-callbacks.c (original)
+++ trunk/plugins/document-manager/action-callbacks.c Thu Jan 10 13:20:34 2008
@@ -71,6 +71,25 @@
return anjuta_docman_get_current_focus_widget (docman);
}
+static gboolean
+get_current_popup_active (gpointer user_data)
+{
+ GtkWidget *widget;
+ AnjutaDocman *docman;
+ DocmanPlugin *plugin;
+ plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
+ docman = ANJUTA_DOCMAN (plugin->docman);
+
+ widget = anjuta_docman_get_current_popup (docman);
+ if (widget)
+ {
+ widget = gtk_widget_get_toplevel (widget);
+ if (GTK_WIDGET_TOPLEVEL (widget))
+ return gtk_window_has_toplevel_focus (GTK_WINDOW (widget));
+ }
+ return FALSE;
+}
+
void
on_open_activate (GtkAction *action, gpointer user_data)
{
@@ -394,21 +413,20 @@
widget = get_current_focus_widget (user_data);
- if (widget)
+/* if (widget && GTK_IS_EDITABLE (widget))
{
- if (GTK_IS_EDITABLE (widget))
- {
- gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
- }
- else
- {
- IAnjutaDocument *doc;
+ gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
+ }
+ else */
+ if (widget /* editor text is focused */
+ || get_current_popup_active (user_data))
+ {
+ IAnjutaDocument *doc;
- doc = get_current_document (user_data);
- if (doc)
- ianjuta_editor_selection_select_all
- (IANJUTA_EDITOR_SELECTION (doc), NULL);
- }
+ doc = get_current_document (user_data);
+ if (doc)
+ ianjuta_editor_selection_select_all
+ (IANJUTA_EDITOR_SELECTION (doc), NULL);
}
}
@@ -466,64 +484,69 @@
on_editor_command_cut_activate (GtkAction *action, gpointer user_data)
{
GtkWidget *widget;
- IAnjutaDocument *doc;
-
+
widget = get_current_focus_widget (user_data);
- if (widget)
+/* if (widget && GTK_IS_EDITABLE (widget))
{
- if (GTK_IS_EDITABLE (widget))
- {
- gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
- return;
- }
+ gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
+ }
+ else */
+ if (widget /* editor text is focused */
+ || get_current_popup_active (user_data))
+ {
+ IAnjutaDocument *doc;
+
+ doc = get_current_document (user_data);
+ if (doc)
+ ianjuta_document_cut (doc, NULL);
}
- doc = get_current_document (user_data);
- if (doc)
- ianjuta_document_cut (doc, NULL);
}
void
on_editor_command_paste_activate (GtkAction *action, gpointer user_data)
{
GtkWidget *widget;
- IAnjutaDocument *doc;
-
+
widget = get_current_focus_widget (user_data);
- if (widget)
+/* if (widget && GTK_IS_EDITABLE (widget))
{
- if (GTK_IS_EDITABLE (widget))
- {
- gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
- return;
- }
+ gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
+ }
+ else */
+ if (widget /* editor text is focused */
+ || get_current_popup_active (user_data))
+ {
+ IAnjutaDocument *doc;
+
+ doc = get_current_document (user_data);
+ if (doc)
+ ianjuta_document_paste (doc, NULL);
}
- doc = get_current_document (user_data);
- if (doc)
- ianjuta_document_paste (doc, NULL);
}
void
on_editor_command_copy_activate (GtkAction *action, gpointer user_data)
{
GtkWidget *widget;
- IAnjutaDocument *doc;
widget = get_current_focus_widget (user_data);
- if (widget)
+/* if (widget && GTK_IS_EDITABLE (widget))
{
- if (GTK_IS_EDITABLE (widget))
- {
- gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
- return;
- }
+ gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
+ }
+ else */
+ if (widget /* editor text is focused */
+ || get_current_popup_active (user_data))
+ {
+ IAnjutaDocument *doc;
+
+ doc = get_current_document (user_data);
+ if (doc)
+ ianjuta_document_copy (doc, NULL);
}
-
- doc = get_current_document (user_data);
- if (doc)
- ianjuta_document_copy (doc, NULL);
}
void
@@ -532,25 +555,27 @@
GtkWidget *widget;
widget = get_current_focus_widget (user_data);
- IAnjutaDocument *doc;
-
- if (widget)
+
+/* if (widget && GTK_IS_EDITABLE (widget))
{
- if (GTK_IS_EDITABLE (widget))
+ gint start, end;
+ if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end))
{
- gint start, end;
- if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end))
- {
- start = gtk_editable_get_position (GTK_EDITABLE (widget));
- end = start + 1;
- }
- gtk_editable_delete_text (GTK_EDITABLE (widget), start, end);
- return;
+ start = gtk_editable_get_position (GTK_EDITABLE (widget));
+ end = start + 1;
}
+ gtk_editable_delete_text (GTK_EDITABLE (widget), start, end);
+ }
+ else */
+ if (widget /* editor text is focused */
+ || get_current_popup_active (user_data))
+ {
+ IAnjutaDocument *doc;
+
+ doc = get_current_document (user_data);
+ if (doc)
+ ianjuta_document_clear (doc, NULL);
}
- doc = get_current_document (user_data);
- if (doc)
- ianjuta_document_clear (doc, NULL);
}
/* fold funcs are for scintilla only */
@@ -993,16 +1018,33 @@
on_show_search (GtkAction *action, gpointer user_data)
{
DocmanPlugin *plugin;
-
+ GtkWidget *search_box;
+
plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
-
- if (!gtk_widget_get_parent (plugin->search_box))
- {
- gtk_box_pack_end (GTK_BOX(plugin->vbox), plugin->search_box, FALSE, FALSE, 0);
- }
- gtk_widget_show (plugin->search_box);
- search_box_grab_search_focus (SEARCH_BOX (plugin->search_box));
+ search_box = plugin->search_box;
+ if (!gtk_widget_get_parent (search_box))
+ gtk_box_pack_end (GTK_BOX (plugin->vbox), search_box, FALSE, FALSE, 0);
+
+ search_box_fill_search_focus (SEARCH_BOX (search_box));
+ gtk_widget_show (search_box);
+}
+
+void
+on_repeat_quicksearch (GtkAction *action, gpointer user_data)
+{
+ DocmanPlugin *plugin;
+ GtkWidget *search_box;
+
+ plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
+
+ search_box = plugin->search_box;
+ if (!gtk_widget_get_parent (search_box))
+ gtk_box_pack_end (GTK_BOX (plugin->vbox), search_box, FALSE, FALSE, 0);
+
+ if (!GTK_WIDGET_VISIBLE (search_box))
+ gtk_widget_show (search_box);
+ on_search_activated (NULL, SEARCH_BOX (search_box));
}
void
Modified: trunk/plugins/document-manager/action-callbacks.h
==============================================================================
--- trunk/plugins/document-manager/action-callbacks.h (original)
+++ trunk/plugins/document-manager/action-callbacks.h Thu Jan 10 13:20:34 2008
@@ -99,5 +99,6 @@
void on_editor_remove_view_activate (GtkAction *action, gpointer user_data);
void on_show_search (GtkAction *action, gpointer user_data);
+void on_repeat_quicksearch (GtkAction *action, gpointer user_data);
#endif
Modified: trunk/plugins/document-manager/anjuta-docman.c
==============================================================================
--- trunk/plugins/document-manager/anjuta-docman.c (original)
+++ trunk/plugins/document-manager/anjuta-docman.c Thu Jan 10 13:20:34 2008
@@ -778,35 +778,87 @@
anjuta_docman_page_destroy (page);
}
+/**
+ * anjuta_docman_add_editor:
+ * @docman: pointer to docman data struct
+ * @uri: string with uri of file to edit, may be "" or NULL
+ * @name: string with name of file to edit, may be absolute path or just a basename or "" or NULL
+ *
+ * Add a new editor, working on specified uri or filename if any
+ *
+ * Return value: the editor
+ */
IAnjutaEditor *
anjuta_docman_add_editor (AnjutaDocman *docman, const gchar *uri,
const gchar *name)
{
+ gchar *freeme;
+ const gchar *_uri, *_name;
IAnjutaEditor *te;
IAnjutaEditorFactory* factory;
+ freeme = NULL;
factory = anjuta_shell_get_interface (docman->shell, IAnjutaEditorFactory, NULL);
-
- if (name && uri)
- te = ianjuta_editor_factory_new_editor(factory,
- uri, name, NULL);
- else if (uri)
- te = ianjuta_editor_factory_new_editor(factory,
- uri, "", NULL);
- else if (name)
- te = ianjuta_editor_factory_new_editor(factory,
- "", name, NULL);
- else
- te = ianjuta_editor_factory_new_editor(factory,
- "", "", NULL);
-
- /* File cannot be loaded, texteditor brings up an error dialog */
+
+ if (uri == NULL)
+ {
+ if (name == NULL)
+ {
+ _uri = "";
+ _name = _uri;
+ }
+ else
+ {
+checkpath:
+ /* the editor-backends work better with uri's */
+ if (g_path_is_absolute (name))
+ {
+ gchar *canonical_path;
+
+ canonical_path = anjuta_util_get_real_path (name);
+ if (canonical_path != NULL)
+ {
+ freeme = gnome_vfs_get_uri_from_local_path (canonical_path);
+ g_free (canonical_path);
+ _uri = freeme;
+ }
+ else
+ _uri = "";
+
+ _name = "";
+ }
+ else
+ {
+ _uri = "";
+ _name = name;
+ }
+ }
+ }
+ else /* uri != NULL */
+ {
+ if (name == NULL)
+ {
+ _uri = uri;
+ _name = "";
+ }
+ else
+ {
+ if (*uri == '\0')
+ goto checkpath;
+ _uri = uri;
+ _name = name;
+ }
+ }
+
+ te = ianjuta_editor_factory_new_editor (factory, _uri, _name, NULL);
+ /* if file cannot be loaded, text-editor brings up an error dialog ? */
if (te != NULL)
{
if (IANJUTA_IS_EDITOR (te))
ianjuta_editor_set_popup_menu (te, docman->priv->popup_menu, NULL);
- anjuta_docman_add_document (docman, IANJUTA_DOCUMENT (te), uri);
- }
+ anjuta_docman_add_document (docman, IANJUTA_DOCUMENT (te), _uri);
+ }
+ g_free (freeme);
return te;
}
@@ -890,6 +942,12 @@
return NULL;
}
+GtkWidget *
+anjuta_docman_get_current_popup (AnjutaDocman *docman)
+{
+ return docman->priv->popup_menu;
+}
+
static AnjutaDocmanPage *
anjuta_docman_get_page_for_document (AnjutaDocman *docman, IAnjutaDocument *doc)
{
@@ -1103,36 +1161,35 @@
else
te_normalized_path = g_strdup (te_uri);
gnome_vfs_uri_unref (vfs_uri);
-
- if (!normalized_path || !te_normalized_path)
- {
- DEBUG_PRINT ("Unexpected NULL path");
- g_free (te_uri);
- g_free (te_normalized_path);
- continue;
- }
- if (strcmp (normalized_path, te_normalized_path) == 0)
+ if (normalized_path && te_normalized_path)
{
- if (lineno >= 0)
+ if (strcmp (normalized_path, te_normalized_path) == 0)
{
- ianjuta_editor_goto_line (IANJUTA_EDITOR (doc), lineno, NULL);
- if (mark)
+ if (lineno >= 0)
{
- ianjuta_markable_delete_all_markers (IANJUTA_MARKABLE (doc),
- IANJUTA_MARKABLE_LINEMARKER,
- NULL);
- ianjuta_markable_mark (IANJUTA_MARKABLE (doc), lineno,
- IANJUTA_MARKABLE_LINEMARKER, NULL);
+ ianjuta_editor_goto_line (IANJUTA_EDITOR (doc), lineno, NULL);
+ if (mark)
+ {
+ ianjuta_markable_delete_all_markers (IANJUTA_MARKABLE (doc),
+ IANJUTA_MARKABLE_LINEMARKER,
+ NULL);
+ ianjuta_markable_mark (IANJUTA_MARKABLE (doc), lineno,
+ IANJUTA_MARKABLE_LINEMARKER, NULL);
+ }
}
+ anjuta_docman_present_notebook_page (docman, doc);
+ an_file_history_push (te_uri, lineno);
+ g_free (te_uri);
+ g_free (te_normalized_path);
+ g_free (uri);
+ g_free (normalized_path);
+ return IANJUTA_EDITOR (doc);
}
- anjuta_docman_present_notebook_page (docman, doc);
- an_file_history_push (te_uri, lineno);
- g_free (te_uri);
- g_free (te_normalized_path);
- g_free (uri);
- g_free (normalized_path);
- return IANJUTA_EDITOR (doc);
+ }
+ else
+ {
+ DEBUG_PRINT ("Unexpected NULL path");
}
g_free (te_uri);
g_free (te_normalized_path);
@@ -1160,20 +1217,6 @@
return te ;
}
-static gchar*
-get_real_path (const gchar *file_name)
-{
- if (file_name)
- {
- gchar path[PATH_MAX+1];
- memset (path, '\0', PATH_MAX+1);
- realpath (file_name, path);
- return g_strdup (path);
- }
- else
- return NULL;
-}
-
gchar *
anjuta_docman_get_full_filename (AnjutaDocman *docman, const gchar *fn)
{
@@ -1183,7 +1226,7 @@
gchar *fname;
g_return_val_if_fail (fn, NULL);
- real_path = get_real_path (fn);
+ real_path = anjuta_util_get_real_path (fn);
/* If it is full and absolute path, there is no need to
go further, even if the file is not found*/
Modified: trunk/plugins/document-manager/anjuta-docman.h
==============================================================================
--- trunk/plugins/document-manager/anjuta-docman.h (original)
+++ trunk/plugins/document-manager/anjuta-docman.h Thu Jan 10 13:20:34 2008
@@ -71,6 +71,8 @@
GtkWidget *anjuta_docman_get_current_focus_widget (AnjutaDocman *docman);
+GtkWidget *anjuta_docman_get_current_popup (AnjutaDocman *docman);
+
void anjuta_docman_set_current_document (AnjutaDocman *docman, IAnjutaDocument *doc);
IAnjutaEditor *anjuta_docman_goto_file_line (AnjutaDocman *docman,
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 Thu Jan 10 13:20:34 2008
@@ -12,12 +12,12 @@
<menuitem name="Close" action="ActionFileClose" />
<menuitem name="CloseAll" action="ActionFileCloseAll" />
<menuitem name="Reload" action="ActionFileReload" />
- <separator name="separator1"/>
+ <separator name="separator4"/>
</placeholder>
<placeholder name="PlaceholderPrintMenus">
<menuitem name="Print" action="ActionPrintFile" />
<menuitem name="PrintPreview" action="ActionPrintPreview" />
- <separator name="separator3"/>
+ <separator name="separator5"/>
</placeholder>
<placeholder name="PlaceholderRecentMenus">
<menu name="RecentFiles" action="ActionMenuFileRecentFiles" />
@@ -27,12 +27,12 @@
<placeholder name="PlaceholderEditMenus">
<menuitem name="Undo" action="ActionEditUndo" />
<menuitem name="Redo" action="ActionEditRedo" />
- <separator name="separator1"/>
+ <separator name="separator6"/>
<menuitem name="Cut" action="ActionEditCut" />
<menuitem name="Copy" action="ActionEditCopy" />
<menuitem name="Paste" action="ActionEditPaste" />
<menuitem name="Clear" action="ActionEditClear" />
- <separator name="separator2"/>
+ <separator name="separator7"/>
<menu name="Transform" action="ActionMenuEditTransform">
<menuitem name="UpperCase" action="ActionEditMakeSelectionUppercase" />
<menuitem name="LowerCase" action="ActionEditMakeSelectionLowercase" />
@@ -47,12 +47,13 @@
<menuitem name="Stream" action="ActionEditCommentStream" />
</menu>
<placeholder name="PlaceholderEditSearchMenus">
- <menu name="Search" action="ActionMenuEditSearch">
- <placeholder name="PlaceholderQuickSearchMenu">
+ <menu name="Search" action="ActionMenuEditSearch">
+ <placeholder name="PlaceholderQuickSearchMenu">
<menuitem name="QuickSearch" action="ActionEditSearchQuickSearch"/>
- <separator name="separator1" />
- </placeholder>
- </menu>
+ <menuitem name="QuickReSearch" action="ActionEditSearchQuickSearchAgain"/>
+ <separator name="separator8"/>
+ </placeholder>
+ </menu>
</placeholder>
</placeholder>
<placeholder name="PlaceholderSelectMenus">
@@ -74,13 +75,13 @@
<menuitem name="WhiteSpaces" action="ActionViewEditorSpaces" />
<menuitem name="LineEndCharacters" action="ActionViewEditorEOL" />
<menuitem name="LineWrapping" action="ActionViewEditorWrapping" />
- <separator name="separator2"/>
+ <separator name="separator9"/>
<menuitem name="MenuFormatStyle" action="ActionMenuFormatStyle"/>
<menuitem name="AddView" action="ActionViewEditorAddView" />
<menuitem name="RemoveView" action="ActionViewEditorRemoveView" />
<menuitem name="ZoomIn" action="ActionViewEditorZoomIn" />
<menuitem name="ZoomOut" action="ActionViewEditorZoomOut" />
- <separator name="separator3"/>
+ <separator name="separator10"/>
<menuitem name="FoldCloseAll" action="ActionFormatFoldCloseAll" />
<menuitem name="FoldOpenAll" action="ActionFormatFoldOpenAll" />
<menuitem name="FoldToggle" action="ActionFormatFoldToggle" />
@@ -91,24 +92,24 @@
<placeholder name="PlaceHolderBookmarkMenus">
<menu name="MenuBookmark" action="ActionMenuBookmark">
<menuitem name="Toggle" action="ActionBookmarkToggle" />
- <separator name="separator1" />
+ <separator name="separator11" />
<menuitem name="First" action="ActionBookmarkFirst" />
<menuitem name="Previous" action="ActionBookmarkPrevious" />
<menuitem name="Next" action="ActionBookmarkNext" />
<menuitem name="Last" action="ActionBookmarkLast" />
- <separator name="separator1" />
+ <separator name="separator12" />
<menuitem name="Clear" action="ActionBookmarkClear" />
</menu>
</placeholder>
<menuitem name="Line" action="ActionEditGotoLine" />
<menuitem name="MatchingBrace" action="ActionEditGotoMatchingBrace" />
- <separator name="separator1"/>
+ <separator name="separator13"/>
<menuitem name="BlockStart" action="ActionEditGotoBlockStart" />
<menuitem name="BlockEnd" action="ActionEditGotoBlockEnd" />
- <separator name="separator2"/>
+ <separator name="separator14"/>
<menuitem name="PreviousHistory" action="ActionEditGotoHistoryPrev" />
<menuitem name="NextHistory" action="ActionEditGotoHistoryNext" />
- <separator name="separator3"/>
+ <separator name="separator15"/>
<placeholder name="PlaceholderGotoOccurence" />
</menu>
</placeholder>
@@ -121,12 +122,12 @@
</placeholder>
<toolitem name="Save" action="ActionFileSave" />
<toolitem name="Reload" action="ActionFileReload" />
- <separator name="separator1"/>
+ <separator name="separator16"/>
<toolitem name="Undo" action="ActionEditUndo" />
<toolitem name="Redo" action="ActionEditRedo" />
- <separator name="separator2" />
+ <separator name="separator17" />
<toolitem name="Swap" action="ActionFileSwap" />
- <separator name="separator3" />
+ <separator name="separator18" />
<toolitem name="Print" action="ActionPrintFile" />
</placeholder>
</toolbar>
@@ -138,21 +139,21 @@
<toolitem name="Next" action="ActionBookmarkNext"/>
<toolitem name="Last" action="ActionBookmarkLast"/>
<toolitem name="Clear" action="ActionBookmarkClear"/>
- <separator name="separator1" />
+ <separator name="separator19"/>
<toolitem name="BlockStart" action="ActionEditGotoBlockStart"/>
<toolitem name="BlockEnd" action="ActionEditGotoBlockEnd"/>
- <separator name="separator2" />
+ <separator name="separator20"/>
</placeholder>
</toolbar>
<popup name="PopupDocumentManager">
<menuitem name="Cut" action="ActionEditCut" />
<menuitem name="Copy" action="ActionEditCopy" />
<menuitem name="Paste" action="ActionEditPaste" />
- <separator name="separator2"/>
+ <separator name="separator26"/>
<menuitem name="Swap" action="ActionFileSwap" />
<menuitem name="Toggle" action="ActionBookmarkToggle" />
<menu name="Goto" action="ActionMenuGoto">
- <separator name="separator1" />
+ <separator name="separator27"/>
<menuitem name="Previous" action="ActionBookmarkPrevious" />
<menuitem name="Next" action="ActionBookmarkNext" />
<menuitem name="HistoryPrevious" action="ActionEditGotoHistoryPrev" />
@@ -164,7 +165,7 @@
<menuitem name="CodeFoldMargin" action="ActionViewEditorFolds" />
<menuitem name="IndentationGuides" action="ActionViewEditorGuides" />
<menuitem name="LineWrapping" action="ActionViewEditorWrapping" />
- <separator name="separator2"/>
+ <separator name="separator28"/>
<menuitem name="ZoomIn" action="ActionViewEditorZoomIn" />
<menuitem name="ZoomOut" action="ActionViewEditorZoomOut" />
</menu>
Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c (original)
+++ trunk/plugins/document-manager/plugin.c Thu Jan 10 13:20:34 2008
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
plugin.c
- Copyright (C) 2000 Naba Kumar
+ Copyright (C) 2000-2008 Naba Kumar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -271,7 +271,10 @@
{ "ActionMenuEditSearch", NULL, N_("_Search"), NULL, NULL, NULL},
{ "ActionEditSearchQuickSearch", GTK_STOCK_FIND, N_("_Quick Search"),
"<control>f", N_("Quick editor embedded search"),
- G_CALLBACK (on_show_search)}
+ G_CALLBACK (on_show_search)},
+ { "ActionEditSearchQuickSearchAgain", GTK_STOCK_FIND, N_("Quick _ReSearch"),
+ "<control><shift>f", N_("Repeat quick search"),
+ G_CALLBACK (on_repeat_quicksearch)}
};
static GtkActionEntry actions_edit[] = {
@@ -816,6 +819,9 @@
action = anjuta_ui_get_action (ui, "ActionGroupEditorSearch",
"ActionEditSearchQuickSearch");
g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
+ action = anjuta_ui_get_action (ui, "ActionGroupEditorSearch",
+ "ActionEditSearchQuickSearchAgain");
+ g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupEditorNavigate",
"ActionEditGotoLine");
g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
@@ -1883,6 +1889,15 @@
return anjuta_docman_goto_file_line_mark (docman, uri, linenum, mark);
}
+/**
+ * anjuta_docman_add_buffer:
+ * @plugin:
+ * @filename:
+ * @content file text, a 0-terminated utf-8 string
+ * @r: store for pointer to error data struct
+ *
+ * Return value: the new editor
+ */
static IAnjutaEditor*
ianjuta_docman_add_buffer (IAnjutaDocumentManager *plugin,
const gchar *filename, const gchar *content,
@@ -1894,9 +1909,9 @@
te = anjuta_docman_add_editor (docman, NULL, filename);
if (te)
{
- /*if (content && strlen (content) > 0)
- aneditor_command (te->editor_id, ANE_INSERTTEXT, -1,
- (long)content);*/
+ if (content != NULL && *content != '\0')
+ ianjuta_editor_append (te, content, -1, NULL);
+
return IANJUTA_EDITOR (te);
}
return NULL;
Modified: trunk/plugins/document-manager/search-box.c
==============================================================================
--- trunk/plugins/document-manager/search-box.c (original)
+++ trunk/plugins/document-manager/search-box.c Thu Jan 10 13:20:34 2008
@@ -75,9 +75,10 @@
static void
on_document_changed (AnjutaDocman* docman, IAnjutaDocument* doc,
- SearchBox* search_box)
+ SearchBox* search_box)
{
SearchBoxPrivate* private = GET_PRIVATE(search_box);
+
if (!doc || !IANJUTA_IS_EDITOR (doc))
{
gtk_widget_hide (GTK_WIDGET (search_box));
@@ -287,7 +288,7 @@
g_object_unref (search_end);
}
-static void
+void
on_search_activated (GtkWidget* widget, SearchBox* search_box)
{
IAnjutaEditorCell* search_start;
@@ -519,9 +520,28 @@
}
void
-search_box_grab_search_focus (SearchBox* search_box)
+search_box_fill_search_focus (SearchBox* search_box)
{
SearchBoxPrivate* private = GET_PRIVATE(search_box);
+ IAnjutaEditor* te = private->current_editor;
+
+ if (IANJUTA_IS_EDITOR (te))
+ {
+ gchar *buffer;
+
+ buffer = ianjuta_editor_selection_get (IANJUTA_EDITOR_SELECTION (te), NULL);
+ if (buffer != NULL)
+ {
+ g_strstrip (buffer);
+ if (*buffer != 0)
+ {
+ gtk_entry_set_text (GTK_ENTRY (private->search_entry), buffer);
+ gtk_editable_select_region (GTK_EDITABLE (private->search_entry), 0, -1);
+ }
+ g_free (buffer);
+ }
+ }
+
gtk_widget_grab_focus (private->search_entry);
}
Modified: trunk/plugins/document-manager/search-box.h
==============================================================================
--- trunk/plugins/document-manager/search-box.h (original)
+++ trunk/plugins/document-manager/search-box.h Thu Jan 10 13:20:34 2008
@@ -56,8 +56,9 @@
GType search_box_get_type (void);
GtkWidget* search_box_new (AnjutaDocman* docman);
-void search_box_grab_search_focus (SearchBox* search_box);
+void search_box_fill_search_focus (SearchBox* search_box);
void search_box_grab_line_focus (SearchBox* search_box);
+void on_search_activated (GtkWidget* widget, SearchBox* search_box);
G_END_DECLS
Modified: trunk/plugins/search/plugin.c
==============================================================================
--- trunk/plugins/search/plugin.c (original)
+++ trunk/plugins/search/plugin.c Thu Jan 10 13:20:34 2008
@@ -191,7 +191,7 @@
static GtkActionEntry actions_search[] = {
{ "ActionMenuEditSearch", NULL, N_("_Search"), NULL, NULL, NULL},
- { "ActionEditSearchFind", GTK_STOCK_FIND, N_("_Find..."), "<shift><control>f",
+ { "ActionEditSearchFind", GTK_STOCK_FIND, N_("_Find..."), "<control><alt>f",
N_("Search for a string or regular expression in the editor"),
G_CALLBACK (on_find1_activate)},
{ "ActionEditSearchFindNext", GTK_STOCK_FIND, N_("Find _Next"), "<control>g",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]