talkatu/talkatu

Parents c523a909b8ac
Children f9989cac8f7a
Replace the TalkatuView in TalkatuEditor with a TalkatuInput
--- a/demo/data/demo.ui Tue Jan 28 20:45:36 2020 -0600
+++ b/demo/data/demo.ui Tue Jan 28 20:45:56 2020 -0600
@@ -255,7 +255,7 @@
<property name="fill">False</property>
</packing>
</child>
- <child internal-child="view">
+ <child internal-child="input">
<object class="TalkatuView">
<property name="hexpand_set">True</property>
<property name="vexpand_set">True</property>
--- a/demo/talkatudemowindow.c Tue Jan 28 20:45:36 2020 -0600
+++ b/demo/talkatudemowindow.c Tue Jan 28 20:45:56 2020 -0600
@@ -141,7 +141,7 @@
static void
talkatu_demo_window_buffer_changed_cb(GtkToggleButton *toggle, gpointer data) {
TalkatuDemoWindow *window = TALKATU_DEMO_WINDOW(data);
- GtkWidget *view = talkatu_editor_get_view(TALKATU_EDITOR(window->editor));
+ GtkWidget *view = talkatu_editor_get_input(TALKATU_EDITOR(window->editor));
if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(window->toggle_plain))) {
g_message("switching to plain buffer");
--- a/talkatu/data/editor.ui Tue Jan 28 20:45:36 2020 -0600
+++ b/talkatu/data/editor.ui Tue Jan 28 20:45:56 2020 -0600
@@ -34,7 +34,7 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
- <object class="TalkatuView" id="view">
+ <object class="TalkatuInput" id="input">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
--- a/talkatu/talkatueditor.c Tue Jan 28 20:45:36 2020 -0600
+++ b/talkatu/talkatueditor.c Tue Jan 28 20:45:56 2020 -0600
@@ -40,13 +40,13 @@
/**
* TalkatuEditor:
*
- * A composite widget that contains a #TalkatuToolbar, #TalkatuView, and an
+ * A composite widget that contains a #TalkatuToolbar, #TalkatuInput, and an
* optional send button in the common instant messaging input layout.
*/
struct _TalkatuEditor {
GtkBox parent;
- GtkWidget *view;
+ GtkWidget *input;
GtkWidget *toolbar;
GtkWidget *send_button;
};
@@ -55,7 +55,7 @@
PROP_0,
PROP_TOOLBAR,
PROP_SHOW_TOOLBAR,
- PROP_VIEW,
+ PROP_INPUT,
PROP_BUFFER,
PROP_SHOW_SEND_BUTTON,
N_PROPERTIES
@@ -71,7 +71,7 @@
static void
talkatu_editor_buffer_changed(TalkatuEditor *editor) {
GActionGroup *action_group = NULL;
- GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(editor->view));
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(editor->input));
if(TALKATU_IS_BUFFER(buffer)) {
action_group = G_ACTION_GROUP(talkatu_buffer_get_action_group(TALKATU_BUFFER(buffer)));
@@ -92,9 +92,9 @@
talkatu_editor_send_button_clicked_cb(GtkButton *button, gpointer data) {
TalkatuEditor *editor = TALKATU_EDITOR(data);
- talkatu_view_send_message(TALKATU_VIEW(editor->view));
+ talkatu_view_send_message(TALKATU_VIEW(editor->input));
- gtk_widget_grab_focus(editor->view);
+ gtk_widget_grab_focus(editor->input);
}
/******************************************************************************
@@ -114,8 +114,8 @@
case PROP_SHOW_TOOLBAR:
g_value_set_boolean(value, talkatu_editor_get_toolbar_visible(editor));
break;
- case PROP_VIEW:
- g_value_set_object(value, talkatu_editor_get_view(editor));
+ case PROP_INPUT:
+ g_value_set_object(value, talkatu_editor_get_input(editor));
break;
case PROP_SHOW_SEND_BUTTON:
g_value_set_boolean(value, talkatu_editor_get_send_button_visible(editor));
@@ -187,9 +187,9 @@
G_PARAM_READWRITE | G_PARAM_CONSTRUCT
);
- properties[PROP_VIEW] = g_param_spec_object(
- "view", "view",
- "The view widget",
+ properties[PROP_INPUT] = g_param_spec_object(
+ "input", "input",
+ "The input widget",
TALKATU_TYPE_VIEW,
G_PARAM_READABLE
);
@@ -216,7 +216,7 @@
"/org/bitbucket/pidgin/talkatu/ui/editor.ui"
);
- gtk_widget_class_bind_template_child_internal(widget_class, TalkatuEditor, view);
+ gtk_widget_class_bind_template_child_internal(widget_class, TalkatuEditor, input);
gtk_widget_class_bind_template_child_internal(widget_class, TalkatuEditor, toolbar);
gtk_widget_class_bind_template_child_internal(widget_class, TalkatuEditor, send_button);
@@ -286,33 +286,33 @@
}
/**
- * talkatu_editor_get_view:
+ * talkatu_editor_get_input:
* @editor: The #TalkatuEditor instance.
*
- * Gets the #TalkatuView that @editor is using.
+ * Gets the #TalkatuInput that @editor is using.
*
- * Returns: (transfer none): The #TalkatuView that @editor is using.
+ * Returns: (transfer none): The #TalkatuInput that @editor is using.
*/
GtkWidget *
-talkatu_editor_get_view(TalkatuEditor *editor) {
+talkatu_editor_get_input(TalkatuEditor *editor) {
g_return_val_if_fail(TALKATU_IS_EDITOR(editor), NULL);
- return editor->view;
+ return editor->input;
}
/**
* talkatu_editor_get_buffer:
* @editor: The #TalkatuEditor instance.
*
- * Gets the #GtkTextBuffer for the internal view.
+ * Gets the #GtkTextBuffer for the internal input.
*
- * Returns: (transfer none): The #GtkTextBuffer for the internal view.
+ * Returns: (transfer none): The #GtkTextBuffer for the internal input.
*/
GtkTextBuffer *
talkatu_editor_get_buffer(TalkatuEditor *editor) {
g_return_val_if_fail(TALKATU_IS_EDITOR(editor), NULL);
- return gtk_text_view_get_buffer(GTK_TEXT_VIEW(editor->view));
+ return gtk_text_view_get_buffer(GTK_TEXT_VIEW(editor->input));
}
/**
@@ -320,13 +320,13 @@
* @editor: The #TalkatuEditor instance.
* @buffer: A new #GtkTextBuffer to use.
*
- * Sets the #GtkTextBuffer for the internal view to @buffer.
+ * Sets the #GtkTextBuffer for the internal input to @buffer.
*/
void
talkatu_editor_set_buffer(TalkatuEditor *editor, GtkTextBuffer *buffer) {
g_return_if_fail(TALKATU_IS_EDITOR(editor));
- gtk_text_view_set_buffer(GTK_TEXT_VIEW(editor->view), buffer);
+ gtk_text_view_set_buffer(GTK_TEXT_VIEW(editor->input), buffer);
}
/**
--- a/talkatu/talkatueditor.h Tue Jan 28 20:45:36 2020 -0600
+++ b/talkatu/talkatueditor.h Tue Jan 28 20:45:56 2020 -0600
@@ -39,7 +39,7 @@
void talkatu_editor_set_toolbar_visible(TalkatuEditor *editor, gboolean visible);
gboolean talkatu_editor_get_toolbar_visible(TalkatuEditor *editor);
-GtkWidget *talkatu_editor_get_view(TalkatuEditor *editor);
+GtkWidget *talkatu_editor_get_input(TalkatuEditor *editor);
GtkTextBuffer *talkatu_editor_get_buffer(TalkatuEditor *editor);
void talkatu_editor_set_buffer(TalkatuEditor *editor, GtkTextBuffer *buffer);