Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 08 Oct 2012 15:51:19 Commit: eeddd6f720e1ded79beeec9203b698c9191de624 https://github.com/geany/geany/commit/eeddd6f720e1ded79beeec9203b698c9191de6...
Log Message: ----------- Move custom styles to a resource file
Modified Paths: -------------- Makefile.am data/geany.gtkrc src/notebook.c src/search.c src/ui_utils.c wscript
Modified: Makefile.am 3 files changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -24,7 +24,8 @@ SYS_DATA_FILES = \ $(srcdir)/data/templates/* \ $(srcdir)/data/templates/files/* \ $(srcdir)/data/colorschemes/* \ - $(top_srcdir)/data/geany.glade + $(top_srcdir)/data/geany.glade \ + $(top_srcdir)/data/geany.gtkrc
EXTRA_DIST = \ autogen.sh \
Modified: data/geany.gtkrc 23 files changed, 23 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,23 @@ +# custom GTK2 style for Geany + +# make close button on the editor's tabs smaller +style "geany-close-tab-button-style" { + GtkWidget::focus-padding = 0 + GtkWidget::focus-line-width = 0 + xthickness = 0 + ythickness = 0 +} +widget "*.geany-close-tab-button" style "geany-close-tab-button-style" + +# use monospaced font in search entries for easier reading of regexp (#1907117) +style "geany-monospace" { + font_name = "Monospace" +} +widget "GeanyDialogSearch.*.GtkEntry" style "geany-monospace" + +# set red background for GtkEntries showing unmatched searches +style "geany-search-entry-no-match-style" { + base[NORMAL] = "#ffff66666666" + text[NORMAL] = "#ffffffffffff" +} +widget "*.geany-search-entry-no-match" style "geany-search-entry-no-match-style"
Modified: src/notebook.c 11 files changed, 0 insertions(+), 11 deletions(-) =================================================================== @@ -535,17 +535,6 @@ static gboolean notebook_tab_bar_click_cb(GtkWidget *widget, GdkEventButton *eve
void notebook_init() { - /* Individual style for the tab close buttons */ - gtk_rc_parse_string( - "style "geany-close-tab-button-style" {\n" - " GtkWidget::focus-padding = 0\n" - " GtkWidget::focus-line-width = 0\n" - " xthickness = 0\n" - " ythickness = 0\n" - "}\n" - "widget "*.geany-close-tab-button" style "geany-close-tab-button-style"" - ); - g_signal_connect_after(main_widgets.notebook, "button-press-event", G_CALLBACK(notebook_tab_bar_click_cb), NULL);
Modified: src/search.c 28 files changed, 0 insertions(+), 28 deletions(-) =================================================================== @@ -423,28 +423,6 @@ void search_find_selection(GeanyDocument *doc, gboolean search_backwards) }
-/* this will load a GTK rc style to set a monospace font for text fields(GtkEntry) in all - * search dialogs. This needs to be done only once. - * The monospace font should increase readibility of regular expressions containing spaces, points, - * commas and similar (#1907117). */ -static void load_monospace_style(void) -{ - static const gchar *rcstyle = - "style "geany-monospace"\n" \ - "{\n" \ - " font_name="Monospace"\n" \ - "}\n" \ - "widget "GeanyDialogSearch.*.GtkEntry" style "geany-monospace""; - static gboolean load = TRUE; - - if (load) - { - gtk_rc_parse_string(rcstyle); - load = FALSE; - } -} - - static void on_expander_activated(GtkExpander *exp, gpointer data) { gboolean *setting = data; @@ -458,8 +436,6 @@ static void create_find_dialog(void) GtkWidget *label, *entry, *sbox, *vbox; GtkWidget *exp, *bbox, *button, *check_close;
- load_monospace_style(); - find_dlg.dialog = gtk_dialog_new_with_buttons(_("Find"), GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL); @@ -614,8 +590,6 @@ static void create_replace_dialog(void) *check_close, *button, *rbox, *fbox, *vbox, *exp, *bbox; GtkSizeGroup *label_size;
- load_monospace_style(); - replace_dlg.dialog = gtk_dialog_new_with_buttons(_("Replace"), GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL); @@ -865,8 +839,6 @@ static void create_fif_dialog(void) gchar *encoding_string; guint i;
- load_monospace_style(); - fif_dlg.dialog = gtk_dialog_new_with_buttons( _("Find in Files"), GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
Modified: src/ui_utils.c 26 files changed, 12 insertions(+), 14 deletions(-) =================================================================== @@ -944,20 +944,7 @@ void ui_document_show_hide(GeanyDocument *doc)
void ui_set_search_entry_background(GtkWidget *widget, gboolean success) { - static const GdkColor red = {0, 0xffff, 0x6666, 0x6666}; - static const GdkColor white = {0, 0xffff, 0xffff, 0xffff}; - static gboolean old_value = TRUE; - - g_return_if_fail(widget != NULL); - - /* update only if really needed */ - if (old_value != success) - { - gtk_widget_modify_base(widget, GTK_STATE_NORMAL, success ? NULL : &red); - gtk_widget_modify_text(widget, GTK_STATE_NORMAL, success ? NULL : &white); - - old_value = success; - } + gtk_widget_set_name(widget, success ? NULL : "geany-search-entry-no-match"); }
@@ -2270,8 +2257,19 @@ void ui_init_builder(void) }
+static void init_custom_style(void) +{ + gchar *gtkrc_file = g_build_filename(app->datadir, "geany.gtkrc", NULL); + + gtk_rc_parse(gtkrc_file); + g_free(gtkrc_file); +} + + void ui_init(void) { + init_custom_style(); + init_recent_files();
ui_widgets.statusbar = ui_lookup_widget(main_widgets.window, "statusbar");
Modified: wscript 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -485,6 +485,7 @@ def build(bld): bld.install_files('${DATADIR}/%s' % data_dir, start_dir.ant_glob('filetype*'), cwd=start_dir) bld.install_files('${DATADIR}/%s' % data_dir, start_dir.ant_glob('*.tags'), cwd=start_dir) bld.install_files('${DATADIR}/%s' % data_dir, 'data/geany.glade') + bld.install_files('${DATADIR}/%s' % data_dir, 'data/geany.gtkrc') bld.install_files('${DATADIR}/%s' % data_dir, 'data/snippets.conf') bld.install_files('${DATADIR}/%s' % data_dir, 'data/ui_toolbar.xml') start_dir = bld.path.find_dir('data/colorschemes')
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).