* Merge unstable branch:
- src/build.c: Make build config entries light grey until set. - src/keybindings.c, src/about.c, THANKS: Fix the wrong file being put on top of the stack when switching tabs too quickly (patch from Jiří Techet, thanks). - src/templates.c, data/templates/gpl, data/templates/function, data/templates/changelog, data/templates/bsd, data/templates/fileheader, wscript, Makefile.am: Move general templates from source code into files. Load general templates from system path instead of creating them in the user's config dir. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5025 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
commit
3e87bf9ede
12
ChangeLog
12
ChangeLog
@ -3,6 +3,18 @@
|
|||||||
* src/notebook.c:
|
* src/notebook.c:
|
||||||
Align notebook tab close buttons centred vertically - thanks to
|
Align notebook tab close buttons centred vertically - thanks to
|
||||||
Robux.Biz (galyuk).
|
Robux.Biz (galyuk).
|
||||||
|
* Merge unstable branch:
|
||||||
|
- src/build.c:
|
||||||
|
Make build config entries light grey until set.
|
||||||
|
- src/keybindings.c, src/about.c, THANKS:
|
||||||
|
Fix the wrong file being put on top of the stack when switching tabs
|
||||||
|
too quickly (patch from Jiří Techet, thanks).
|
||||||
|
- src/templates.c, data/templates/gpl, data/templates/function,
|
||||||
|
data/templates/changelog, data/templates/bsd,
|
||||||
|
data/templates/fileheader, wscript, Makefile.am:
|
||||||
|
Move general templates from source code into files.
|
||||||
|
Load general templates from system path instead of creating them in
|
||||||
|
the user's config dir.
|
||||||
|
|
||||||
|
|
||||||
2010-06-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
2010-06-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ SYS_DATA_FILES = \
|
|||||||
data/filetype_extensions.conf \
|
data/filetype_extensions.conf \
|
||||||
data/snippets.conf \
|
data/snippets.conf \
|
||||||
data/ui_toolbar.xml \
|
data/ui_toolbar.xml \
|
||||||
|
$(srcdir)/data/templates/* \
|
||||||
$(srcdir)/data/templates/files/*
|
$(srcdir)/data/templates/files/*
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
@ -63,6 +64,11 @@ install-data-local:
|
|||||||
fi \
|
fi \
|
||||||
done
|
done
|
||||||
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/templates;
|
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/templates;
|
||||||
|
for file in $(srcdir)/data/templates/*; do \
|
||||||
|
if test -f $$file; then \
|
||||||
|
$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/templates/; \
|
||||||
|
fi \
|
||||||
|
done
|
||||||
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/templates/files;
|
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/templates/files;
|
||||||
for file in $(srcdir)/data/templates/files/*; do \
|
for file in $(srcdir)/data/templates/files/*; do \
|
||||||
if test -f $$file; then \
|
if test -f $$file; then \
|
||||||
|
|||||||
7
THANKS
7
THANKS
@ -7,7 +7,8 @@ If any contributors are missing, please email the developers - see the AUTHORS f
|
|||||||
Testers and contributors:
|
Testers and contributors:
|
||||||
-------------------------
|
-------------------------
|
||||||
These people have contributed to Geany by testing the software,
|
These people have contributed to Geany by testing the software,
|
||||||
reporting problems, sending patches and making useful suggestions.
|
reporting problems, sending patches and making useful suggestions:
|
||||||
|
|
||||||
Frank Lanitz <frank(at)frank(dot)uvena(dot)de> - heavy testing
|
Frank Lanitz <frank(at)frank(dot)uvena(dot)de> - heavy testing
|
||||||
Christoph Berg <Christoph(dot)Berg(at)kpm-sport(dot)de> - testing and patch for filetype D
|
Christoph Berg <Christoph(dot)Berg(at)kpm-sport(dot)de> - testing and patch for filetype D
|
||||||
Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> - many patches
|
Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> - many patches
|
||||||
@ -79,10 +80,12 @@ Yoann Le Montagner <yoann(dot)le-montagner(at)m4x(dot)org> - set VTE bold color
|
|||||||
Dimitar Zhekov <hamster(at)mbox(dot)contact(dot)bg> - matching brace improvements patch
|
Dimitar Zhekov <hamster(at)mbox(dot)contact(dot)bg> - matching brace improvements patch
|
||||||
Ondrej Donek <ondrejd(at)gmail(dot)com> - Support for creating PHP classes with the classbuilder plugin
|
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
|
Daniel Marjamaki <danielm77(at)spray(dot)se> - Small improvements
|
||||||
|
Jiří Techet <techet(at)gmail(dot)com> - Fix switch to last used tab ordering bug
|
||||||
|
|
||||||
Translators:
|
Translators:
|
||||||
------------
|
------------
|
||||||
These people have translated Geany to foreign languages.
|
These people have translated Geany to foreign languages:
|
||||||
|
|
||||||
Marcos Costales <marcoscostales(at)gmail(dot)com - ast
|
Marcos Costales <marcoscostales(at)gmail(dot)com - ast
|
||||||
Yura Siamashka <yurand2(at)gmail(dot)com> - be_BY
|
Yura Siamashka <yurand2(at)gmail(dot)com> - be_BY
|
||||||
Dilyan Rusev <dilyanrusev(at)gmail(dot)com> - bg
|
Dilyan Rusev <dilyanrusev(at)gmail(dot)com> - bg
|
||||||
|
|||||||
26
data/templates/bsd
Normal file
26
data/templates/bsd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of the {company} nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
6
data/templates/changelog
Normal file
6
data/templates/changelog
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{date} {developer} <{mail}>
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
5
data/templates/fileheader
Normal file
5
data/templates/fileheader
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{filename}
|
||||||
|
|
||||||
|
Copyright {year} {developer} <{mail}>
|
||||||
|
|
||||||
|
{gpl}
|
||||||
5
data/templates/function
Normal file
5
data/templates/function
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
name: {functionname}
|
||||||
|
@param
|
||||||
|
@return
|
||||||
|
|
||||||
15
data/templates/gpl
Normal file
15
data/templates/gpl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
@ -89,7 +89,8 @@ static const gchar *contributors =
|
|||||||
"Daniel Marjamaki, Dave Moore, "
|
"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, Eugene Arshinov, Felipe Pena, François Cami, "
|
||||||
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
|
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
|
||||||
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
|
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, Jiří Techet, "
|
||||||
|
"John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
|
||||||
"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, Marko Peric, Matti Mårds, "
|
"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, Marko Peric, Matti Mårds, "
|
||||||
"Moritz Barsnick, Ondrej Donek, Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, "
|
"Moritz Barsnick, Ondrej Donek, Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, "
|
||||||
"Robert McGinley, Roland Baudin, Ross McKay, S Jagannathan, Saleem Abdulrasool, "
|
"Robert McGinley, Roland Baudin, Ross McKay, S Jagannathan, Saleem Abdulrasool, "
|
||||||
|
|||||||
72
src/build.c
72
src/build.c
@ -1727,9 +1727,19 @@ typedef struct RowWidgets
|
|||||||
gint grp;
|
gint grp;
|
||||||
gint cmd;
|
gint cmd;
|
||||||
gboolean cleared;
|
gboolean cleared;
|
||||||
|
gboolean used_dst;
|
||||||
} RowWidgets;
|
} RowWidgets;
|
||||||
|
|
||||||
|
|
||||||
|
static void set_row_color(RowWidgets *r, GdkColor *color )
|
||||||
|
{
|
||||||
|
enum GeanyBuildCmdEntries i;
|
||||||
|
|
||||||
|
for (i = 0; i < GEANY_BC_CMDENTRIES_COUNT; i++)
|
||||||
|
gtk_widget_modify_text(r->entries[i], GTK_STATE_NORMAL, color);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void set_build_command_entry_text(GtkWidget *wid, const gchar *text)
|
static void set_build_command_entry_text(GtkWidget *wid, const gchar *text)
|
||||||
{
|
{
|
||||||
if (GTK_IS_BUTTON(wid))
|
if (GTK_IS_BUTTON(wid))
|
||||||
@ -1744,6 +1754,7 @@ static void on_clear_dialog_row(GtkWidget *unused, gpointer user_data)
|
|||||||
RowWidgets *r = (RowWidgets*)user_data;
|
RowWidgets *r = (RowWidgets*)user_data;
|
||||||
gint src;
|
gint src;
|
||||||
enum GeanyBuildCmdEntries i;
|
enum GeanyBuildCmdEntries i;
|
||||||
|
GdkColor color;
|
||||||
GeanyBuildCommand *bc = get_next_build_cmd(NULL, r->grp, r->cmd, r->dst, &src);
|
GeanyBuildCommand *bc = get_next_build_cmd(NULL, r->grp, r->cmd, r->dst, &src);
|
||||||
|
|
||||||
if (bc != NULL)
|
if (bc != NULL)
|
||||||
@ -1764,6 +1775,9 @@ static void on_clear_dialog_row(GtkWidget *unused, gpointer user_data)
|
|||||||
set_build_command_entry_text(r->entries[i], "");
|
set_build_command_entry_text(r->entries[i], "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
r->used_dst = FALSE;
|
||||||
|
gdk_color_parse("light grey", &color);
|
||||||
|
set_row_color(r, &color);
|
||||||
r->cleared = TRUE;
|
r->cleared = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1774,13 +1788,25 @@ static void on_clear_dialog_regex_row(GtkEntry *regex, gpointer unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void on_label_button_clicked(GtkWidget *wid)
|
static void on_label_button_clicked(GtkWidget *wid, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
RowWidgets *r = (RowWidgets*)user_data;
|
||||||
const gchar *old = gtk_button_get_label(GTK_BUTTON(wid));
|
const gchar *old = gtk_button_get_label(GTK_BUTTON(wid));
|
||||||
gchar *str = dialogs_show_input(_("Set menu item label"), NULL, old);
|
gchar *str = dialogs_show_input(_("Set menu item label"), NULL, old);
|
||||||
|
|
||||||
gtk_button_set_label(GTK_BUTTON(wid), str);
|
gtk_button_set_label(GTK_BUTTON(wid), str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
|
r->used_dst = TRUE;
|
||||||
|
set_row_color(r, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void on_entry_focus(GtkWidget *wid, GdkEventFocus *unused, gpointer user_data)
|
||||||
|
{
|
||||||
|
RowWidgets *r = (RowWidgets*)user_data;
|
||||||
|
|
||||||
|
r->used_dst = TRUE;
|
||||||
|
set_row_color(r, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1812,6 +1838,7 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gui
|
|||||||
gint src;
|
gint src;
|
||||||
enum GeanyBuildCmdEntries i;
|
enum GeanyBuildCmdEntries i;
|
||||||
guint column = 0;
|
guint column = 0;
|
||||||
|
GdkColor color;
|
||||||
|
|
||||||
label = gtk_label_new(g_strdup_printf("%d:", cmd + 1));
|
label = gtk_label_new(g_strdup_printf("%d:", cmd + 1));
|
||||||
gtk_table_attach(table, label, column, column + 1, row, row + 1, GTK_FILL,
|
gtk_table_attach(table, label, column, column + 1, row, row + 1, GTK_FILL,
|
||||||
@ -1831,10 +1858,13 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gui
|
|||||||
GtkWidget *wid = roww->entries[i] = gtk_button_new();
|
GtkWidget *wid = roww->entries[i] = gtk_button_new();
|
||||||
gtk_button_set_use_underline(GTK_BUTTON(wid), TRUE);
|
gtk_button_set_use_underline(GTK_BUTTON(wid), TRUE);
|
||||||
ui_widget_set_tooltip_text(wid, _("Click to set menu item label"));
|
ui_widget_set_tooltip_text(wid, _("Click to set menu item label"));
|
||||||
g_signal_connect(wid, "clicked", G_CALLBACK(on_label_button_clicked), NULL);
|
g_signal_connect(wid, "clicked", G_CALLBACK(on_label_button_clicked), roww);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
roww->entries[i] = gtk_entry_new();
|
roww->entries[i] = gtk_entry_new();
|
||||||
|
g_signal_connect(roww->entries[i], "focus-in-event", G_CALLBACK(on_entry_focus), roww);
|
||||||
|
}
|
||||||
gtk_table_attach(table, roww->entries[i], column, column + 1, row, row + 1, xflags,
|
gtk_table_attach(table, roww->entries[i], column, column + 1, row, row + 1, xflags,
|
||||||
GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding);
|
GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding);
|
||||||
}
|
}
|
||||||
@ -1852,10 +1882,19 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gui
|
|||||||
for (i = 0; i < GEANY_BC_CMDENTRIES_COUNT; i++)
|
for (i = 0; i < GEANY_BC_CMDENTRIES_COUNT; i++)
|
||||||
{
|
{
|
||||||
const gchar *str = "";
|
const gchar *str = "";
|
||||||
if (bc != NULL && (str = bc->entries[i]) == NULL)
|
|
||||||
str = "";
|
if (bc != NULL )
|
||||||
|
{
|
||||||
|
if ((str = bc->entries[i]) == NULL)
|
||||||
|
str = "";
|
||||||
|
else if ((gint)dst == src)
|
||||||
|
roww->used_dst = TRUE;
|
||||||
|
}
|
||||||
set_build_command_entry_text(roww->entries[i], str);
|
set_build_command_entry_text(roww->entries[i], str);
|
||||||
}
|
}
|
||||||
|
gdk_color_parse("light grey", &color);
|
||||||
|
if (bc != NULL && ((gint)dst > src))
|
||||||
|
set_row_color(roww, &color);
|
||||||
if (bc != NULL && (src > (gint)dst || (grp == GEANY_GBG_FT && (doc == NULL || doc->file_type == NULL))))
|
if (bc != NULL && (src > (gint)dst || (grp == GEANY_GBG_FT && (doc == NULL || doc->file_type == NULL))))
|
||||||
{
|
{
|
||||||
for (i = 0; i < GEANY_BC_CMDENTRIES_COUNT; i++)
|
for (i = 0; i < GEANY_BC_CMDENTRIES_COUNT; i++)
|
||||||
@ -2014,6 +2053,7 @@ void build_free_fields(BuildTableData table_data)
|
|||||||
|
|
||||||
|
|
||||||
/* string compare where null pointers match null or 0 length strings */
|
/* string compare where null pointers match null or 0 length strings */
|
||||||
|
#if 0
|
||||||
static gint stcmp(const gchar *a, const gchar *b)
|
static gint stcmp(const gchar *a, const gchar *b)
|
||||||
{
|
{
|
||||||
if (a == NULL && b == NULL)
|
if (a == NULL && b == NULL)
|
||||||
@ -2024,6 +2064,7 @@ static gint stcmp(const gchar *a, const gchar *b)
|
|||||||
return strlen(a);
|
return strlen(a);
|
||||||
return strcmp(a, b);
|
return strcmp(a, b);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const gchar *get_build_command_entry_text(GtkWidget *wid)
|
static const gchar *get_build_command_entry_text(GtkWidget *wid)
|
||||||
@ -2059,28 +2100,7 @@ static gboolean read_row(BuildDestination *dst, BuildTableData table_data, gint
|
|||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (table_data->rows[drow]->used_dst == TRUE)
|
||||||
(
|
|
||||||
table_data->rows[drow]->cmdsrc == NULL /* originally there was no content */
|
|
||||||
&&
|
|
||||||
(
|
|
||||||
NZV(entries[GEANY_BC_LABEL]) /* but now one field has some */
|
|
||||||
|| NZV(entries[GEANY_BC_COMMAND])
|
|
||||||
|| NZV(entries[GEANY_BC_WORKING_DIR])
|
|
||||||
)
|
|
||||||
)
|
|
||||||
||
|
|
||||||
(
|
|
||||||
table_data->rows[drow]->cmdsrc != NULL /* originally there was content */
|
|
||||||
&&
|
|
||||||
( /* and some of it was changed */
|
|
||||||
stcmp(entries[GEANY_BC_LABEL], table_data->rows[drow]->cmdsrc->entries[GEANY_BC_LABEL]) != 0
|
|
||||||
|| stcmp(entries[GEANY_BC_COMMAND], table_data->rows[drow]->cmdsrc->entries[GEANY_BC_COMMAND]) != 0
|
|
||||||
|| stcmp(entries[GEANY_BC_WORKING_DIR],
|
|
||||||
table_data->rows[drow]->cmdsrc->entries[GEANY_BC_WORKING_DIR]) != 0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (dst->dst[grp] != NULL)
|
if (dst->dst[grp] != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,7 +71,7 @@ const gsize MAX_MRU_DOCS = 20;
|
|||||||
static GQueue *mru_docs = NULL;
|
static GQueue *mru_docs = NULL;
|
||||||
static guint mru_pos = 0;
|
static guint mru_pos = 0;
|
||||||
|
|
||||||
static gboolean switch_dialog_cancelled = TRUE;
|
static gboolean switch_in_progress = FALSE;
|
||||||
static GtkWidget *switch_dialog = NULL;
|
static GtkWidget *switch_dialog = NULL;
|
||||||
static GtkWidget *switch_dialog_label = NULL;
|
static GtkWidget *switch_dialog_label = NULL;
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ static void on_notebook_switch_page(void)
|
|||||||
|
|
||||||
/* when closing current doc, old is NULL.
|
/* when closing current doc, old is NULL.
|
||||||
* Don't add to the mru list when switch dialog is visible. */
|
* Don't add to the mru list when switch dialog is visible. */
|
||||||
if (old && switch_dialog_cancelled)
|
if (old && !switch_in_progress)
|
||||||
{
|
{
|
||||||
g_queue_remove(mru_docs, old);
|
g_queue_remove(mru_docs, old);
|
||||||
g_queue_push_head(mru_docs, old);
|
g_queue_push_head(mru_docs, old);
|
||||||
@ -879,7 +879,7 @@ static GtkWidget *create_dialog(void)
|
|||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||||
|
|
||||||
text_renderer = gtk_cell_renderer_text_new();
|
text_renderer = gtk_cell_renderer_text_new();
|
||||||
column = gtk_tree_view_column_new_with_attributes(NULL, text_renderer, "text", 1, NULL);
|
column = gtk_tree_view_column_new_with_attributes(NULL, text_renderer, "text", 1, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||||
|
|
||||||
fill_shortcut_labels_treeview(tree);
|
fill_shortcut_labels_treeview(tree);
|
||||||
@ -1751,12 +1751,15 @@ static void cb_func_switch_tabright(G_GNUC_UNUSED guint key_id)
|
|||||||
static gboolean on_key_release_event(GtkWidget *widget, GdkEventKey *ev, gpointer user_data)
|
static gboolean on_key_release_event(GtkWidget *widget, GdkEventKey *ev, gpointer user_data)
|
||||||
{
|
{
|
||||||
/* user may have rebound keybinding to a different modifier than Ctrl, so check all */
|
/* user may have rebound keybinding to a different modifier than Ctrl, so check all */
|
||||||
if (!switch_dialog_cancelled && is_modifier_key(ev->keyval))
|
if (switch_in_progress && is_modifier_key(ev->keyval))
|
||||||
{
|
{
|
||||||
switch_dialog_cancelled = TRUE;
|
switch_in_progress = FALSE;
|
||||||
|
|
||||||
if (switch_dialog && GTK_WIDGET_VISIBLE(switch_dialog))
|
if (switch_dialog)
|
||||||
gtk_widget_hide(switch_dialog);
|
{
|
||||||
|
gtk_widget_destroy(switch_dialog);
|
||||||
|
switch_dialog = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
mru_pos = 0;
|
mru_pos = 0;
|
||||||
}
|
}
|
||||||
@ -1809,23 +1812,27 @@ static GtkWidget *create_switch_dialog(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean on_switch_timeout(G_GNUC_UNUSED gpointer data)
|
static void update_filename_label()
|
||||||
{
|
{
|
||||||
if (switch_dialog_cancelled)
|
if (!switch_dialog)
|
||||||
{
|
{
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (! switch_dialog || !GTK_WIDGET_VISIBLE(switch_dialog))
|
|
||||||
mru_pos = 2; /* skip past the previous document */
|
|
||||||
else
|
|
||||||
mru_pos += 1;
|
|
||||||
|
|
||||||
if (! switch_dialog)
|
|
||||||
switch_dialog = create_switch_dialog();
|
switch_dialog = create_switch_dialog();
|
||||||
|
gtk_widget_show_all(switch_dialog);
|
||||||
|
}
|
||||||
|
|
||||||
geany_wrap_label_set_text(GTK_LABEL(switch_dialog_label),
|
geany_wrap_label_set_text(GTK_LABEL(switch_dialog_label),
|
||||||
DOC_FILENAME(document_get_current()));
|
DOC_FILENAME(document_get_current()));
|
||||||
gtk_widget_show_all(switch_dialog);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean on_switch_timeout(G_GNUC_UNUSED gpointer data)
|
||||||
|
{
|
||||||
|
if (!switch_in_progress || switch_dialog)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
update_filename_label();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1848,19 +1855,25 @@ static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
|
|||||||
|
|
||||||
/* if there's a modifier key, we can switch back in MRU order each time unless
|
/* if there's a modifier key, we can switch back in MRU order each time unless
|
||||||
* the key is released */
|
* the key is released */
|
||||||
if (! switch_dialog_cancelled)
|
if (!switch_in_progress)
|
||||||
{
|
{
|
||||||
on_switch_timeout(NULL); /* update filename label */
|
switch_in_progress = TRUE;
|
||||||
}
|
|
||||||
else
|
/* because switch_in_progress was not set when we called
|
||||||
if (keybindings_lookup_item(GEANY_KEY_GROUP_NOTEBOOK,
|
* gtk_notebook_set_current_page() above, this function inserted last_doc
|
||||||
GEANY_KEYS_NOTEBOOK_SWITCHTABLASTUSED)->mods)
|
* into the queue => on mru_pos = 0 there is last_doc, on mru_pos = 1
|
||||||
{
|
* there is the currently displayed doc, so we want to continue from 2
|
||||||
switch_dialog_cancelled = FALSE;
|
* next time this function is called */
|
||||||
|
mru_pos = 2;
|
||||||
|
|
||||||
/* delay showing dialog to give user time to let go of any modifier keys */
|
/* delay showing dialog to give user time to let go of any modifier keys */
|
||||||
g_timeout_add(600, on_switch_timeout, NULL);
|
g_timeout_add(600, on_switch_timeout, NULL);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
update_filename_label();
|
||||||
|
mru_pos += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,11 +102,6 @@ name: {functionname}\n\
|
|||||||
@return\n\
|
@return\n\
|
||||||
";
|
";
|
||||||
|
|
||||||
static const gchar templates_multiline[] = "\
|
|
||||||
\n\
|
|
||||||
\n\
|
|
||||||
";
|
|
||||||
|
|
||||||
static const gchar templates_fileheader[] = "\
|
static const gchar templates_fileheader[] = "\
|
||||||
{filename}\n\
|
{filename}\n\
|
||||||
\n\
|
\n\
|
||||||
@ -145,24 +140,30 @@ static void templates_replace_command(GString *text, const gchar *file_name,
|
|||||||
g_file_get_contents(fname, contents_ptr, NULL, NULL);
|
g_file_get_contents(fname, contents_ptr, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
static void create_template_file_if_necessary(const gchar *filename, const gchar *content)
|
static void read_template(const gchar *name, gint id)
|
||||||
{
|
{
|
||||||
if (! g_file_test(filename, G_FILE_TEST_EXISTS))
|
gchar *fname = TEMPLATES_GET_FILENAME(name);
|
||||||
{
|
|
||||||
if (file_prefs.default_eol_character != SC_EOL_LF)
|
|
||||||
{
|
|
||||||
/* Replace the \n characters in the default template text by the proper
|
|
||||||
* platform-specific line ending characters. */
|
|
||||||
GString *tmp = g_string_new(content);
|
|
||||||
const gchar *eol_str = (file_prefs.default_eol_character == SC_EOL_CR) ? "\r" : "\r\n";
|
|
||||||
|
|
||||||
utils_string_replace_all(tmp, "\n", eol_str);
|
/* try system if user template doesn't exist */
|
||||||
utils_write_file(filename, tmp->str);
|
if (!g_file_test(fname, G_FILE_TEST_EXISTS))
|
||||||
g_string_free(tmp, TRUE);
|
setptr(fname, g_strconcat(app->datadir,
|
||||||
}
|
G_DIR_SEPARATOR_S GEANY_TEMPLATES_SUBDIR G_DIR_SEPARATOR_S, name, NULL));
|
||||||
else
|
|
||||||
utils_write_file(filename, content);
|
TEMPLATES_READ_FILE(fname, &templates[id]);
|
||||||
|
|
||||||
|
/* FIXME: we should replace the line ends on insertion with doc pref, not on loading */
|
||||||
|
if (file_prefs.default_eol_character != SC_EOL_LF)
|
||||||
|
{
|
||||||
|
/* Replace the \n characters in the default template text by the proper
|
||||||
|
* platform-specific line ending characters. */
|
||||||
|
GString *tmp = g_string_new(templates[id]);
|
||||||
|
const gchar *eol_str = (file_prefs.default_eol_character == SC_EOL_CR) ? "\r" : "\r\n";
|
||||||
|
|
||||||
|
utils_string_replace_all(tmp, "\n", eol_str);
|
||||||
|
setptr(templates[id], tmp->str);
|
||||||
|
g_string_free(tmp, FALSE);
|
||||||
}
|
}
|
||||||
|
g_free(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,41 +190,18 @@ static gchar *replace_all(gchar *text, const gchar *year, const gchar *date, con
|
|||||||
|
|
||||||
static void init_general_templates(const gchar *year, const gchar *date, const gchar *datetime)
|
static void init_general_templates(const gchar *year, const gchar *date, const gchar *datetime)
|
||||||
{
|
{
|
||||||
gchar *template_filename_fileheader = TEMPLATES_GET_FILENAME("fileheader");
|
guint id;
|
||||||
gchar *template_filename_gpl = TEMPLATES_GET_FILENAME("gpl");
|
|
||||||
gchar *template_filename_bsd = TEMPLATES_GET_FILENAME("bsd");
|
|
||||||
gchar *template_filename_function = TEMPLATES_GET_FILENAME("function");
|
|
||||||
gchar *template_filename_changelog = TEMPLATES_GET_FILENAME("changelog");
|
|
||||||
|
|
||||||
/* create the template files in the configuration directory, if they don't exist */
|
|
||||||
create_template_file_if_necessary(template_filename_fileheader, templates_fileheader);
|
|
||||||
create_template_file_if_necessary(template_filename_gpl, templates_gpl_notice);
|
|
||||||
create_template_file_if_necessary(template_filename_bsd, templates_bsd_notice);
|
|
||||||
create_template_file_if_necessary(template_filename_function, templates_function_description);
|
|
||||||
create_template_file_if_necessary(template_filename_changelog, templates_changelog);
|
|
||||||
|
|
||||||
/* read the contents */
|
/* read the contents */
|
||||||
TEMPLATES_READ_FILE(template_filename_fileheader, &templates[GEANY_TEMPLATE_FILEHEADER]);
|
read_template("fileheader", GEANY_TEMPLATE_FILEHEADER);
|
||||||
templates[GEANY_TEMPLATE_FILEHEADER] = replace_all(templates[GEANY_TEMPLATE_FILEHEADER], year, date, datetime);
|
read_template("gpl", GEANY_TEMPLATE_GPL);
|
||||||
|
read_template("bsd", GEANY_TEMPLATE_BSD);
|
||||||
|
read_template("function", GEANY_TEMPLATE_FUNCTION);
|
||||||
|
read_template("changelog", GEANY_TEMPLATE_CHANGELOG);
|
||||||
|
|
||||||
TEMPLATES_READ_FILE(template_filename_gpl, &templates[GEANY_TEMPLATE_GPL]);
|
/* FIXME: we should replace the dates on insertion, not on loading */
|
||||||
templates[GEANY_TEMPLATE_GPL] = replace_all(templates[GEANY_TEMPLATE_GPL], year, date, datetime);
|
for (id = 0; id < GEANY_MAX_TEMPLATES; id++)
|
||||||
|
templates[id] = replace_all(templates[id], year, date, datetime);
|
||||||
TEMPLATES_READ_FILE(template_filename_bsd, &templates[GEANY_TEMPLATE_BSD]);
|
|
||||||
templates[GEANY_TEMPLATE_BSD] = replace_all(templates[GEANY_TEMPLATE_BSD], year, date, datetime);
|
|
||||||
|
|
||||||
TEMPLATES_READ_FILE(template_filename_function, &templates[GEANY_TEMPLATE_FUNCTION]);
|
|
||||||
templates[GEANY_TEMPLATE_FUNCTION] = replace_all(templates[GEANY_TEMPLATE_FUNCTION], year, date, datetime);
|
|
||||||
|
|
||||||
TEMPLATES_READ_FILE(template_filename_changelog, &templates[GEANY_TEMPLATE_CHANGELOG]);
|
|
||||||
templates[GEANY_TEMPLATE_CHANGELOG] = replace_all(templates[GEANY_TEMPLATE_CHANGELOG], year, date, datetime);
|
|
||||||
|
|
||||||
/* free the whole stuff */
|
|
||||||
g_free(template_filename_fileheader);
|
|
||||||
g_free(template_filename_gpl);
|
|
||||||
g_free(template_filename_bsd);
|
|
||||||
g_free(template_filename_function);
|
|
||||||
g_free(template_filename_changelog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
wscript
1
wscript
@ -518,6 +518,7 @@ def build(bld):
|
|||||||
bld.install_files('${DATADIR}/%s' % dir, 'data/*.tags')
|
bld.install_files('${DATADIR}/%s' % dir, 'data/*.tags')
|
||||||
bld.install_files('${DATADIR}/%s' % dir, 'data/snippets.conf')
|
bld.install_files('${DATADIR}/%s' % dir, 'data/snippets.conf')
|
||||||
bld.install_files('${DATADIR}/%s' % dir, 'data/ui_toolbar.xml')
|
bld.install_files('${DATADIR}/%s' % dir, 'data/ui_toolbar.xml')
|
||||||
|
bld.install_files('${DATADIR}/%s/templates' % dir, 'data/templates/*')
|
||||||
bld.install_files('${DATADIR}/%s/templates/files' % dir, 'data/templates/files/*.*')
|
bld.install_files('${DATADIR}/%s/templates/files' % dir, 'data/templates/files/*.*')
|
||||||
bld.install_as('${DATADIR}/%s/GPL-2' % dir, 'COPYING')
|
bld.install_as('${DATADIR}/%s/GPL-2' % dir, 'COPYING')
|
||||||
# Icons
|
# Icons
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user