[gtranslator: 1/2] gtr-dl-teams: Display the state of a module
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator: 1/2] gtr-dl-teams: Display the state of a module
- Date: Mon, 4 Jan 2021 08:43:31 +0000 (UTC)
commit 5a58c62f0dc47dba3a740280f57f0013e9b0fa38
Author: Amanda Shafack <shafack likhene gmail com>
Date: Tue Dec 22 15:25:24 2020 +0100
gtr-dl-teams: Display the state of a module
Add the state of a module to the Load from Damned Lies interface.
This will help determine the kind of actions that can be performed
on a module and useful information for users on the state of a module.
src/gtr-dl-teams.c | 17 ++++++++++++++++-
src/gtr-dl-teams.ui | 11 +++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index 463a2e96..f11270f9 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -43,6 +43,7 @@ typedef struct
GtkWidget *open_button;
GtkWidget *load_button;
GtkWidget *stats_label;
+ GtkWidget *module_state_label;
GtkWidget *file_label;
GtkWidget *instructions;
@@ -56,6 +57,7 @@ typedef struct
gchar *selected_branch;
const gchar *selected_domain;
const gchar *file_path;
+ const gchar *module_state;
GtrWindow *main_window;
} GtrDlTeamsPrivate;
@@ -175,6 +177,7 @@ gtr_dl_teams_load_module_details_json (GtkWidget *widget,
GtkWidget *dialog;
gtk_widget_hide (priv->file_label);
+ gtk_widget_hide (priv->module_state_label);
gtk_widget_show (priv->instructions);
gtk_label_set_text (GTK_LABEL (priv->stats_label), "");
@@ -355,6 +358,7 @@ gtr_dl_teams_get_file_info (GtrDlTeams *self)
JsonObject *stats_object;
const char *format;
char *markup;
+ g_autofree char *module_state = NULL;
GtkWidget *dialog;
/* API endpoint: modules/[module]/branches/[branch]/domains/[domain]/languages/[team] */
@@ -404,6 +408,14 @@ gtr_dl_teams_get_file_info (GtrDlTeams *self)
return;
}
+ priv->module_state = json_object_get_string_member (object, "state");
+
+ if (!priv->module_state)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->module_state_label), _("No module state found."));
+ gtk_widget_show (priv->module_state_label);
+ }
+
/* Get file statistics and show them to the user */
stats_node = json_object_get_member (object, "statistics");
stats_object = json_node_get_object (stats_node);
@@ -417,7 +429,9 @@ gtr_dl_teams_get_file_info (GtrDlTeams *self)
gtk_label_set_markup (GTK_LABEL (priv->stats_label), markup);
gtk_label_set_text (GTK_LABEL (priv->file_label), g_strconcat("File: ", strrchr (priv->file_path, '/') +
1, NULL));
gtk_widget_show (priv->file_label);
-
+ module_state = g_strdup_printf (_("The current state is: %s"), priv->module_state);
+ gtk_label_set_text (GTK_LABEL (priv->module_state_label), module_state);
+ gtk_widget_show (priv->module_state_label);
/* Enable (down)load button */
gtk_widget_set_sensitive (priv->load_button, TRUE);
@@ -593,6 +607,7 @@ gtr_dl_teams_class_init (GtrDlTeamsClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, select_box);
gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, file_label);
gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, stats_label);
+ gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, module_state_label);
gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, load_button);
gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, instructions);
diff --git a/src/gtr-dl-teams.ui b/src/gtr-dl-teams.ui
index 2601aa5f..5fa13a4f 100644
--- a/src/gtr-dl-teams.ui
+++ b/src/gtr-dl-teams.ui
@@ -67,6 +67,17 @@
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="module_state_label">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
<child>
<object class="GtkLabel" id="instructions">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]