diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-12-17 20:34:37 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-12-17 22:07:40 -0500 |
commit | 7c98d40e94a853345b2ced652bbd2f50ebddb6fc (patch) | |
tree | a84f79b3b02c6eb4b39b7f101fd5a71c0907e109 /gtk/gtkappchooserwidget.c | |
parent | 94e0f1c78df67870a8f97d6f4f9af6809a7c9b3e (diff) | |
download | gtk+-7c98d40e94a853345b2ced652bbd2f50ebddb6fc.tar.gz |
GtkAppChooserWidget: Monitor installed applications
This uses the new GAppInfoMonitor object in GIO, which provides
change notification when the set of installed applications changes.
Diffstat (limited to 'gtk/gtkappchooserwidget.c')
-rw-r--r-- | gtk/gtkappchooserwidget.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c index d7cc68bd1b..648e9871a3 100644 --- a/gtk/gtkappchooserwidget.c +++ b/gtk/gtkappchooserwidget.c @@ -85,6 +85,8 @@ struct _GtkAppChooserWidgetPrivate { GtkTreeViewColumn *column; GtkCellRenderer *padding_renderer; GtkCellRenderer *secondary_padding; + + GAppInfoMonitor *monitor; }; enum { @@ -811,6 +813,13 @@ gtk_app_chooser_widget_initialize_items (GtkAppChooserWidget *self) } static void +app_info_changed (GAppInfoMonitor *monitor, + GtkAppChooserWidget *self) +{ + gtk_app_chooser_refresh (GTK_APP_CHOOSER (self)); +} + +static void gtk_app_chooser_widget_set_property (GObject *object, guint property_id, const GValue *value, @@ -902,6 +911,8 @@ gtk_app_chooser_widget_finalize (GObject *object) g_free (self->priv->content_type); g_free (self->priv->default_text); + g_signal_handlers_disconnect_by_func (self->priv->monitor, app_info_changed, self); + g_object_unref (self->priv->monitor); G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->finalize (object); } @@ -1128,6 +1139,10 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self) self->priv->secondary_padding, padding_cell_renderer_func, NULL, NULL); + + self->priv->monitor = g_app_info_monitor_get (); + g_signal_connect (self->priv->monitor, "changed", + G_CALLBACK (app_info_changed), self); } static GAppInfo * |