Revision: 5235
http://geany.svn.sourceforge.net/geany/?rev=5235&view=rev
Author: ntrel
Date: 2010-09-16 15:14:09 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Add plugin signals project-dialog-create and
project-dialog-confirmed so plugins can append a Project Properties
notebook tab (patch by Ji?\197?\153?\195?\173 Techet, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/pluginsignals.c
trunk/src/geanyobject.c
trunk/src/geanyobject.h
trunk/src/project.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-09-16 14:52:04 UTC (rev 5234)
+++ trunk/ChangeLog 2010-09-16 15:14:09 UTC (rev 5235)
@@ -10,6 +10,11 @@
Prompt for reloading if the document has an undo stack to avoid
losing undo ability on accidental reloading (patch by Colomban
Wendling, thanks).
+ * src/project.c, src/geanyobject.c, src/geanyobject.h,
+ doc/pluginsignals.c:
+ Add plugin signals project-dialog-create and
+ project-dialog-confirmed so plugins can append a Project Properties
+ notebook tab (patch by Jiří Techet, thanks).
2010-09-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/doc/pluginsignals.c
===================================================================
--- trunk/doc/pluginsignals.c 2010-09-16 14:52:04 UTC (rev 5234)
+++ trunk/doc/pluginsignals.c 2010-09-16 15:14:09 UTC (rev 5235)
@@ -160,6 +160,26 @@
*/
signal void (*project_close)(GObject *obj, gpointer user_data);
+/** Sent after a project dialog is created but before it is displayed. Plugins
+ * can append their own project settings tabs by using this signal.
+ * @param obj a GeanyObject instance, should be ignored.
+ * @param notebook a GtkNotebook instance that can be used by plugins to append their
+ * settings tabs.
+ * @param user_data user data.
+ */
+signal void (*project_dialog_create)(GObject *obj, GtkWidget *notebook, gpointer user_data);
+
+/** Sent when the settings dialog is confirmed by the user. Plugins can use
+ * this signal to read the settings widgets previously added by using the
+ * @c project-dialog-create signal.
+ * @warning The dialog will still be running afterwards if the user chose 'Apply'.
+ * @param obj a GeanyObject instance, should be ignored.
+ * @param notebook a GtkNotebook instance that can be used by plugins to read their
+ * settings widgets.
+ * @param user_data user data.
+ */
+signal void (*project_dialog_confirmed)(GObject *obj, GtkWidget *notebook, gpointer user_data);
+
/** Sent once Geany has finished all initialization and startup tasks and the GUI has been
* realized. This signal is the very last step in the startup process and is sent once
* the GTK main event loop has been entered.
Modified: trunk/src/geanyobject.c
===================================================================
--- trunk/src/geanyobject.c 2010-09-16 14:52:04 UTC (rev 5234)
+++ trunk/src/geanyobject.c 2010-09-16 15:14:09 UTC (rev 5235)
@@ -262,6 +262,24 @@
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ geany_object_signals[GCB_PROJECT_DIALOG_CREATE] = g_signal_new (
+ "project-dialog-create",
+ G_OBJECT_CLASS_TYPE (g_object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_create),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+ geany_object_signals[GCB_PROJECT_DIALOG_CONFIRMED] = g_signal_new (
+ "project-dialog-confirmed",
+ G_OBJECT_CLASS_TYPE (g_object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_confirmed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
/* Editor signals */
geany_object_signals[GCB_UPDATE_EDITOR_MENU] = g_signal_new (
Modified: trunk/src/geanyobject.h
===================================================================
--- trunk/src/geanyobject.h 2010-09-16 14:52:04 UTC (rev 5234)
+++ trunk/src/geanyobject.h 2010-09-16 15:14:09 UTC (rev 5235)
@@ -42,6 +42,8 @@
GCB_PROJECT_OPEN,
GCB_PROJECT_SAVE,
GCB_PROJECT_CLOSE,
+ GCB_PROJECT_DIALOG_CREATE,
+ GCB_PROJECT_DIALOG_CONFIRMED,
GCB_UPDATE_EDITOR_MENU,
GCB_EDITOR_NOTIFY,
GCB_GEANY_STARTUP_COMPLETE,
@@ -88,6 +90,8 @@
void (*project_open)(GKeyFile *keyfile);
void (*project_save)(GKeyFile *keyfile);
void (*project_close)(void);
+ void (*project_dialog_create)(GtkWidget *notebook);
+ void (*project_dialog_confirmed)(GtkWidget *notebook);
void (*update_editor_menu)(const gchar *word, gint click_pos, GeanyDocument *doc);
gboolean (*editor_notify)(GeanyEditor *editor, gpointer scnt);
void (*geany_startup_complete)(void);
Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c 2010-09-16 14:52:04 UTC (rev 5234)
+++ trunk/src/project.c 2010-09-16 15:14:09 UTC (rev 5235)
@@ -191,6 +191,9 @@
{
if (update_config(e))
{
+ write_config(TRUE);
+ ui_set_statusbar(TRUE, _("Project \"%s\" created."), app->project->name);
+
ui_add_recent_project_file(app->project->file_name);
break;
}
@@ -563,6 +566,7 @@
}
#endif
+ g_signal_emit_by_name(geany_object, "project-dialog-create", e->notebook);
gtk_widget_show_all(e->dialog);
/* note: notebook page must be shown before setting current page */
@@ -575,6 +579,9 @@
{
if (update_config(e))
{
+ g_signal_emit_by_name(geany_object, "project-dialog-confirmed", e->notebook);
+ write_config(TRUE);
+ ui_set_statusbar(TRUE, _("Project \"%s\" saved."), app->project->name);
stash_group_update(indent_group, e->dialog);
break;
}
@@ -791,11 +798,6 @@
g_free(tmp);
#endif
}
- write_config(TRUE);
- if (new_project)
- ui_set_statusbar(TRUE, _("Project \"%s\" created."), p->name);
- else
- ui_set_statusbar(TRUE, _("Project \"%s\" saved."), p->name);
update_ui();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5234
http://geany.svn.sourceforge.net/geany/?rev=5234&view=rev
Author: ntrel
Date: 2010-09-16 14:52:04 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Prompt for reloading if the document has an undo stack to avoid
losing undo ability on accidental reloading (patch by Colomban
Wendling, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-09-15 17:11:30 UTC (rev 5233)
+++ trunk/ChangeLog 2010-09-16 14:52:04 UTC (rev 5234)
@@ -6,6 +6,10 @@
doc/geany.html, TODO:
Use a separate socket per workspace on X (patch by Erik de Castro
Lopo, thanks).
+ * src/callbacks.c:
+ Prompt for reloading if the document has an undo stack to avoid
+ losing undo ability on accidental reloading (patch by Colomban
+ Wendling, thanks).
2010-09-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2010-09-15 17:11:30 UTC (rev 5233)
+++ trunk/src/callbacks.c 2010-09-16 14:52:04 UTC (rev 5234)
@@ -485,7 +485,8 @@
charset = doc->encoding;
base_name = g_path_get_basename(doc->file_name);
- if (!doc->changed ||
+ /* don't prompt if file hasn't been edited at all */
+ if ((!doc->changed && !document_can_undo(doc) && !document_can_redo(doc)) ||
dialogs_show_question_full(NULL, _("_Reload"), GTK_STOCK_CANCEL,
_("Any unsaved changes will be lost."),
_("Are you sure you want to reload '%s'?"), base_name))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5233
http://geany.svn.sourceforge.net/geany/?rev=5233&view=rev
Author: ntrel
Date: 2010-09-15 17:11:30 +0000 (Wed, 15 Sep 2010)
Log Message:
-----------
Update - thanks Erik.
Modified Paths:
--------------
trunk/THANKS
trunk/src/about.c
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2010-09-15 17:04:23 UTC (rev 5232)
+++ trunk/THANKS 2010-09-15 17:11:30 UTC (rev 5233)
@@ -80,7 +80,8 @@
Dimitar Zhekov <hamster(at)mbox(dot)contact(dot)bg> - various patches
Ondrej Donek <ondrejd(at)gmail(dot)com> - Support for creating PHP classes with the classbuilder plugin
Daniel Marjamaki <danielm77(at)spray(dot)se> - Small improvements
-Jiří Techet <techet(at)gmail(dot)com> - Fix switch to last used tab ordering bug
+Jiří Techet <techet(at)gmail(dot)com> - Various patches
+Erik de Castro Lopo <mle+tools(at)mega-nerd(dot)com> - Various patches
Translators:
------------
Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c 2010-09-15 17:04:23 UTC (rev 5232)
+++ trunk/src/about.c 2010-09-15 17:11:30 UTC (rev 5233)
@@ -87,7 +87,8 @@
"Bronisław Białek, Can Koy, Catalin Marinas, "
"Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., "
"Daniel Marjamaki, Dave Moore, "
-"Dimitar Zhekov, Dirk Weber, Elias Pschernig, Eric Forgeot, Eugene Arshinov, Felipe Pena, François Cami, "
+"Dimitar Zhekov, Dirk Weber, Elias Pschernig, Eric Forgeot, "
+"Erik de Castro Lopo, Eugene Arshinov, Felipe Pena, François Cami, "
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, Jiří Techet, "
"John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5232
http://geany.svn.sourceforge.net/geany/?rev=5232&view=rev
Author: ntrel
Date: 2010-09-15 17:04:23 +0000 (Wed, 15 Sep 2010)
Log Message:
-----------
Use a separate socket per workspace on X (patch by Erik de Castro
Lopo, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/TODO
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/socket.c
trunk/src/ui_utils.c
trunk/src/ui_utils.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/ChangeLog 2010-09-15 17:04:23 UTC (rev 5232)
@@ -2,6 +2,10 @@
* src/keyfile.c:
Save document indent width with the session.
+ * src/ui_utils.h, src/socket.c, src/ui_utils.c, doc/geany.txt,
+ doc/geany.html, TODO:
+ Use a separate socket per workspace on X (patch by Erik de Castro
+ Lopo, thanks).
2010-09-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/TODO 2010-09-15 17:04:23 UTC (rev 5232)
@@ -21,7 +21,6 @@
o (sci macro support - as a plugin?)
o (parsing tags from a memory buffer instead of a file on disk)
o (tango-like icons for the symbol list)
- o (per-workspace instances with socket support?)
1.0:
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/doc/geany.html 2010-09-15 17:04:23 UTC (rev 5232)
@@ -718,9 +718,9 @@
<h2><a class="toc-backref" href="#id28" id="command-line-options" name="command-line-options">Command line options</a></h2>
<table border="1" class="docutils">
<colgroup>
-<col width="9%" />
-<col width="18%" />
-<col width="72%" />
+<col width="13%" />
+<col width="25%" />
+<col width="62%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Short option</th>
@@ -818,11 +818,11 @@
<tr><td><em>none</em></td>
<td>--socket-file</td>
<td><p class="first">Use this socket filename for communication with a
-running Geany instance. This can be used with the following
-command to execute Geany on the current workspace:</p>
-<pre class="last literal-block">
-geany --socket-file=/tmp/geany-sock-$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}')
-</pre>
+running Geany instance. By default Geany uses one
+socket file per workspace for X Windows, otherwise
+only one.</p>
+<p class="last">Example:
+geany --socket-file=/tmp/geany-sock-2</p>
</td>
</tr>
<tr><td><em>none</em></td>
@@ -6133,7 +6133,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2010-09-09 15:36 UTC.
+Generated on: 2010-09-15 16:58 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/doc/geany.txt 2010-09-15 17:04:23 UTC (rev 5232)
@@ -365,10 +365,12 @@
available if Geany was compiled with support for VTE.
*none* --socket-file Use this socket filename for communication with a
- running Geany instance. This can be used with the following
- command to execute Geany on the current workspace::
+ running Geany instance. By default Geany uses one
+ socket file per workspace for X Windows, otherwise
+ only one.
- geany --socket-file=/tmp/geany-sock-$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}')
+ Example:
+ geany --socket-file=/tmp/geany-sock-2
*none* --vte-lib Specify explicitly the path including filename or only
the filename to the VTE library, e.g.
Modified: trunk/src/socket.c
===================================================================
--- trunk/src/socket.c 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/src/socket.c 2010-09-15 17:04:23 UTC (rev 5232)
@@ -271,6 +271,7 @@
return -1;
#else
gchar *display_name = gdk_get_display();
+ gint workspace = ui_get_current_workspace(display_name);
gchar *hostname = utils_get_hostname();
gchar *p;
@@ -284,8 +285,8 @@
*p = '_';
if (socket_info.file_name == NULL)
- socket_info.file_name = g_strdup_printf("%s%cgeany_socket_%s_%s",
- app->configdir, G_DIR_SEPARATOR, hostname, display_name);
+ socket_info.file_name = g_strdup_printf("%s%cgeany_socket_%s_%s_ws%d",
+ app->configdir, G_DIR_SEPARATOR, hostname, display_name, workspace);
g_free(display_name);
g_free(hostname);
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/src/ui_utils.c 2010-09-15 17:04:23 UTC (rev 5232)
@@ -31,6 +31,14 @@
#include <ctype.h>
#include <gdk/gdkkeysyms.h>
+/* For ui_get_current_workspace() */
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#endif
+
#include "ui_utils.h"
#include "prefs.h"
#include "sciwrappers.h"
@@ -2434,3 +2442,48 @@
g_signal_stop_emission_by_name(editable, "insert-text");
}
+
+/* Get the current visible workspace number for the given display name.
+ *
+ * If the X11 window property isn't found, 0 (the first workspace)
+ * is returned.
+ *
+ * Has been tested and verified to work under GNOME and KDE. Assuming that
+ * most other X11 desktops will work the same. For non-X11 backends it returns
+ * a workspace number of 0.
+ *
+ * This code is a slightly modified version of code that was ripped from Gedit
+ * which ripped it from Galeon. */
+gint ui_get_current_workspace(const gchar *display_name)
+{
+#ifdef GDK_WINDOWING_X11
+ GdkScreen *screen = gdk_screen_get_default();
+ GdkWindow *root_win = gdk_screen_get_root_window(screen);
+ GdkDisplay *display = gdk_display_open(display_name);
+ Atom type;
+ gint format;
+ gulong nitems;
+ gulong bytes_after;
+ guint *current_desktop;
+ gint err, result;
+ gint ret = 0;
+
+ gdk_error_trap_push();
+ result = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(display), GDK_WINDOW_XID(root_win),
+ gdk_x11_get_xatom_by_name_for_display(display, "_NET_CURRENT_DESKTOP"),
+ 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
+ &bytes_after, (gpointer) ¤t_desktop);
+ err = gdk_error_trap_pop();
+
+ if (err == Success && result == Success)
+ {
+ if (type == XA_CARDINAL && format == 32 && nitems > 0)
+ ret = current_desktop[0];
+ XFree(current_desktop);
+ }
+ gdk_display_close(display);
+ return ret;
+#else
+ return 0;
+#endif
+}
Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h 2010-09-15 14:59:41 UTC (rev 5231)
+++ trunk/src/ui_utils.h 2010-09-15 17:04:23 UTC (rev 5232)
@@ -318,4 +318,6 @@
gint ui_get_gtk_settings_integer(const gchar *property_name, gint default_value);
+gint ui_get_current_workspace(const gchar *display_name);
+
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.