Commit 3203cef6 authored by Adrien Plazas's avatar Adrien Plazas

librem5: app-row: Port to phones

parent f9e0a3f0
......@@ -32,6 +32,9 @@ typedef struct
GtkWidget *description_label;
GtkWidget *button_box;
GtkWidget *button;
GtkWidget *button_stack;
GtkWidget *button_image;
GtkWidget *button_spinner;
GtkWidget *spinner;
GtkWidget *label;
GtkWidget *label_warning;
......@@ -115,12 +118,18 @@ gs_app_row_refresh_button (GsAppRow *app_row, gboolean missing_search_result)
if (missing_search_result) {
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily installed */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Visit website"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_image);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->button_image),
"web-browser-symbolic",
GTK_ICON_SIZE_BUTTON);
} else {
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily installed.
* The ellipsis indicates that further steps are required */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Install…"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_image);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->button_image),
"system-software-install-symbolic",
GTK_ICON_SIZE_BUTTON);
}
break;
case AS_APP_STATE_QUEUED_FOR_INSTALL:
......@@ -134,18 +143,27 @@ gs_app_row_refresh_button (GsAppRow *app_row, gboolean missing_search_result)
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily installed */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Install"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_image);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->button_image),
"system-software-install-symbolic",
GTK_ICON_SIZE_BUTTON);
break;
case AS_APP_STATE_UPDATABLE_LIVE:
gtk_widget_set_visible (priv->button, TRUE);
if (priv->show_update) {
/* TRANSLATORS: this is a button in the updates panel
* that allows the app to be easily updated live */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Update"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_image);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->button_image),
"software-update-available-symbolic",
GTK_ICON_SIZE_BUTTON);
} else {
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily removed */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Remove"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_image);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->button_image),
"edit-delete-symbolic",
GTK_ICON_SIZE_BUTTON);
}
break;
case AS_APP_STATE_UPDATABLE:
......@@ -154,19 +172,24 @@ gs_app_row_refresh_button (GsAppRow *app_row, gboolean missing_search_result)
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily removed */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Remove"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_image);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->button_image),
"edit-delete-symbolic",
GTK_ICON_SIZE_BUTTON);
break;
case AS_APP_STATE_INSTALLING:
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* shows the status of an application being installed */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Installing"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_spinner);
gtk_spinner_start (GTK_SPINNER (priv->button_spinner));
break;
case AS_APP_STATE_REMOVING:
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* shows the status of an application being erased */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Removing"));
gtk_stack_set_visible_child (GTK_STACK (priv->button_stack), priv->button_spinner);
gtk_spinner_start (GTK_SPINNER (priv->button_spinner));
break;
default:
break;
......@@ -604,6 +627,9 @@ gs_app_row_class_init (GsAppRowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, description_label);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button_box);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button_stack);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button_image);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button_spinner);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, spinner);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_warning);
......@@ -648,7 +674,6 @@ gs_app_row_set_size_groups (GsAppRow *app_row,
gtk_size_group_add_widget (image, priv->image);
gtk_size_group_add_widget (name, priv->name_box);
gtk_size_group_add_widget (desc, priv->description_box);
gtk_size_group_add_widget (button, priv->button);
}
void
......
......@@ -106,8 +106,25 @@
<child>
<object class="GsProgressButton" id="button">
<property name="visible">False</property>
<property name="width_request">100</property>
<property name="halign">end</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkStack" id="button_stack">
<property name="visible">True</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage" id="button_image">
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkSpinner" id="button_spinner">
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
......@@ -155,9 +172,6 @@
</packing>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment