Branch: refs/heads/master
Author: Frank Lanitz <frank(a)frank.uvena.de>
Committer: Frank Lanitz <frank(a)frank.uvena.de>
Date: Sun, 12 Oct 2014 14:15:57 UTC
Commit: 9a287a2072b386b53178714a6c84558ac20592e7
https://github.com/geany/geany-plugins/commit/9a287a2072b386b53178714a6c845…
Log Message:
-----------
TableConvert: Some more Updates of documentation
Modified Paths:
--------------
tableconvert/ChangeLog
tableconvert/README
Modified: tableconvert/ChangeLog
6 lines changed, 6 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,9 @@
+2014-10-10 Frank Lanitz <frank(a)frank.uvena.de>
+
+ * Introducing a special menu entry into Tools-menu allowing to convert
+ without changing Geany's file type setting for current document.
+
+
2014-10-05 Frank Lanitz <frank(a)frank.uvena.de>
* Fixing an issue where \r and \n on e.g. Windows files handled as
Modified: tableconvert/README
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -28,6 +28,10 @@ set up a keybinding for the function. Once this is done, the plugin is
ready to use. Alternativly it's also possible to use the plugin via the
menu entry at the Tools menu.
+Inside the Tools menu there is also another submenu avaialble wich is
+allowing you to convert to a table without changing Geany's file type
+settings for the current document.
+
When using the plugin, just mark the area you like to transform and
push your keybinding. All line endings will be taken as end of a row
and therefor transformed to fitting row endings. The plugin is taking
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 12 Oct 2014 12:59:21 UTC
Commit: 21f9e79acf37d05e068e155f4f977d04628204de
https://github.com/geany/geany-plugins/commit/21f9e79acf37d05e068e155f4f977…
Log Message:
-----------
debugger: Fix GCond usage
g_cond_wait() and the likes unlock the passed in mutex during the wait
and re-lock it before returning. However, the code here used to pass
in an unlocked mutex.
This used to work because GLib threading implementation was tolerant
and allowed unlocking an unlocked mutex, but GLib 2.42 has a new and
less tolerant implementation that would abort in such situation.
Fix this by properly locking the passed in mutex.
The implementation here also removes the second mutex only used for the
condition as the one used to protect the loop body can very well be
used and actually makes sense as they protect the same thing.
Doing so requires to properly wait for the thread to quit before
destroying the mutex, but this probably should be done anyways to avoid
forcefully killing the thread when the application quits.
Modified Paths:
--------------
debugger/src/dconfig.c
Modified: debugger/src/dconfig.c
12 lines changed, 4 insertions(+), 8 deletions(-)
===================================================================
@@ -270,11 +270,9 @@ static void save_to_keyfile(GKeyFile *keyfile)
static gpointer saving_thread_func(gpointer data)
{
GTimeVal interval;
- GMutex *m = g_mutex_new();
+ g_mutex_lock(change_config_mutex);
do
{
- g_mutex_lock(change_config_mutex);
-
if (
panel_config_changed ||
(debug_config_changed && DEBUG_STORE_PLUGIN == dstore)
@@ -309,14 +307,12 @@ static gpointer saving_thread_func(gpointer data)
debug_config_changed = FALSE;
}
-
- g_mutex_unlock(change_config_mutex);
g_get_current_time(&interval);
g_time_val_add(&interval, SAVING_INTERVAL);
}
- while (!g_cond_timed_wait(cond, m, &interval));
- g_mutex_free(m);
+ while (!g_cond_timed_wait(cond, change_config_mutex, &interval));
+ g_mutex_unlock(change_config_mutex);
return NULL;
}
@@ -471,7 +467,7 @@ void config_init(void)
void config_destroy(void)
{
g_cond_signal(cond);
- /* ??? g_thread_join(saving_thread); */
+ g_thread_join(saving_thread);
g_mutex_free(change_config_mutex);
g_cond_free(cond);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Frank Lanitz <frank(a)frank.uvena.de>
Committer: Frank Lanitz <frank(a)frank.uvena.de>
Date: Thu, 09 Oct 2014 22:08:53 UTC
Commit: 83bfbc106ea4dcdc4cb641544aa5cf05d9ff21f5
https://github.com/geany/geany-plugins/commit/83bfbc106ea4dcdc4cb641544aa5c…
Log Message:
-----------
TableConvert: Splitting plugin a little up and adding Geany-file-type independent convert menu
This commit mostly is adding a special menu for converting something to a table without changing Geany's
file type settings. Currently it doesn't add much comfort with it, but it will allow in future also to
convert e.g. into different wiki syntax stiles.
However, during this work it appeared to make any sense to split plugin into more than just one huge c-file.
Modified Paths:
--------------
tableconvert/src/tableconvert.c
tableconvert/src/tableconvert.h
tableconvert/src/tableconvert_ui.c
tableconvert/src/tableconvert_ui.h
Modified: tableconvert/src/tableconvert.c
141 lines changed, 62 insertions(+), 79 deletions(-)
===================================================================
@@ -22,11 +22,8 @@
#include "config.h" /* for the gettext domain */
#endif
-#include "geanyplugin.h"
-
-GeanyPlugin *geany_plugin;
-GeanyData *geany_data;
-GeanyFunctions *geany_functions;
+#include "tableconvert.h"
+#include "tableconvert_ui.h"
PLUGIN_VERSION_CHECK(200)
@@ -35,36 +32,14 @@ PLUGIN_SET_TRANSLATABLE_INFO(
_("A little plugin to convert lists into tables"),
VERSION, "Frank Lanitz <frank(a)frank.uvena.de>")
-enum
-{
- KB_HTMLTABLE_CONVERT_TO_TABLE,
- COUNT_KB
-};
-
-typedef struct {
- const gchar *start;
- const gchar *header_start;
- const gchar *header_stop;
- const gchar *body_start;
- const gchar *body_end;
- const gchar *columnsplit;
- const gchar *linestart;
- const gchar *lineend;
- /* linesplit should keep empty until you really need some special
- * logic there. */
- const gchar *linesplit;
- const gchar *end;
-} TableConvertRule;
-
-enum {
- TC_LATEX = 0,
- TC_HTML,
- TC_SQL
-};
+GeanyPlugin *geany_plugin;
+GeanyData *geany_data;
+GeanyFunctions *geany_functions;
TableConvertRule tablerules[] = {
/* LaTeX */
{
+ N_("LaTeX"),
"\\begin{table}[h]\n\\begin{tabular}{}\n",
"",
"",
@@ -78,6 +53,7 @@ TableConvertRule tablerules[] = {
},
/* HTML */
{
+ N_("HTML"),
"<table>\n",
"<thead>\n",
"</thead>\n",
@@ -91,6 +67,7 @@ TableConvertRule tablerules[] = {
},
/* SQL */
{
+ N_("SQL"),
"",
"",
"",
@@ -105,8 +82,6 @@ TableConvertRule tablerules[] = {
};
-static GtkWidget *main_menu_item = NULL;
-
static gchar* convert_to_table_worker(gchar **rows, gboolean header,
const TableConvertRule *rule)
{
@@ -188,7 +163,7 @@ static gchar* convert_to_table_worker(gchar **rows, gboolean header,
return g_string_free(replacement_str, FALSE);
}
-static void convert_to_table(gboolean header)
+void convert_to_table(gboolean header, gint file_type)
{
GeanyDocument *doc = NULL;
doc = document_get_current();
@@ -218,41 +193,51 @@ static void convert_to_table(gboolean header)
/* Checking whether we do have something we can work on - Returning if not */
if (rows != NULL)
{
- switch (doc->file_type->id)
+ if (file_type == -1)
{
- case GEANY_FILETYPES_NONE:
- {
- g_strfreev(rows);
- return;
- }
- case GEANY_FILETYPES_HTML:
- case GEANY_FILETYPES_MARKDOWN:
- {
- replacement = convert_to_table_worker(rows,
- header,
- &tablerules[TC_HTML]);
- break;
- }
- case GEANY_FILETYPES_LATEX:
+ switch (doc->file_type->id)
{
- replacement = convert_to_table_worker(rows,
- header,
- &tablerules[TC_LATEX]);
- break;
- }
- case GEANY_FILETYPES_SQL:
- {
- /* TODO: Check for INTEGER and other datatypes on SQL */
- replacement = convert_to_table_worker(rows,
- header,
- &tablerules[TC_SQL]);
- break;
- }
- default:
- {
- /* We just don't do anything */
- }
- } /* filetype switch */
+ case GEANY_FILETYPES_NONE:
+ {
+ g_strfreev(rows);
+ return;
+ }
+ case GEANY_FILETYPES_HTML:
+ case GEANY_FILETYPES_MARKDOWN:
+ {
+ replacement = convert_to_table_worker(rows,
+ header,
+ &tablerules[TC_HTML]);
+ break;
+ }
+ case GEANY_FILETYPES_LATEX:
+ {
+ replacement = convert_to_table_worker(rows,
+ header,
+ &tablerules[TC_LATEX]);
+ break;
+ }
+ case GEANY_FILETYPES_SQL:
+ {
+ /* TODO: Check for INTEGER and other datatypes on SQL */
+ replacement = convert_to_table_worker(rows,
+ header,
+ &tablerules[TC_SQL]);
+ break;
+ }
+ default:
+ {
+ /* We just don't do anything */
+ }
+ } /* filetype switch */
+ }
+ else
+ {
+ replacement = convert_to_table_worker(rows,
+ header,
+ &tablerules[file_type]);
+ }
+
}
else
{
@@ -281,7 +266,7 @@ static void kb_convert_to_table(G_GNUC_UNUSED guint key_id)
{
g_return_if_fail(document_get_current() != NULL);
- convert_to_table(TRUE);
+ convert_to_table(TRUE, -1);
}
@@ -294,27 +279,25 @@ static void init_keybindings(void)
_("Convert selection to table"), NULL);
}
-static void cb_table_convert(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
+void cb_table_convert(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
{
- convert_to_table(TRUE);
+ convert_to_table(TRUE, -1);
+}
+
+void cb_table_convert_type(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
+{
+ convert_to_table(TRUE, GPOINTER_TO_INT(gdata));
}
void plugin_init(GeanyData *data)
{
init_keybindings();
-
- /* Build up menu entry */
- main_menu_item = gtk_menu_item_new_with_mnemonic(_("_Convert to table"));
- gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item);
- ui_widget_set_tooltip_text(main_menu_item,
- _("Converts current marked list to a table."));
- g_signal_connect(G_OBJECT(main_menu_item), "activate", G_CALLBACK(cb_table_convert), NULL);
- gtk_widget_show_all(main_menu_item);
- ui_add_document_sensitive(main_menu_item);
+ init_menuentries();
}
void plugin_cleanup(void)
{
gtk_widget_destroy(main_menu_item);
+ gtk_widget_destroy(menu_tableconvert);
}
Modified: tableconvert/src/tableconvert.h
72 lines changed, 72 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,72 @@
+/*
+ * tableconvert.h
+ *
+ * Copyright 2014 Frank Lanitz <frank(a)frank.uvena.de>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ *
+ */
+
+
+#ifndef TABLECONVERT_H
+#define TABLECONVERT_H
+
+#include <geanyplugin.h>
+#include <gtk/gtk.h>
+
+
+extern GeanyPlugin *geany_plugin;
+extern GeanyData *geany_data;
+extern GeanyFunctions *geany_functions;
+
+
+enum
+{
+ KB_HTMLTABLE_CONVERT_TO_TABLE,
+ COUNT_KB
+};
+
+typedef struct {
+ const gchar *type;
+ const gchar *start;
+ const gchar *header_start;
+ const gchar *header_stop;
+ const gchar *body_start;
+ const gchar *body_end;
+ const gchar *columnsplit;
+ const gchar *linestart;
+ const gchar *lineend;
+ /* linesplit should keep empty until you really need some special
+ * logic there. */
+ const gchar *linesplit;
+ const gchar *end;
+} TableConvertRule;
+
+enum {
+ TC_LATEX = 0,
+ TC_HTML,
+ TC_SQL,
+ TC_END
+};
+
+extern TableConvertRule tablerules[];
+
+extern void cb_table_convert(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata);
+extern void cb_table_convert_type(G_GNUC_UNUSED GtkMenuItem *menuitem, gpointer gdata);
+extern void convert_to_table(gboolean header, gint file_type);
+
+#endif
Modified: tableconvert/src/tableconvert_ui.c
68 lines changed, 68 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,68 @@
+/*
+ * tableconvert_ui.c
+ *
+ * Copyright 2014 Frank Lanitz <frank(a)frank.uvena.de>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ *
+ */
+
+#include "tableconvert_ui.h"
+
+GtkWidget *main_menu_item = NULL;
+GtkWidget *menu_tableconvert = NULL;
+GtkWidget *menu_tableconvert_menu = NULL;
+
+void init_menuentries(void)
+{
+ int i = 0;
+ GtkWidget *tmp = NULL;
+
+ /* Build up menu entry for table_convert based on global file type*/
+ main_menu_item = gtk_menu_item_new_with_mnemonic(_("_Convert to table"));
+ gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item);
+ ui_widget_set_tooltip_text(main_menu_item,
+ _("Converts current marked list to a table."));
+ g_signal_connect(G_OBJECT(main_menu_item), "activate", G_CALLBACK(cb_table_convert), NULL);
+ gtk_widget_show_all(main_menu_item);
+ ui_add_document_sensitive(main_menu_item);
+
+ /* Build up menu entries for table convert based on explicit choice
+ * This is needed for e.g. different wiki-Syntax or differenz stiles
+ * within a special file type */
+
+ menu_tableconvert = gtk_image_menu_item_new_with_mnemonic(_("_More TableConvert"));
+ gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_tableconvert);
+
+ menu_tableconvert_menu = gtk_menu_new ();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_tableconvert),
+ menu_tableconvert_menu);
+
+ for (i = 0; i < TC_END; i++)
+ {
+ tmp = NULL;
+ tmp = gtk_menu_item_new_with_mnemonic(_(tablerules[i].type));
+ gtk_container_add(GTK_CONTAINER(menu_tableconvert_menu), tmp);
+ g_signal_connect(G_OBJECT(tmp), "activate",
+ G_CALLBACK(cb_table_convert_type), GINT_TO_POINTER(i));
+ }
+ ui_add_document_sensitive(menu_tableconvert);
+
+ /* Show the menu */
+ gtk_widget_show_all(menu_tableconvert);
+}
+
Modified: tableconvert/src/tableconvert_ui.h
38 lines changed, 38 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,38 @@
+/*
+ * tableconvert_ui.h
+ *
+ * Copyright 2014 Frank Lanitz <frank(a)frank.uvena.de>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ *
+ */
+
+#ifndef TABLECONVERT_UI_H
+#define TABLECONVERT_UI_H
+
+#include "tableconvert.h"
+
+/* Variables */
+extern GtkWidget *main_menu_item;
+extern GtkWidget *menu_tableconvert;
+extern GtkWidget *menu_tableconvert_menu;
+
+/* functions */
+
+void init_menuentries(void);
+
+#endif
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Frank Lanitz <frank(a)frank.uvena.de>
Committer: Frank Lanitz <frank(a)frank.uvena.de>
Date: Sun, 05 Oct 2014 20:24:35 UTC
Commit: ef82ad2adc0758d0bf3f9ffffbd5d654d9d919fa
https://github.com/geany/geany-plugins/commit/ef82ad2adc0758d0bf3f9ffffbd5d…
Log Message:
-----------
Tableconvert: Update of documentation
Modified Paths:
--------------
tableconvert/README
Modified: tableconvert/README
26 lines changed, 14 insertions(+), 12 deletions(-)
===================================================================
@@ -15,27 +15,32 @@ Installation
------------
This version of the plugin is installed with the combined
-geany-plugins release. Please check README of this package
+geany-plugins release. Please check README of this package.
Usage
-----
-After the plugins has been installed successfully, load the plugin
-via Geany's plugin manager. This will add a new keybinding into
-Geany's list of keybindings inside the preferences dialog. You might
-like to set up a keybinding for the function. Once this is done, the
-plugin is ready to use.
+After the plugins has been installed successfully, load the plugin via
+Geany's plugin manager. This will add a new keybinding into Geany's
+list of keybindings inside the preferences dialog. You might like to
+set up a keybinding for the function. Once this is done, the plugin is
+ready to use. Alternativly it's also possible to use the plugin via the
+menu entry at the Tools menu.
When using the plugin, just mark the area you like to transform and
push your keybinding. All line endings will be taken as end of a row
-and therefor transformed to fitting row endings.
+and therefor transformed to fitting row endings. The plugin is taking
+care of you line ending stil.
Currently the plugin is supporting
* HTML
* LaTeX
* SQL
+Rectangle selections are currently not supported and might lead to
+some weird output you didn't expect -- just don't try it if you have
+heart issues or working on an important document :)
HTML
^^^^
@@ -55,12 +60,9 @@ LaTeX
In case of working with LaTeX line endings will be replaced with \\
and tabulators with &.
-Rectangle selections are currently not supported and might lead to
-some weird output you didn't expect -- just don't try it if you have
-heart issues or working on an important document :)
-However, after you transformed your selection to a table you might
-want to update the number and orientation of columns at begin of
+However, after you transformed your selection to a table you might
+want to update the number and orientation of columns at begin of
tabular-environment.
SQL
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).