Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions git-changebar/data/prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<object class="GtkVBox" id="base">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="spacing">7</property>
<child>
<object class="GtkCheckButton" id="monitoring-check">
<property name="label" translatable="yes">_Monitor repository for changes</property>
Expand All @@ -23,6 +23,23 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="system-colors">
<property name="label" translatable="yes">_Use System Colors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Use colors set in colorscheme for line_added, line_removed, line_changed</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
Expand Down Expand Up @@ -173,7 +190,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
Expand Down
21 changes: 21 additions & 0 deletions git-changebar/src/gcb-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <geanyplugin.h>
#include <geany.h>
#include <document.h>
#include <SciLexer.h>

#ifdef LIBGIT2_VER_MINOR
# define CHECK_LIBGIT2_VERSION(MAJOR, MINOR) \
Expand Down Expand Up @@ -187,6 +188,7 @@ static GAsyncQueue *G_queue = NULL;
static GThread *G_thread = NULL;
static gulong G_source_id = 0;
static gboolean G_monitoring_enabled = TRUE;
static gboolean G_system_colors = TRUE;
static GtkWidget *G_undo_menu_item = NULL;
static struct {
gint num;
Expand All @@ -213,6 +215,8 @@ static const struct {
} G_settings_desc[] = {
{ "general", "monitor-repository", &G_monitoring_enabled,
read_setting_boolean, write_setting_boolean },
{ "general", "system-colors", &G_system_colors,
read_setting_boolean, write_setting_boolean },
{ "colors", "line-added", &G_markers[MARKER_LINE_ADDED].color,
read_setting_color, write_setting_color },
{ "colors", "line-changed", &G_markers[MARKER_LINE_CHANGED].color,
Expand Down Expand Up @@ -648,6 +652,8 @@ release_resources (ScintillaObject *sci)

for (j = 0; j < MARKER_COUNT; j++) {
if (G_markers[j].num >= 0) {
scintilla_send_message (sci, SCI_MARKERDELETEALL,
G_markers[j].num, 0);
scintilla_send_message (sci, SCI_MARKERDEFINE,
G_markers[j].num, SC_MARK_AVAILABLE);
}
Expand Down Expand Up @@ -1065,6 +1071,16 @@ on_editor_notify (GObject *obj,
SCNotification *nt,
gpointer user_data)
{
/*geany doesnt emit a signal on colorscheme change*/
if(G_system_colors){
const GeanyLexerStyle * diffadd_style = highlighting_get_style ( GEANY_FILETYPES_DIFF, SCE_DIFF_ADDED);
scintilla_send_message (editor->sci, SCI_MARKERSETBACK, G_markers[MARKER_LINE_ADDED].num, diffadd_style->foreground);
const GeanyLexerStyle * diffchg_style = highlighting_get_style ( GEANY_FILETYPES_DIFF, SCE_DIFF_CHANGED);
scintilla_send_message (editor->sci, SCI_MARKERSETBACK, G_markers[MARKER_LINE_CHANGED].num, diffchg_style->foreground);
const GeanyLexerStyle * diffdel_style = highlighting_get_style ( GEANY_FILETYPES_DIFF, SCE_DIFF_DELETED);
scintilla_send_message (editor->sci, SCI_MARKERSETBACK, G_markers[MARKER_LINE_REMOVED].num, diffdel_style->foreground);
}

if (nt->nmhdr.code == SCN_CHARADDED ||
(nt->nmhdr.code == SCN_MODIFIED &&
nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT))) {
Expand Down Expand Up @@ -1613,6 +1629,7 @@ typedef struct ConfigureWidgets ConfigureWidgets;
struct ConfigureWidgets {
GtkWidget *base;
GtkWidget *monitoring_check;
GtkWidget *system_colors;
GtkWidget *added_color_button;
GtkWidget *changed_color_button;
GtkWidget *removed_color_button;
Expand Down Expand Up @@ -1654,6 +1671,7 @@ on_plugin_configure_response (GtkDialog *dialog,
GeanyDocument *doc = document_get_current ();

G_monitoring_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cw->monitoring_check));
G_system_colors = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cw->system_colors));
gtk_color_button_get_color (GTK_COLOR_BUTTON (cw->added_color_button),
&color);
G_markers[MARKER_LINE_ADDED].color = color_to_int (&color);
Expand Down Expand Up @@ -1715,6 +1733,7 @@ plugin_configure (GtkDialog *dialog)
} map[] = {
{ "base", &cw->base },
{ "monitoring-check", &cw->monitoring_check },
{ "system-colors", &cw->system_colors },
{ "added-color-button", &cw->added_color_button },
{ "changed-color-button", &cw->changed_color_button },
{ "removed-color-button", &cw->removed_color_button },
Expand All @@ -1727,6 +1746,8 @@ plugin_configure (GtkDialog *dialog)

gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->monitoring_check),
G_monitoring_enabled);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->system_colors),
G_system_colors);
color_from_int (&color, G_markers[MARKER_LINE_ADDED].color);
gtk_color_button_set_color (GTK_COLOR_BUTTON (cw->added_color_button),
&color);
Expand Down