open-with: add a public _refresh() method

This can be useful now that we're splitting some items from the widget.
This commit is contained in:
Cosimo Cecchi 2010-11-22 23:02:57 +01:00
parent f12ff4b676
commit 3b6941f087
5 changed files with 28 additions and 13 deletions

View File

@ -66,3 +66,9 @@ gtk_open_with_get_app_info (GtkOpenWith *self)
{
return GTK_OPEN_WITH_GET_IFACE (self)->get_app_info (self);
}
void
gtk_open_with_refresh (GtkOpenWith *self)
{
GTK_OPEN_WITH_GET_IFACE (self)->refresh (self);
}

View File

@ -46,6 +46,7 @@ GType gtk_open_with_get_type () G_GNUC_CONST;
GAppInfo * gtk_open_with_get_app_info (GtkOpenWith *self);
gchar * gtk_open_with_get_content_type (GtkOpenWith *self);
void gtk_open_with_refresh (GtkOpenWith *self);
G_END_DECLS

View File

@ -106,7 +106,7 @@ search_for_mimetype_ready_cb (GObject *source,
}
else
{
_gtk_open_with_widget_refilter (GTK_OPEN_WITH_WIDGET (self->priv->open_with_widget));
gtk_open_with_refresh (GTK_OPEN_WITH (self->priv->open_with_widget));
}
g_object_unref (online);
@ -417,6 +417,14 @@ gtk_open_with_dialog_get_app_info (GtkOpenWith *object)
return app;
}
static void
gtk_open_with_dialog_refresh (GtkOpenWith *object)
{
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
gtk_open_with_refresh (GTK_OPEN_WITH (self->priv->open_with_widget));
}
static void
gtk_open_with_dialog_constructed (GObject *object)
{
@ -496,6 +504,7 @@ static void
gtk_open_with_dialog_iface_init (GtkOpenWithIface *iface)
{
iface->get_app_info = gtk_open_with_dialog_get_app_info;
iface->refresh = gtk_open_with_dialog_refresh;
}
static void

View File

@ -39,8 +39,7 @@ struct _GtkOpenWithIface {
GTypeInterface base_iface;
GAppInfo * (* get_app_info) (GtkOpenWith *object);
void (* refresh) (GtkOpenWith *object);
};
void _gtk_open_with_widget_refilter (GtkOpenWithWidget *self);
#endif /* __GTK_OPEN_WITH_PRIVATE_H__ */

View File

@ -197,7 +197,7 @@ item_forget_association_cb (GtkMenuItem *item,
g_app_info_remove_supports_type (info, self->priv->content_type, NULL);
}
_gtk_open_with_widget_refilter (self);
gtk_open_with_refresh (GTK_OPEN_WITH (self));
}
static GtkWidget *
@ -1061,16 +1061,9 @@ gtk_open_with_widget_get_app_info (GtkOpenWith *object)
}
static void
gtk_open_with_widget_iface_init (GtkOpenWithIface *iface)
gtk_open_with_widget_refresh (GtkOpenWith *object)
{
iface->get_app_info = gtk_open_with_widget_get_app_info;
}
void
_gtk_open_with_widget_refilter (GtkOpenWithWidget *self)
{
gtk_open_with_widget_ensure_show_more_button (self);
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
if (self->priv->program_list_store != NULL)
{
@ -1085,6 +1078,13 @@ _gtk_open_with_widget_refilter (GtkOpenWithWidget *self)
}
}
static void
gtk_open_with_widget_iface_init (GtkOpenWithIface *iface)
{
iface->get_app_info = gtk_open_with_widget_get_app_info;
iface->refresh = gtk_open_with_widget_refresh;
}
GtkWidget *
gtk_open_with_widget_new (const gchar *content_type)
{