Skip to content

Commit

Permalink
Rename ComboEntry to TextPane (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonakano authored Apr 27, 2024
1 parent 3bf8416 commit 886d8b6
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion data/konbucase.gschema.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<!-- Make sure to match with Widgets.ComboEntry.CaseType -->
<!-- Make sure to match with Define.CaseType -->
<enum id="case-type">
<value value="0" nick="space_separated"/>
<value value="1" nick="camel"/>
Expand Down
2 changes: 1 addition & 1 deletion data/resources/konbucase.gresource.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/github/ryonakano/konbucase">
<file preprocess="xml-stripblanks">ui/combo-entry.ui</file>
<file preprocess="xml-stripblanks">ui/text-pane.ui</file>
<file preprocess="xml-stripblanks">ui/main-window.ui</file>
</gresource>
</gresources>
2 changes: 1 addition & 1 deletion data/resources/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
blueprints = custom_target('blueprints',
input: files(
'ui/combo-entry.blp',
'ui/text-pane.blp',
'ui/main-window.blp',
),
output: '.',
Expand Down
8 changes: 4 additions & 4 deletions data/resources/ui/main-window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ menu main_menu {
}
}

$ComboEntryModel source_model {
$TextPaneModel source_model {
text-type: source;
}

$ComboEntryModel result_model {
$TextPaneModel result_model {
text-type: result;
}

Expand Down Expand Up @@ -66,7 +66,7 @@ template $MainWindow : Gtk.ApplicationWindow {
spacing: 0;

// Left pane for input text
$ComboEntry source_combo_entry {
$TextPane source_pane {
model: source_model;
description: _("Convert from:");
editable: true;
Expand All @@ -78,7 +78,7 @@ template $MainWindow : Gtk.ApplicationWindow {
}

// Right pane for output text
$ComboEntry result_combo_entry {
$TextPane result_pane {
model: result_model;
description: _("Convert to:");
// Make the text view uneditable, otherwise the app freezes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Gtk.StringList case_list {
}

/**
* ComboEntry: Common pane for input/output texts
* TextPane: Common pane for input/output texts
*/
template $ComboEntry : Gtk.Box {
template $TextPane : Gtk.Box {
orientation: vertical;
spacing: 0;

Expand All @@ -43,7 +43,7 @@ template $ComboEntry : Gtk.Box {
// Info about current choice of case type
Gtk.Image case_info_button_icon {
icon-name: "dialog-information-symbolic";
tooltip-text: bind template.model as <$ComboEntryModel>.case-description;
tooltip-text: bind template.model as <$TextPaneModel>.case-description;
}

// Button to copy text in the text view
Expand All @@ -56,7 +56,7 @@ template $ComboEntry : Gtk.Box {
// Text area
Gtk.ScrolledWindow {
GtkSource.View source_view {
buffer: bind template.model as <$ComboEntryModel>.buffer;
buffer: bind template.model as <$TextPaneModel>.buffer;
wrap-mode: word_char;
hexpand: true;
vexpand: true;
Expand Down
4 changes: 2 additions & 2 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data/konbucase.desktop.in
data/konbucase.metainfo.xml.in
data/resources/ui/combo-entry.blp
data/resources/ui/main-window.blp
src/Model/ComboEntryModel.vala
data/resources/ui/text-pane.blp
src/Model/TextPaneModel.vala
2 changes: 1 addition & 1 deletion src/Define.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Define {
RESULT,
}

// Make sure to match with source-type enum in the gschema
// Make sure to match with case-type enum in the gschema
public enum CaseType {
SPACE_SEPARATED = ChCase.Case.SPACE_SEPARATED,
CAMEL = ChCase.Case.CAMEL,
Expand Down
6 changes: 3 additions & 3 deletions src/Model/MainWindowModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/

public class MainWindowModel : Object {
public ComboEntryModel source_model { get; construct; }
public ComboEntryModel result_model { get; construct; }
public TextPaneModel source_model { get; construct; }
public TextPaneModel result_model { get; construct; }

private ChCase.Converter converter;

public MainWindowModel (ComboEntryModel source_model, ComboEntryModel result_model) {
public MainWindowModel (TextPaneModel source_model, TextPaneModel result_model) {
Object (
source_model: source_model,
result_model: result_model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-FileCopyrightText: 2020-2024 Ryo Nakano <[email protected]>
*/

public class ComboEntryModel : Object {
public class TextPaneModel : Object {
public Define.TextType text_type { get; construct; }
public Define.CaseType case_type { get; set; }
public string case_description { get; set; }
Expand Down Expand Up @@ -36,7 +36,7 @@ public class ComboEntryModel : Object {
{ N_("The first character of the first word in the sentence is in uppercase") }, // Define.CaseType.SENTENCE
};

public ComboEntryModel (Define.TextType text_type) {
public TextPaneModel (Define.TextType text_type) {
Object (
text_type: text_type
);
Expand Down
18 changes: 9 additions & 9 deletions src/View/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
[GtkTemplate (ui = "/com/github/ryonakano/konbucase/ui/main-window.ui")]
public class MainWindow : Gtk.ApplicationWindow {
[GtkChild]
private unowned ComboEntry source_combo_entry;
private unowned TextPane source_pane;
[GtkChild]
private unowned ComboEntry result_combo_entry;
private unowned TextPane result_pane;
[GtkChild]
private unowned Granite.Toast toast;

[GtkChild]
private unowned ComboEntryModel source_model;
private unowned TextPaneModel source_model;
[GtkChild]
private unowned ComboEntryModel result_model;
private unowned TextPaneModel result_model;
[GtkChild]
private unowned MainWindowModel window_model;

Expand All @@ -26,24 +26,24 @@ public class MainWindow : Gtk.ApplicationWindow {
}

construct {
source_combo_entry.get_source_view ().grab_focus ();
source_pane.get_source_view ().grab_focus ();

source_combo_entry.dropdown_changed.connect (() => {
source_pane.dropdown_changed.connect (() => {
window_model.do_convert ();
});
result_combo_entry.dropdown_changed.connect (() => {
result_pane.dropdown_changed.connect (() => {
window_model.do_convert ();
});

source_model.notify["text"].connect (() => {
window_model.do_convert ();
});

source_combo_entry.copy_button_clicked.connect (() => {
source_pane.copy_button_clicked.connect (() => {
get_clipboard ().set_text (source_model.text);
show_toast ();
});
result_combo_entry.copy_button_clicked.connect (() => {
result_pane.copy_button_clicked.connect (() => {
get_clipboard ().set_text (result_model.text);
show_toast ();
});
Expand Down
8 changes: 4 additions & 4 deletions src/View/ComboEntry.vala → src/View/TextPane.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* SPDX-FileCopyrightText: 2020-2024 Ryo Nakano <[email protected]>
*/

[GtkTemplate (ui = "/com/github/ryonakano/konbucase/ui/combo-entry.ui")]
public class ComboEntry : Gtk.Box {
[GtkTemplate (ui = "/com/github/ryonakano/konbucase/ui/text-pane.ui")]
public class TextPane : Gtk.Box {
public signal void dropdown_changed ();
public signal void copy_button_clicked ();

public ComboEntryModel model { get; set construct; }
public TextPaneModel model { get; set construct; }
public string description { get; construct; }
public bool editable { get; construct; }

Expand All @@ -19,7 +19,7 @@ public class ComboEntry : Gtk.Box {
[GtkChild]
private unowned GtkSource.View source_view;

public ComboEntry (ComboEntryModel model, string description, bool editable) {
public TextPane (TextPaneModel model, string description, bool editable) {
Object (
model: model,
description: description,
Expand Down
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ else
endif

sources = files(
'Model/ComboEntryModel.vala',
'Model/MainWindowModel.vala',
'View/ComboEntry.vala',
'Model/TextPaneModel.vala',
'View/MainWindow.vala',
'View/TextPane.vala',
'Application.vala',
'Define.vala',
'StyleManager.vala',
Expand Down

0 comments on commit 886d8b6

Please sign in to comment.