Skip to content

Commit

Permalink
Make the preferences window a little prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
btrkeks committed Aug 26, 2024
1 parent a0579dd commit 39d1f67
Show file tree
Hide file tree
Showing 6 changed files with 366 additions and 388 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ set(LOCALEDIR ${CMAKE_INSTALL_FULL_LOCALEDIR})
add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
add_definitions(-DLOCALEDIR="${LOCALEDIR}")

set(potfile "${CMAKE_SOURCE_DIR}/po/${GETTEXT_PACKAGE}.pot")
set(potfile "${GENERATED_DIR}/${GETTEXT_PACKAGE}.pot")
add_custom_command(
OUTPUT ${potfile}
COMMAND xgettext
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ High priority
-------------
- Add database version to metadata of database
- Bring back kanjification
- Allow changing font size

- Add more tests

Expand Down
42 changes: 21 additions & 21 deletions po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-08-26 08:55+0200\n"
"POT-Creation-Date: 2024-08-26 10:19+0200\n"
"PO-Revision-Date: 2024-08-26 07:20+0200\n"
"Last-Translator: <[email protected]>\n"
"Language-Team: Japanese <[email protected]>\n"
Expand All @@ -21,32 +21,28 @@ msgstr ""
msgid "Add Current Entry To Anki"
msgstr ""

#: src/frontends/gtk3popup/dp-preferences-window.ui:304
#: src/frontends/gtk3popup/dp-preferences-window.ui:300
msgid "Anki Note Type"
msgstr ""

#: src/frontends/gtk3popup/dp-preferences-window.ui:273
#: src/frontends/gtk3popup/dp-preferences-window.ui:269
msgid "Anki Settings"
msgstr "Anki設定"

#: src/frontends/gtk3popup/dp-preferences-window.ui:242
#: src/frontends/gtk3popup/dp-preferences-window.ui:237
msgid "Dictionary Sort Order"
msgstr ""

#: src/frontends/gtk3popup/main-window.ui:276
msgid "Edit Lookup"
msgstr "検索を編集"

#: src/frontends/gtk3popup/dp-preferences-window.ui:151
#: src/frontends/gtk3popup/dp-preferences-window.ui:149
msgid "Fallback to Hiragana Conversion"
msgstr ""

#: src/frontends/gtk3popup/dp-preferences-window.ui:30
msgid "General Settings"
msgstr "一般設定"

#: src/frontends/gtk3popup/dp-preferences-window.ui:83
#: src/frontends/gtk3popup/dp-preferences-window.ui:442
#: src/frontends/gtk3popup/dp-preferences-window.ui:79
#: src/frontends/gtk3popup/dp-preferences-window.ui:445
msgid "Generate Index"
msgstr "インデックスを生成"

Expand All @@ -67,10 +63,15 @@ msgstr "次の定義"
msgid "Open Menu"
msgstr "メニューを開く"

#: src/frontends/gtk3popup/dp-preferences-window.ui:391
#: src/frontends/gtk3popup/dp-preferences-window.ui:378
msgid "Play Pronunciation on Startup"
msgstr "起動時に発音を再生"

#: src/frontends/gtk3popup/dp-preferences-window.ui:6
#: src/frontends/gtk3popup/dp-preferences-window.ui:20
msgid "Preferences"
msgstr "設定"

#: src/frontends/gtk3popup/main-window.ui:33
msgid "Previous Definition"
msgstr "前の定義"
Expand All @@ -79,35 +80,34 @@ msgstr "前の定義"
msgid "Pronounce Current Word"
msgstr ""

#: src/frontends/gtk3popup/dp-preferences-window.ui:362
msgid "Pronunciation Settings"
msgstr "発音設定"
#: src/frontends/gtk3popup/dp-preferences-window.ui:404
msgid "Pronunciation Options"
msgstr ""

#: src/frontends/gtk3popup/dp-preferences-window.ui:118
#: src/frontends/gtk3popup/dp-preferences-window.ui:116
msgid "Remove Whitespace"
msgstr "空白を削除する"

#: src/frontends/gtk3popup/dp-preferences-window.ui:213
#: src/frontends/gtk3popup/dp-preferences-window.ui:208
msgid "Search Options"
msgstr ""

#: src/frontends/gtk3popup/dp-preferences-window.ui:184
#: src/frontends/gtk3popup/dp-preferences-window.ui:182
msgid "Search for Longest Prefix"
msgstr ""

#: src/frontends/gtk3popup/main-window.ui:267
msgid "Search in Massif"
msgstr "Massifで検索"

#: src/frontends/gtk3popup/dp-preferences-window.ui:431
#: src/frontends/gtk3popup/dp-preferences-window.ui:434
msgid "Select path to pronunciation directories"
msgstr "発音ディレクトリへのパスを選択"

#: src/frontends/gtk3popup/dp-preferences-window.ui:73
#: src/frontends/gtk3popup/dp-preferences-window.ui:69
msgid "Select the path to your Yomichan dictionaries"
msgstr ""

#: src/frontends/gtk3popup/main-window.ui:258
#: src/frontends/gtk3popup/dp-preferences-window.ui:6
msgid "Settings"
msgstr "設定"
1 change: 1 addition & 0 deletions src/frontends/gtk3popup/dictpopup-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static GActionEntry app_entries[] = {
};

static void init_css(void) {
dbg("Initting CSS");
GtkCssProvider *provider = gtk_css_provider_new();
gtk_css_provider_load_from_resource(provider, "/com/github/Ajatt-Tools/dictpopup/style.css");
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
Expand Down
24 changes: 20 additions & 4 deletions src/frontends/gtk3popup/dp-preferences-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,25 @@ static void on_preferences_close_button_clicked(GtkButton *button, DpPreferences
gtk_widget_destroy(GTK_WIDGET(self));
}

static void restore_generate_index_button(GtkWidget *button) {
gtk_button_set_label(GTK_BUTTON(button), _(generate_index_str));

GtkStyleContext *context = gtk_widget_get_style_context(button);
gtk_style_context_add_class(gtk_widget_get_style_context(button), "suggested-action");
gtk_style_context_remove_class(gtk_widget_get_style_context(button), "destructive-action");
}

static void change_to_stop_button(GtkWidget *button) {
gtk_button_set_label(GTK_BUTTON(button), _(stop_str));

GtkStyleContext *context = gtk_widget_get_style_context(button);
gtk_style_context_add_class(context, "destructive-action");
gtk_style_context_remove_class(context, "suggested-action");
}

static void cancel_pron_index_generation(DpPreferencesWindow *self) {
atomic_store(&self->cancel_pron_index_generate, true);
gtk_button_set_label(GTK_BUTTON(self->dictpopup_create_button), _(generate_index_str));
restore_generate_index_button(self->dictpopup_create_button);
}

static gboolean pron_index_generation_thread_finished(gpointer user_data) {
Expand Down Expand Up @@ -90,7 +106,7 @@ static void start_pron_index_generation(DpPreferencesWindow *self) {
atomic_store(&self->cancel_pron_index_generate, false);
self->pron_index_generate_thread =
g_thread_new("pron_index_generation_thread", pron_index_generation_thread_func, self);
gtk_button_set_label(GTK_BUTTON(self->pron_index_generate_button), _(stop_str));
change_to_stop_button(self->pron_index_generate_button);
}

static void on_pron_index_generate_button_clicked(GtkButton *button, DpPreferencesWindow *self) {
Expand Down Expand Up @@ -130,7 +146,7 @@ static bool overwrite_dictpopup_db_dialog(void *voidarg) {

static void cancel_dictpopup_create(DpPreferencesWindow *self) {
atomic_store(&self->cancel_dictpopup_create, true);
gtk_button_set_label(GTK_BUTTON(self->dictpopup_create_button), _(generate_index_str));
restore_generate_index_button(self->dictpopup_create_button);
}

static gboolean dictpopup_create_thread_finished(gpointer user_data) {
Expand Down Expand Up @@ -162,7 +178,7 @@ static void start_dictpopup_create(DpPreferencesWindow *self) {
atomic_store(&self->cancel_dictpopup_create, false);
self->dictpopup_create_thread =
g_thread_new("create_thread", dictpopup_create_thread_func, self);
gtk_button_set_label(GTK_BUTTON(self->dictpopup_create_button), _(stop_str));
change_to_stop_button(self->dictpopup_create_button);
}

static void on_dictpopup_create_button_clicked(GtkButton *button, DpPreferencesWindow *self) {
Expand Down
Loading

0 comments on commit 39d1f67

Please sign in to comment.