Revision: 2735
http://geany.svn.sourceforge.net/geany/?rev=2735&view=rev
Author: ntrel
Date: 2008-06-30 08:15:02 -0700 (Mon, 30 Jun 2008)
Log Message:
-----------
Fix stack corruption (cannot use stack GPtrArray as this is just a
base-class for private GRealPtrArray).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/ui_utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-30 11:49:39 UTC (rev 2734)
+++ trunk/ChangeLog 2008-06-30 15:15:02 UTC (rev 2735)
@@ -4,6 +4,9 @@
Use a dynamic pointer array for document sensitive widgets, so it's
easy to group widget names together in the source.
Make 'Close other documents' menu item document-sensitive.
+ * src/ui_utils.c:
+ Fix stack corruption (cannot use stack GPtrArray as this is just a
+ base-class for private GRealPtrArray).
2008-06-28 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2008-06-30 11:49:39 UTC (rev 2734)
+++ trunk/src/ui_utils.c 2008-06-30 15:15:02 UTC (rev 2735)
@@ -572,10 +572,8 @@
static void init_document_widgets(void)
{
- static GPtrArray document_buttons = {NULL, 0};
+ widgets.document_buttons = g_ptr_array_new();
- widgets.document_buttons = &document_buttons;
-
/* Cache the document-sensitive widgets so we don't have to keep looking them up
* when using ui_document_buttons_update(). */
add_doc_widget("menu_close1");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2733
http://geany.svn.sourceforge.net/geany/?rev=2733&view=rev
Author: eht16
Date: 2008-06-28 08:46:07 -0700 (Sat, 28 Jun 2008)
Log Message:
-----------
Add plugin signal "populate-edit-menu" to notify plugins when the editing menu is shown.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/plugins.dox
trunk/src/editor.c
trunk/src/geanyobject.c
trunk/src/geanyobject.h
trunk/src/plugindata.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-28 15:42:10 UTC (rev 2732)
+++ trunk/ChangeLog 2008-06-28 15:46:07 UTC (rev 2733)
@@ -7,6 +7,10 @@
* src/editor.c:
Attempt to make editor_find_current_word() Unicode-safe. Note: this
can be done better.
+ * doc/plugins.dox, src/editor.c, src/geanyobject.c, src/geanyobject.h,
+ src/plugindata.h:
+ Add plugin signal "populate-edit-menu" to notify plugins when the
+ editing menu is shown.
2008-06-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/doc/plugins.dox
===================================================================
--- trunk/doc/plugins.dox 2008-06-28 15:42:10 UTC (rev 2732)
+++ trunk/doc/plugins.dox 2008-06-28 15:46:07 UTC (rev 2733)
@@ -159,8 +159,24 @@
* @param user_data user data.
* @endsignaldef
*
+ * @signaldef populate-edit-menu
+ * @signalproto
+ * void user_function(GObject *obj, const gchar *word, gint pos, GeanyDocument *doc,
+ * gpointer user_data);
+ * @endsignalproto
+ * @signaldesc
+ * Sent before the popup menu of the editing widget is shown. This can be used to modify or extend
+ * the popup menu. You can access the menu pointer using @a main_widgets->editor_menu.
+ * @param obj a GeanyObject instance, should be ignored.
+ * @param word the current word (in UTF-8 encoding) below the cursor position
+ where the popup menu will be opened.
+ * @param click_pos the cursor position where the popup will be opened.
+ * @param doc the current document.
+ * @param user_data user data.
+ * @endsignaldef
*
*
+ *
* @page howto Plugin Howto
*
* @section intro Introduction
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-06-28 15:42:10 UTC (rev 2732)
+++ trunk/src/editor.c 2008-06-28 15:46:07 UTC (rev 2733)
@@ -47,6 +47,7 @@
#include "dialogs.h"
#include "symbols.h"
#include "callbacks.h"
+#include "geanyobject.h"
/* holds word under the mouse or keyboard cursor */
@@ -109,6 +110,12 @@
ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
ui_update_popup_copy_items(doc);
ui_update_insert_include_item(doc, 0);
+
+ if (geany_object)
+ {
+ g_signal_emit_by_name(geany_object, "populate-edit-menu",
+ current_word, editor_info.click_pos, doc);
+ }
gtk_menu_popup(GTK_MENU(main_widgets.editor_menu),
NULL, NULL, NULL, NULL, event->button, event->time);
Modified: trunk/src/geanyobject.c
===================================================================
--- trunk/src/geanyobject.c 2008-06-28 15:42:10 UTC (rev 2732)
+++ trunk/src/geanyobject.c 2008-06-28 15:46:07 UTC (rev 2733)
@@ -143,6 +143,15 @@
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
+ geany_object_signals[GCB_POPULATE_EDIT_MENU] = g_signal_new (
+ "populate-edit-menu",
+ G_OBJECT_CLASS_TYPE (g_object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GeanyObjectClass, populate_edit_menu),
+ NULL, NULL,
+ gtk_marshal_NONE__STRING_INT_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER);
}
Modified: trunk/src/geanyobject.h
===================================================================
--- trunk/src/geanyobject.h 2008-06-28 15:42:10 UTC (rev 2732)
+++ trunk/src/geanyobject.h 2008-06-28 15:46:07 UTC (rev 2733)
@@ -41,6 +41,7 @@
GCB_PROJECT_OPEN,
GCB_PROJECT_SAVE,
GCB_PROJECT_CLOSE,
+ GCB_POPULATE_EDIT_MENU,
GCB_MAX
} GeanyCallbackId;
@@ -77,6 +78,7 @@
void (*project_open)(GKeyFile *keyfile);
void (*project_save)(GKeyFile *keyfile);
void (*project_close)(void);
+ void (*populate_edit_menu)(const gchar *word, gint click_pos, GeanyDocument *doc);
};
GType geany_object_get_type (void);
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-06-28 15:42:10 UTC (rev 2732)
+++ trunk/src/plugindata.h 2008-06-28 15:46:07 UTC (rev 2733)
@@ -36,7 +36,7 @@
/* The API version should be incremented whenever any plugin data types below are
* modified or appended to. */
-static const gint api_version = 71;
+static const gint api_version = 72;
/* The ABI version should be incremented whenever existing fields in the plugin
* data types below have to be changed or reordered. It should stay the same if fields
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2732
http://geany.svn.sourceforge.net/geany/?rev=2732&view=rev
Author: eht16
Date: 2008-06-28 08:42:10 -0700 (Sat, 28 Jun 2008)
Log Message:
-----------
Attempt to make editor_find_current_word() Unicode-safe. Note: this can be done better.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-28 08:15:18 UTC (rev 2731)
+++ trunk/ChangeLog 2008-06-28 15:42:10 UTC (rev 2732)
@@ -4,6 +4,9 @@
When opening files remotely using the socket, handle filename
encoding better and try to auto-detect the used encoding as it
might be different each time (hopefully closes #2003980).
+ * src/editor.c:
+ Attempt to make editor_find_current_word() Unicode-safe. Note: this
+ can be done better.
2008-06-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-06-28 08:15:18 UTC (rev 2731)
+++ trunk/src/editor.c 2008-06-28 15:42:10 UTC (rev 2732)
@@ -905,9 +905,12 @@
if (wc == NULL)
wc = GEANY_WORDCHARS;
- while (startword > 0 && strchr(wc, chunk[startword - 1]))
+ /* the checks for "c < 0" are to allow any Unicode character which should make the code
+ * a little bit more Unicode safe, anyway, this allows also any Unicode punctuation,
+ * TODO: improve this code */
+ while (startword > 0 && (strchr(wc, chunk[startword - 1]) || chunk[startword - 1] < 0))
startword--;
- while (chunk[endword] && strchr(wc, chunk[endword]))
+ while (chunk[endword] != 0 && (strchr(wc, chunk[endword]) || chunk[endword] < 0))
endword++;
if(startword == endword)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2731
http://geany.svn.sourceforge.net/geany/?rev=2731&view=rev
Author: eht16
Date: 2008-06-28 01:15:18 -0700 (Sat, 28 Jun 2008)
Log Message:
-----------
When opening files remotely using the socket, handle filename encoding better and try to auto-detect the used encoding as it might be different each time (hopefully closes #2003980).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/socket.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-27 17:54:36 UTC (rev 2730)
+++ trunk/ChangeLog 2008-06-28 08:15:18 UTC (rev 2731)
@@ -1,3 +1,11 @@
+2008-06-28 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/socket.c:
+ When opening files remotely using the socket, handle filename
+ encoding better and try to auto-detect the used encoding as it
+ might be different each time (hopefully closes #2003980).
+
+
2008-06-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/interface.c, src/callbacks.c, src/callbacks.h, geany.glade:
Modified: trunk/src/socket.c
===================================================================
--- trunk/src/socket.c 2008-06-27 17:54:36 UTC (rev 2730)
+++ trunk/src/socket.c 2008-06-28 08:15:18 UTC (rev 2731)
@@ -77,6 +77,7 @@
#include "support.h"
#include "ui_utils.h"
#include "utils.h"
+#include "encodings.h"
@@ -472,6 +473,35 @@
#endif
+static void handle_input_filename(const gchar *buf)
+{
+ gchar *utf8_filename, *locale_filename;
+
+ /* we never know how the input is encoded, so do the best auto detection we can */
+ if (! g_utf8_validate(buf, -1, NULL))
+ utf8_filename = encodings_convert_to_utf8(buf, -1, NULL);
+ else
+ utf8_filename = g_strdup(buf);
+
+ locale_filename = utils_get_locale_from_utf8(utf8_filename);
+
+ if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
+ document_open_file(locale_filename, FALSE, NULL, NULL);
+ else
+ { /* create new file if it doesn't exist */
+ GeanyDocument *doc;
+
+ doc = document_new_file(utf8_filename, NULL, NULL);
+ if (doc != NULL)
+ ui_add_recent_file(doc->file_name);
+ else
+ geany_debug("got data from socket, but it does not look like a filename");
+ }
+ g_free(utf8_filename);
+ g_free(locale_filename);
+}
+
+
gboolean socket_lock_input_cb(GIOChannel *source, GIOCondition condition, gpointer data)
{
gint fd, sock;
@@ -491,20 +521,7 @@
{
while (socket_fd_gets(sock, buf, sizeof(buf)) != -1 && *buf != '.')
{
- g_strstrip(buf); /* remove \n char */
-
- if (g_file_test(buf, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
- document_open_file(buf, FALSE, NULL, NULL);
- else
- { /* create new file if it doesn't exist */
- GeanyDocument *doc;
-
- doc = document_new_file(buf, NULL, NULL);
- if (doc != NULL)
- ui_add_recent_file(doc->file_name);
- else
- geany_debug("got data from socket, but it does not look like a filename");
- }
+ handle_input_filename(g_strstrip(buf));
}
#ifdef G_OS_WIN32
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.