[gnome-builder/wip/slaf/spellcheck-sidebar: 16/33] spellchecker: theming
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/spellcheck-sidebar: 16/33] spellchecker: theming
- Date: Wed, 11 Jan 2017 20:48:11 +0000 (UTC)
commit 11abf9bd64759184b000c626b03cbeae23b8c8ea
Author: Sébastien Lafargue <slafargue gnome org>
Date: Fri Jan 6 19:23:40 2017 +0100
spellchecker: theming
data/theme/shared.css | 45 +++++++-----
libide/editor/ide-editor-spell-widget.c | 32 +++++----
libide/editor/ide-editor-spell-widget.ui | 109 ++++++++++++++++++++----------
3 files changed, 117 insertions(+), 69 deletions(-)
---
diff --git a/data/theme/shared.css b/data/theme/shared.css
index 64ec952..983a560 100644
--- a/data/theme/shared.css
+++ b/data/theme/shared.css
@@ -3,8 +3,8 @@ filechooser actionbar button.combo {
padding: 0;
}
-/* styling for editor search and spellchecker */
-frame.gb-search-frame, frame.gb-spell-frame {
+/* styling for editor search */
+frame.gb-search-frame {
background-image: linear-gradient(shade(@theme_bg_color,1.05), @theme_bg_color);
padding: 6px;
border-style: solid;
@@ -15,24 +15,15 @@ frame.gb-search-frame, frame.gb-spell-frame {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
-frame.gb-search-frame border,
-frame.gb-spell-frame border {
+frame.gb-search-frame border {
border: none;
}
-frame.gb-spell-frame list {
- border: 1px solid @borders;
-}
-
-frame.gb-spell-option-frame border {
- border: 1px solid @borders;
-}
-
-/* styling for the search and spellchecker frame close button */
+/* styling for the search and spellchecker list close button */
frame.gb-search-frame > box > grid:first-child > button.close:disabled,
-frame.gb-spell-frame > box > grid:first-child > button.close:disabled,
+.gb-spellchecker list button.close:disabled,
frame.gb-search-frame > box > grid:first-child > button.close,
-frame.gb-spell-frame > box > grid:first-child > button.close {
+.gb-spellchecker list button.close {
background: none;
border: none;
box-shadow: none;
@@ -40,7 +31,7 @@ frame.gb-spell-frame > box > grid:first-child > button.close {
padding-right: 4px;
}
frame.gb-search-frame > box > grid:first-child > button.close image,
-frame.gb-spell-frame > box > grid:first-child > button.close image {
+.gb-spellchecker list button.close image {
color: @theme_fg_color;
opacity: 0.3;
margin: 2px;
@@ -48,21 +39,37 @@ frame.gb-spell-frame > box > grid:first-child > button.close image {
border-radius: 3px;
}
frame.gb-search-frame > box > grid:first-child > button.close:hover image,
-frame.gb-spell-frame > box > grid:first-child > button.close:hover image {
+.gb-spellchecker list button.close:hover image {
opacity: .75;
transition-duration: 250ms;
border: 1px solid @borders;
}
frame.gb-search-frame > box > grid:first-child > button.close:active image,
-frame.gb-spell-frame > box > grid:first-child > button.close:active image {
+.gb-spellchecker list button.close:active image {
opacity: .8;
background-image: linear-gradient(shade(@theme_bg_color, 0.9), @theme_bg_color);
}
frame.gb-search-frame > box > grid:first-child > button.close:backdrop image,
-frame.gb-spell-frame > box > grid:first-child > button.close:backdrop image {
+.gb-spellchecker list button.close:backdrop image {
opacity: .1;
}
+/* styling for spellchecker */
+.gb-spellchecker list row label {
+ padding: 7px;
+}
+.gb-spellchecker list row {
+ border-bottom: 1px solid alpha(@borders, 0.2);
+}
+.gb-spellchecker list row:last-child {
+ border-bottom: none;
+}
+.countbox {
+ background-color: #b3d4fc;
+ border-radius: 3px;
+ padding: 3px;
+}
+
/* styling for NautilusFloatingBar */
.floating-bar {
padding: 2px;
diff --git a/libide/editor/ide-editor-spell-widget.c b/libide/editor/ide-editor-spell-widget.c
index 7372a84..ba3c5ef 100644
--- a/libide/editor/ide-editor-spell-widget.c
+++ b/libide/editor/ide-editor-spell-widget.c
@@ -52,12 +52,13 @@ struct _IdeEditorSpellWidget
GtkButton *change_button;
GtkButton *change_all_button;
GtkListBox *suggestions_box;
+ GtkBox *count_box;
GtkWidget *dict_word_entry;
GtkWidget *dict_add_button;
GtkWidget *dict_words_list;
- GtkButton *highlight_checkbutton;
+ GtkButton *highlight_switch;
GtkButton *language_chooser_button;
GtkWidget *placeholder;
@@ -184,14 +185,15 @@ update_count_label (IdeEditorSpellWidget *self)
g_autofree gchar *count_text = NULL;
if (count > 1000)
- count_text = g_strdup ("(>1000)");
+ count_text = g_strdup (">1000");
else
- count_text = g_strdup_printf ("(%i)", count);
+ count_text = g_strdup_printf ("%i", count);
gtk_label_set_text (self->count_label, count_text);
+ gtk_widget_set_visible (GTK_WIDGET (self->count_box), TRUE);
}
else
- gtk_label_set_text (self->count_label, "");
+ gtk_widget_set_visible (GTK_WIDGET (self->count_box), TRUE);
}
static gboolean
@@ -480,7 +482,7 @@ ide_editor_spell__widget_mapped_cb (IdeEditorSpellWidget *self)
{
value = g_action_get_state (self->view_spellchecking_action);
self->view_spellchecker_set = g_variant_get_boolean (value);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->highlight_checkbutton),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->highlight_switch),
self->view_spellchecker_set);
}
@@ -488,15 +490,15 @@ ide_editor_spell__widget_mapped_cb (IdeEditorSpellWidget *self)
}
static void
-ide_editor_spell_widget__highlight_checkbutton_toggled_cb (IdeEditorSpellWidget *self,
- GtkCheckButton *button)
+ide_editor_spell_widget__highlight_switch_toggled_cb (IdeEditorSpellWidget *self,
+ gboolean state,
+ GtkSwitch *switch_button)
{
GspellTextView *spell_text_view;
- gboolean state;
g_assert (IDE_IS_EDITOR_SPELL_WIDGET (self));
- state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ gtk_switch_set_state (switch_button, state);
spell_text_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (self->view));
gspell_text_view_set_inline_spell_checking (spell_text_view, state);
}
@@ -537,6 +539,7 @@ dict_create_word_row (IdeEditorSpellWidget *self,
GtkWidget *box;
GtkWidget *label;
GtkWidget *button;
+ GtkStyleContext *style_context;
g_assert (IDE_IS_EDITOR_SPELL_WIDGET (self));
g_assert (!ide_str_empty0 (word));
@@ -547,6 +550,8 @@ dict_create_word_row (IdeEditorSpellWidget *self,
NULL);
button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_BUTTON);
+ style_context = gtk_widget_get_style_context (button);
+ gtk_style_context_add_class (style_context, "close");
g_signal_connect_swapped (button,
"clicked",
G_CALLBACK (dict_close_button_clicked_cb),
@@ -780,9 +785,9 @@ ide_editor_spell_widget_constructed (GObject *object)
G_CALLBACK (ide_editor_spell_widget__key_press_event_cb),
self);
- g_signal_connect_swapped (self->highlight_checkbutton,
- "toggled",
- G_CALLBACK (ide_editor_spell_widget__highlight_checkbutton_toggled_cb),
+ g_signal_connect_swapped (self->highlight_switch,
+ "state-set",
+ G_CALLBACK (ide_editor_spell_widget__highlight_switch_toggled_cb),
self);
g_signal_connect_object (self->language_chooser_button,
@@ -917,12 +922,13 @@ ide_editor_spell_widget_class_init (IdeEditorSpellWidgetClass *klass)
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, ignore_all_button);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, change_button);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, change_all_button);
- gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, highlight_checkbutton);
+ gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, highlight_switch);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, language_chooser_button);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, suggestions_box);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, dict_word_entry);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, dict_add_button);
gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, dict_words_list);
+ gtk_widget_class_bind_template_child (widget_class, IdeEditorSpellWidget, count_box);
}
static void
diff --git a/libide/editor/ide-editor-spell-widget.ui b/libide/editor/ide-editor-spell-widget.ui
index 57483ac..1dbb1d1 100644
--- a/libide/editor/ide-editor-spell-widget.ui
+++ b/libide/editor/ide-editor-spell-widget.ui
@@ -35,9 +35,16 @@
</object>
</child>
<child>
- <object class="GtkLabel" id="count_label">
- <property name="visible">true</property>
- <property name="halign">end</property>
+ <object class="GtkBox" id="count_box">
+ <child>
+ <object class="GtkLabel" id="count_label">
+ <property name="visible">true</property>
+ <property name="halign">end</property>
+ </object>
+ </child>
+ <style>
+ <class name="countbox"/>
+ </style>
</object>
</child>
</object>
@@ -48,27 +55,35 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="ignore_button">
- <property name="label" translatable="yes">_Ignore</property>
+ <object class="GtkBox" id="ignore_box">
<property name="visible">true</property>
- <property name="can_focus">true</property>
- <property name="use_underline">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="hexpand">true</property>
+ <property name="homogeneous">true</property>
+ <child>
+ <object class="GtkButton" id="ignore_button">
+ <property name="label" translatable="yes">_Ignore</property>
+ <property name="visible">true</property>
+ <property name="can_focus">true</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="ignore_all_button">
+ <property name="label" translatable="yes">Ignore _All</property>
+ <property name="visible">true</property>
+ <property name="can_focus">true</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="ignore_all_button">
- <property name="label" translatable="yes">Ignore _All</property>
- <property name="visible">true</property>
- <property name="can_focus">true</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
@@ -98,33 +113,42 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="change_button">
- <property name="label" translatable="yes">Cha_nge</property>
+ <object class="GtkBox" id="change_box">
<property name="visible">true</property>
- <property name="can_focus">true</property>
- <property name="use_underline">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="hexpand">true</property>
+ <property name="homogeneous">true</property>
+ <child>
+ <object class="GtkButton" id="change_button">
+ <property name="label" translatable="yes">Cha_nge</property>
+ <property name="visible">true</property>
+ <property name="can_focus">true</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="change_all_button">
+ <property name="label" translatable="yes">Change A_ll</property>
+ <property name="visible">true</property>
+ <property name="can_focus">true</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="change_all_button">
- <property name="label" translatable="yes">Change A_ll</property>
- <property name="visible">true</property>
- <property name="can_focus">true</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">3</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">true</property>
<property name="label" translatable="yes">_Suggestions</property>
+ <property name="margin-top">6</property>
<property name="xalign">0</property>
<property name="valign">start</property>
<property name="use_underline">True</property>
@@ -202,6 +226,7 @@
<object class="GtkLabel">
<property name="visible">true</property>
<property name="label" translatable="yes">Dictionary</property>
+ <property name="margin-top">6</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="wrap">true</property>
@@ -293,7 +318,7 @@
<property name="xalign">0</property>
<property name="expand">false</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">highlight_checkbutton</property>
+ <property name="mnemonic_widget">highlight_switch</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -301,7 +326,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="highlight_checkbutton">
+ <object class="GtkSwitch" id="highlight_switch">
<property name="visible">true</property>
<property name="can_focus">true</property>
<property name="halign">start</property>
@@ -312,7 +337,17 @@
<property name="top_attach">10</property>
</packing>
</child>
+ <style>
+ <class name="gb-spellchecker"/>
+ </style>
</object>
</child>
</template>
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="change_box"/>
+ <widget name="ignore_box"/>
+ </widgets>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]