~ubuntu-branches/ubuntu/wily/gnome-software/wily-proposed

« back to all changes in this revision

Viewing changes to src/gs-history-dialog.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2015-07-22 00:03:04 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20150722000304-ctnkwytku720qft7
Tags: 3.16.4-1
* New upstream release.
* Update Build-Depends as per configure.ac:
  - Add appstream-util.
  - Add libpolkit-gobject-1-dev.
  - Bump libappstream-glib-dev to (>= 0.3.4).
  - Bump libgtk-3-dev to (>= 3.16).
* Drop hard-coded dependency on libappstream-glib7 now that the library
  provides a symbols file.
* Use dh_install's exclude (-X) functionality to not install the .a and .la
  files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <gtk/gtk.h>
27
27
 
28
28
#include "gs-history-dialog.h"
 
29
#include "gs-cleanup.h"
29
30
#include "gs-utils.h"
30
31
 
31
32
struct _GsHistoryDialogPrivate
32
33
{
33
 
        GsApp           *app;
34
34
        GtkSizeGroup    *sizegroup_state;
35
35
        GtkSizeGroup    *sizegroup_timestamp;
36
36
        GtkSizeGroup    *sizegroup_version;
57
57
{
58
58
        GsHistoryDialogPrivate *priv = gs_history_dialog_get_instance_private (dialog);
59
59
        const gchar *tmp;
60
 
        gchar *date_str;
61
 
        GDateTime *datetime;
62
60
        GPtrArray *history;
63
61
        GtkBox *box;
64
62
        GtkWidget *widget;
70
68
        history = gs_app_get_history (app);
71
69
        g_ptr_array_sort (history, history_sort_cb);
72
70
        for (i = 0; i < history->len; i++) {
 
71
                _cleanup_date_time_unref_ GDateTime *datetime = NULL;
 
72
                _cleanup_free_ gchar *date_str = NULL;
73
73
                app = g_ptr_array_index (history, i);
74
74
                box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
75
75
 
101
101
                }
102
102
                widget = gtk_label_new (tmp);
103
103
                g_object_set (widget,
104
 
                              "margin-start", 20,
105
 
                              "margin-end", 20,
106
 
                              "margin-top", 6,
107
 
                              "margin-bottom", 6,
108
 
                              "xalign", 0.0,
109
 
                              NULL);
 
104
                              "margin-start", 20,
 
105
                              "margin-end", 20,
 
106
                              "margin-top", 6,
 
107
                              "margin-bottom", 6,
 
108
                              "xalign", 0.0,
 
109
                              NULL);
110
110
                gtk_size_group_add_widget (priv->sizegroup_state, widget);
111
111
                gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
112
112
 
120
120
                }
121
121
                widget = gtk_label_new (date_str);
122
122
                g_object_set (widget,
123
 
                              "margin-start", 20,
124
 
                              "margin-end", 20,
125
 
                              "margin-top", 6,
126
 
                              "margin-bottom", 6,
127
 
                              "xalign", 0.0,
128
 
                              NULL);
 
123
                              "margin-start", 20,
 
124
                              "margin-end", 20,
 
125
                              "margin-top", 6,
 
126
                              "margin-bottom", 6,
 
127
                              "xalign", 0.0,
 
128
                              NULL);
129
129
                gtk_size_group_add_widget (priv->sizegroup_timestamp, widget);
130
130
                gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
131
 
                g_free (date_str);
132
 
                g_date_time_unref (datetime);
133
131
 
134
132
                /* add the version */
135
133
                widget = gtk_label_new (gs_app_get_version (app));
136
134
                g_object_set (widget,
137
 
                              "margin-start", 20,
138
 
                              "margin-end", 20,
139
 
                              "margin-top", 6,
140
 
                              "margin-bottom", 6,
141
 
                              "xalign", 1.0,
142
 
                              NULL);
 
135
                              "margin-start", 20,
 
136
                              "margin-end", 20,
 
137
                              "margin-top", 6,
 
138
                              "margin-bottom", 6,
 
139
                              "xalign", 1.0,
 
140
                              NULL);
143
141
                gtk_size_group_add_widget (priv->sizegroup_version, widget);
144
142
                gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
145
143
 
150
148
 
151
149
static void
152
150
update_header_func (GtkListBoxRow *row,
153
 
                    GtkListBoxRow *before,
154
 
                    gpointer user_data)
 
151
                    GtkListBoxRow *before,
 
152
                    gpointer user_data)
155
153
{
156
154
        GtkWidget *header;
157
155
 
196
194
        g_object_unref (priv->sizegroup_timestamp);
197
195
        g_object_unref (priv->sizegroup_version);
198
196
 
199
 
        if (priv->app != NULL)
200
 
                g_object_unref (priv->app);
201
 
 
202
197
        G_OBJECT_CLASS (gs_history_dialog_parent_class)->finalize (object);
203
198
}
204
199
 
215
210
        priv->sizegroup_version = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
216
211
 
217
212
        gtk_list_box_set_header_func (GTK_LIST_BOX (priv->list_box),
218
 
                                      update_header_func,
219
 
                                      dialog,
220
 
                                      NULL);
 
213
                                      update_header_func,
 
214
                                      dialog,
 
215
                                      NULL);
221
216
 
222
217
        scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->scrolledwindow));
223
218
        g_signal_connect (scrollbar, "map", G_CALLBACK (scrollbar_mapped_cb), priv->scrolledwindow);
242
237
gs_history_dialog_new (void)
243
238
{
244
239
        return GTK_WIDGET (g_object_new (GS_TYPE_HISTORY_DIALOG,
245
 
                                         "use-header-bar", TRUE,
246
 
                                         NULL));
 
240
                                         "use-header-bar", TRUE,
 
241
                                         NULL));
247
242
}
248
243
 
249
244
/* vim: set noexpandtab: */