location: Use AdwActionRow for application rows
This commit is contained in:
parent
cd440893d2
commit
2f9ed9e2a6
1 changed files with 8 additions and 22 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "cc-location-resources.h"
|
||||
#include "cc-util.h"
|
||||
|
||||
#include <adwaita.h>
|
||||
#include <gio/gdesktopappinfo.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
|
@ -150,7 +151,7 @@ add_location_app (CcLocationPanel *self,
|
|||
LocationAppStateData *data;
|
||||
GDesktopAppInfo *app_info;
|
||||
GDateTime *t;
|
||||
GtkWidget *box, *row, *w;
|
||||
GtkWidget *row, *w;
|
||||
GIcon *icon;
|
||||
gchar *last_used_str;
|
||||
gchar *desktop_id;
|
||||
|
@ -168,30 +169,17 @@ add_location_app (CcLocationPanel *self,
|
|||
if (app_info == NULL)
|
||||
return;
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_hexpand (box, TRUE);
|
||||
gtk_widget_set_margin_start (box, 12);
|
||||
gtk_widget_set_margin_end (box, 6);
|
||||
gtk_widget_set_margin_top (box, 12);
|
||||
gtk_widget_set_margin_bottom (box, 12);
|
||||
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||
row = adw_action_row_new ();
|
||||
gtk_list_box_append (self->location_apps_list_box, row);
|
||||
|
||||
icon = g_app_info_get_icon (G_APP_INFO (app_info));
|
||||
w = gtk_image_new_from_gicon (icon);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_size_group_add_widget (self->location_icon_size_group, w);
|
||||
gtk_box_append (GTK_BOX (box), w);
|
||||
adw_action_row_add_prefix (ADW_ACTION_ROW (row), w);
|
||||
|
||||
w = gtk_label_new (g_app_info_get_name (G_APP_INFO (app_info)));
|
||||
gtk_widget_set_margin_start (w, 12);
|
||||
gtk_widget_set_margin_end (w, 12);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_label_set_xalign (GTK_LABEL (w), 0);
|
||||
gtk_box_append (GTK_BOX (box), w);
|
||||
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row),
|
||||
g_app_info_get_name (G_APP_INFO (app_info)));
|
||||
|
||||
t = g_date_time_new_from_unix_utc (last_used);
|
||||
last_used_str = cc_util_get_smart_date (t);
|
||||
|
@ -200,15 +188,13 @@ add_location_app (CcLocationPanel *self,
|
|||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "dim-label");
|
||||
gtk_widget_set_margin_start (w, 12);
|
||||
gtk_widget_set_margin_end (w, 12);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (box), w);
|
||||
adw_action_row_add_suffix (ADW_ACTION_ROW (row), w);
|
||||
|
||||
w = gtk_switch_new ();
|
||||
gtk_switch_set_active (GTK_SWITCH (w), enabled);
|
||||
gtk_widget_set_halign (w, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (box), w);
|
||||
adw_action_row_add_suffix (ADW_ACTION_ROW (row), w);
|
||||
g_settings_bind (self->location_settings, LOCATION_ENABLED,
|
||||
w, "sensitive",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
|
Loading…
Add table
Reference in a new issue