app-chooser: rename GtkOpenWith to GtkAppChooser
This commit is contained in:
parent
6f0a605891
commit
05bb715c51
@ -246,10 +246,10 @@ gtk_public_h_sources = \
|
|||||||
gtkmountoperation.h \
|
gtkmountoperation.h \
|
||||||
gtknotebook.h \
|
gtknotebook.h \
|
||||||
gtkoffscreenwindow.h \
|
gtkoffscreenwindow.h \
|
||||||
gtkopenwith.h \
|
gtkappchooser.h \
|
||||||
gtkopenwithdialog.h \
|
gtkappchooserdialog.h \
|
||||||
gtkopenwithwidget.h \
|
gtkappchooserwidget.h \
|
||||||
gtkopenwithonline.h \
|
gtkappchooseronline.h \
|
||||||
gtkorientable.h \
|
gtkorientable.h \
|
||||||
gtkpagesetup.h \
|
gtkpagesetup.h \
|
||||||
gtkpaned.h \
|
gtkpaned.h \
|
||||||
@ -354,14 +354,14 @@ gtk_semi_private_h_sources = \
|
|||||||
gtktextlayout.h
|
gtktextlayout.h
|
||||||
|
|
||||||
if ENABLE_PACKAGEKIT
|
if ENABLE_PACKAGEKIT
|
||||||
gtk_openwith_impl_h_sources = \
|
gtk_appchooser_impl_h_sources = \
|
||||||
gtkopenwithonlinepk.h \
|
gtkappchooseronlinepk.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_PACKAGEKIT
|
if ENABLE_PACKAGEKIT
|
||||||
gtk_openwith_impl_c_sources = \
|
gtk_appchooser_impl_c_sources = \
|
||||||
gtkopenwithonlinepk.c \
|
gtkappchooseronlinepk.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -389,9 +389,9 @@ gtk_private_h_sources = \
|
|||||||
gtkmenuprivate.h \
|
gtkmenuprivate.h \
|
||||||
gtkmnemonichash.h \
|
gtkmnemonichash.h \
|
||||||
gtkmountoperationprivate.h \
|
gtkmountoperationprivate.h \
|
||||||
gtkopenwithprivate.h \
|
gtkappchooserprivate.h \
|
||||||
gtkopenwithmodule.h \
|
gtkappchoosermodule.h \
|
||||||
gtkopenwithonlinedummy.h \
|
gtkappchooseronlinedummy.h \
|
||||||
gtkpango.h \
|
gtkpango.h \
|
||||||
gtkpathbar.h \
|
gtkpathbar.h \
|
||||||
gtkplugprivate.h \
|
gtkplugprivate.h \
|
||||||
@ -420,7 +420,7 @@ gtk_private_h_sources = \
|
|||||||
gtkwindow-decorate.h \
|
gtkwindow-decorate.h \
|
||||||
gtkwidgetprivate.h \
|
gtkwidgetprivate.h \
|
||||||
$(gtk_clipboard_dnd_h_sources) \
|
$(gtk_clipboard_dnd_h_sources) \
|
||||||
$(gtk_openwith_impl_h_sources)
|
$(gtk_appchooser_impl_h_sources)
|
||||||
|
|
||||||
# GTK+ C sources to build the library from
|
# GTK+ C sources to build the library from
|
||||||
gtk_base_c_sources = \
|
gtk_base_c_sources = \
|
||||||
@ -536,12 +536,12 @@ gtk_base_c_sources = \
|
|||||||
gtkmountoperation.c \
|
gtkmountoperation.c \
|
||||||
gtknotebook.c \
|
gtknotebook.c \
|
||||||
gtkoffscreenwindow.c \
|
gtkoffscreenwindow.c \
|
||||||
gtkopenwith.c \
|
gtkappchooser.c \
|
||||||
gtkopenwithwidget.c \
|
gtkappchooserwidget.c \
|
||||||
gtkopenwithdialog.c \
|
gtkappchooserdialog.c \
|
||||||
gtkopenwithmodule.c \
|
gtkappchoosermodule.c \
|
||||||
gtkopenwithonline.c \
|
gtkappchooseronline.c \
|
||||||
gtkopenwithonlinedummy.c \
|
gtkappchooseronlinedummy.c \
|
||||||
gtkorientable.c \
|
gtkorientable.c \
|
||||||
gtkpagesetup.c \
|
gtkpagesetup.c \
|
||||||
gtkpaned.c \
|
gtkpaned.c \
|
||||||
@ -647,7 +647,7 @@ gtk_base_c_sources = \
|
|||||||
gtkwindow-decorate.c \
|
gtkwindow-decorate.c \
|
||||||
gtkwindow.c \
|
gtkwindow.c \
|
||||||
$(gtk_clipboard_dnd_c_sources) \
|
$(gtk_clipboard_dnd_c_sources) \
|
||||||
$(gtk_openwith_impl_c_sources)
|
$(gtk_appchooser_impl_c_sources)
|
||||||
|
|
||||||
gtk_c_sources = $(gtk_base_c_sources)
|
gtk_c_sources = $(gtk_base_c_sources)
|
||||||
gtk_all_c_sources = $(gtk_base_c_sources)
|
gtk_all_c_sources = $(gtk_base_c_sources)
|
||||||
|
@ -129,9 +129,9 @@
|
|||||||
#include <gtk/gtkmountoperation.h>
|
#include <gtk/gtkmountoperation.h>
|
||||||
#include <gtk/gtknotebook.h>
|
#include <gtk/gtknotebook.h>
|
||||||
#include <gtk/gtkoffscreenwindow.h>
|
#include <gtk/gtkoffscreenwindow.h>
|
||||||
#include <gtk/gtkopenwith.h>
|
#include <gtk/gtkappchooser.h>
|
||||||
#include <gtk/gtkopenwithdialog.h>
|
#include <gtk/gtkappchooserdialog.h>
|
||||||
#include <gtk/gtkopenwithwidget.h>
|
#include <gtk/gtkappchooserwidget.h>
|
||||||
#include <gtk/gtkorientable.h>
|
#include <gtk/gtkorientable.h>
|
||||||
#include <gtk/gtkpagesetup.h>
|
#include <gtk/gtkpagesetup.h>
|
||||||
#include <gtk/gtkpapersize.h>
|
#include <gtk/gtkpapersize.h>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwith.c: open-with interface
|
* gtkappchooser.c: app-chooser interface
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -23,18 +23,18 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwith.h"
|
#include "gtkappchooser.h"
|
||||||
|
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkopenwithprivate.h"
|
#include "gtkappchooserprivate.h"
|
||||||
#include "gtkwidget.h"
|
#include "gtkwidget.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (GtkOpenWith, gtk_open_with, GTK_TYPE_WIDGET);
|
G_DEFINE_INTERFACE (GtkAppChooser, gtk_app_chooser, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_default_init (GtkOpenWithIface *iface)
|
gtk_app_chooser_default_init (GtkAppChooserIface *iface)
|
||||||
{
|
{
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
|
|
||||||
@ -48,11 +48,11 @@ gtk_open_with_default_init (GtkOpenWithIface *iface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
gtk_open_with_get_content_type (GtkOpenWith *self)
|
gtk_app_chooser_get_content_type (GtkAppChooser *self)
|
||||||
{
|
{
|
||||||
gchar *retval = NULL;
|
gchar *retval = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH (self), NULL);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER (self), NULL);
|
||||||
|
|
||||||
g_object_get (self,
|
g_object_get (self,
|
||||||
"content-type", &retval,
|
"content-type", &retval,
|
||||||
@ -62,13 +62,13 @@ gtk_open_with_get_content_type (GtkOpenWith *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GAppInfo *
|
GAppInfo *
|
||||||
gtk_open_with_get_app_info (GtkOpenWith *self)
|
gtk_app_chooser_get_app_info (GtkAppChooser *self)
|
||||||
{
|
{
|
||||||
return GTK_OPEN_WITH_GET_IFACE (self)->get_app_info (self);
|
return GTK_APP_CHOOSER_GET_IFACE (self)->get_app_info (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_refresh (GtkOpenWith *self)
|
gtk_app_chooser_refresh (GtkAppChooser *self)
|
||||||
{
|
{
|
||||||
GTK_OPEN_WITH_GET_IFACE (self)->refresh (self);
|
GTK_APP_CHOOSER_GET_IFACE (self)->refresh (self);
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwith.h: open-with interface
|
* gtkappchooser.h: app-chooser interface
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -25,30 +25,30 @@
|
|||||||
#error "Only <gtk/gtk.h> can be included directly."
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_H__
|
#ifndef __GTK_APP_CHOOSER_H__
|
||||||
#define __GTK_OPEN_WITH_H__
|
#define __GTK_APP_CHOOSER_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GTK_TYPE_OPEN_WITH\
|
#define GTK_TYPE_APP_CHOOSER\
|
||||||
(gtk_open_with_get_type ())
|
(gtk_app_chooser_get_type ())
|
||||||
#define GTK_OPEN_WITH(obj)\
|
#define GTK_APP_CHOOSER(obj)\
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_OPEN_WITH, GtkOpenWith))
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APP_CHOOSER, GtkAppChooser))
|
||||||
#define GTK_IS_OPEN_WITH(obj)\
|
#define GTK_IS_APP_CHOOSER(obj)\
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_OPEN_WITH))
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APP_CHOOSER))
|
||||||
|
|
||||||
typedef struct _GtkOpenWith GtkOpenWith;
|
typedef struct _GtkAppChooser GtkAppChooser;
|
||||||
|
|
||||||
GType gtk_open_with_get_type () G_GNUC_CONST;
|
GType gtk_app_chooser_get_type () G_GNUC_CONST;
|
||||||
|
|
||||||
GAppInfo * gtk_open_with_get_app_info (GtkOpenWith *self);
|
GAppInfo * gtk_app_chooser_get_app_info (GtkAppChooser *self);
|
||||||
gchar * gtk_open_with_get_content_type (GtkOpenWith *self);
|
gchar * gtk_app_chooser_get_content_type (GtkAppChooser *self);
|
||||||
void gtk_open_with_refresh (GtkOpenWith *self);
|
void gtk_app_chooser_refresh (GtkAppChooser *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_H__ */
|
#endif /* __GTK_APP_CHOOSER_H__ */
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithdialog.c: an open-with dialog
|
* gtkappchooserdialog.c: an app-chooser dialog
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Novell, Inc.
|
* Copyright (C) 2004 Novell, Inc.
|
||||||
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
||||||
@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwithdialog.h"
|
#include "gtkappchooserdialog.h"
|
||||||
|
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkopenwith.h"
|
#include "gtkappchooser.h"
|
||||||
#include "gtkopenwithonline.h"
|
#include "gtkappchooseronline.h"
|
||||||
#include "gtkopenwithprivate.h"
|
#include "gtkappchooserprivate.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#define sure_string(s) ((const char *) ((s) != NULL ? (s) : ""))
|
#define sure_string(s) ((const char *) ((s) != NULL ? (s) : ""))
|
||||||
|
|
||||||
struct _GtkOpenWithDialogPrivate {
|
struct _GtkAppChooserDialogPrivate {
|
||||||
char *content_type;
|
char *content_type;
|
||||||
GFile *gfile;
|
GFile *gfile;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ struct _GtkOpenWithDialogPrivate {
|
|||||||
|
|
||||||
GtkWidget *open_label;
|
GtkWidget *open_label;
|
||||||
|
|
||||||
GtkWidget *open_with_widget;
|
GtkWidget *app_chooser_widget;
|
||||||
GtkWidget *show_more_button;
|
GtkWidget *show_more_button;
|
||||||
|
|
||||||
gboolean show_more_clicked;
|
gboolean show_more_clicked;
|
||||||
@ -62,10 +62,10 @@ enum {
|
|||||||
N_PROPERTIES
|
N_PROPERTIES
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gtk_open_with_dialog_iface_init (GtkOpenWithIface *iface);
|
static void gtk_app_chooser_dialog_iface_init (GtkAppChooserIface *iface);
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkOpenWithDialog, gtk_open_with_dialog, GTK_TYPE_DIALOG,
|
G_DEFINE_TYPE_WITH_CODE (GtkAppChooserDialog, gtk_app_chooser_dialog, GTK_TYPE_DIALOG,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_OPEN_WITH,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_APP_CHOOSER,
|
||||||
gtk_open_with_dialog_iface_init));
|
gtk_app_chooser_dialog_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_error_dialog (const gchar *primary,
|
show_error_dialog (const gchar *primary,
|
||||||
@ -95,11 +95,11 @@ search_for_mimetype_ready_cb (GObject *source,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnline *online = GTK_OPEN_WITH_ONLINE (source);
|
GtkAppChooserOnline *online = GTK_APP_CHOOSER_ONLINE (source);
|
||||||
GtkOpenWithDialog *self = user_data;
|
GtkAppChooserDialog *self = user_data;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
gtk_open_with_online_search_for_mimetype_finish (online, res, &error);
|
gtk_app_chooser_online_search_for_mimetype_finish (online, res, &error);
|
||||||
|
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ search_for_mimetype_ready_cb (GObject *source,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self->priv->open_with_widget));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (online);
|
g_object_unref (online);
|
||||||
@ -119,16 +119,16 @@ static void
|
|||||||
online_button_clicked_cb (GtkButton *b,
|
online_button_clicked_cb (GtkButton *b,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnline *online;
|
GtkAppChooserOnline *online;
|
||||||
GtkOpenWithDialog *self = user_data;
|
GtkAppChooserDialog *self = user_data;
|
||||||
|
|
||||||
online = gtk_open_with_online_get_default ();
|
online = gtk_app_chooser_online_get_default ();
|
||||||
|
|
||||||
gtk_open_with_online_search_for_mimetype_async (online,
|
gtk_app_chooser_online_search_for_mimetype_async (online,
|
||||||
self->priv->content_type,
|
self->priv->content_type,
|
||||||
GTK_WINDOW (self),
|
GTK_WINDOW (self),
|
||||||
search_for_mimetype_ready_cb,
|
search_for_mimetype_ready_cb,
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An application is valid if:
|
/* An application is valid if:
|
||||||
@ -137,7 +137,7 @@ online_button_clicked_cb (GtkButton *b,
|
|||||||
* 2) The user has permissions to run the file
|
* 2) The user has permissions to run the file
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
check_application (GtkOpenWithDialog *self,
|
check_application (GtkAppChooserDialog *self,
|
||||||
GAppInfo **app_out)
|
GAppInfo **app_out)
|
||||||
{
|
{
|
||||||
const char *command;
|
const char *command;
|
||||||
@ -150,7 +150,7 @@ check_application (GtkOpenWithDialog *self,
|
|||||||
|
|
||||||
command = NULL;
|
command = NULL;
|
||||||
|
|
||||||
info = gtk_open_with_get_app_info (GTK_OPEN_WITH (self->priv->open_with_widget));
|
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
|
||||||
command = g_app_info_get_executable (info);
|
command = g_app_info_get_executable (info);
|
||||||
|
|
||||||
g_shell_parse_argv (command, &argc, &argv, &error);
|
g_shell_parse_argv (command, &argc, &argv, &error);
|
||||||
@ -191,21 +191,21 @@ check_application (GtkOpenWithDialog *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
widget_application_selected_cb (GtkOpenWithWidget *widget,
|
widget_application_selected_cb (GtkAppChooserWidget *widget,
|
||||||
GAppInfo *app_info,
|
GAppInfo *app_info,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = user_data;
|
GtkAppChooserDialog *self = user_data;
|
||||||
|
|
||||||
gtk_widget_set_sensitive (self->priv->button, TRUE);
|
gtk_widget_set_sensitive (self->priv->button, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
widget_application_activated_cb (GtkOpenWithWidget *widget,
|
widget_application_activated_cb (GtkAppChooserWidget *widget,
|
||||||
GAppInfo *app_info,
|
GAppInfo *app_info,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = user_data;
|
GtkAppChooserDialog *self = user_data;
|
||||||
|
|
||||||
gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
|
gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ get_extension (const char *basename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_dialog_properties (GtkOpenWithDialog *self)
|
set_dialog_properties (GtkAppChooserDialog *self)
|
||||||
{
|
{
|
||||||
char *label, *name, *extension, *description, *default_text, *string;
|
char *label, *name, *extension, *description, *default_text, *string;
|
||||||
PangoFontDescription *font_desc;
|
PangoFontDescription *font_desc;
|
||||||
@ -273,8 +273,8 @@ set_dialog_properties (GtkOpenWithDialog *self)
|
|||||||
_("Click \"Show other applications\", for more options, or "
|
_("Click \"Show other applications\", for more options, or "
|
||||||
"\"Find applications online\" to install a new application"));
|
"\"Find applications online\" to install a new application"));
|
||||||
|
|
||||||
gtk_open_with_widget_set_default_text (GTK_OPEN_WITH_WIDGET (self->priv->open_with_widget),
|
gtk_app_chooser_widget_set_default_text (GTK_APP_CHOOSER_WIDGET (self->priv->app_chooser_widget),
|
||||||
default_text);
|
default_text);
|
||||||
|
|
||||||
g_free (label);
|
g_free (label);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
@ -288,9 +288,9 @@ static void
|
|||||||
show_more_button_clicked_cb (GtkButton *button,
|
show_more_button_clicked_cb (GtkButton *button,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = user_data;
|
GtkAppChooserDialog *self = user_data;
|
||||||
|
|
||||||
g_object_set (self->priv->open_with_widget,
|
g_object_set (self->priv->app_chooser_widget,
|
||||||
"show-recommended", TRUE,
|
"show-recommended", TRUE,
|
||||||
"show-fallback", TRUE,
|
"show-fallback", TRUE,
|
||||||
"show-other", TRUE,
|
"show-other", TRUE,
|
||||||
@ -305,11 +305,11 @@ widget_notify_for_button_cb (GObject *source,
|
|||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = user_data;
|
GtkAppChooserDialog *self = user_data;
|
||||||
GtkOpenWithWidget *widget = GTK_OPEN_WITH_WIDGET (source);
|
GtkAppChooserWidget *widget = GTK_APP_CHOOSER_WIDGET (source);
|
||||||
gboolean should_hide;
|
gboolean should_hide;
|
||||||
|
|
||||||
should_hide = gtk_open_with_widget_get_show_all (widget) ||
|
should_hide = gtk_app_chooser_widget_get_show_all (widget) ||
|
||||||
self->priv->show_more_clicked;
|
self->priv->show_more_clicked;
|
||||||
|
|
||||||
if (should_hide)
|
if (should_hide)
|
||||||
@ -317,7 +317,7 @@ widget_notify_for_button_cb (GObject *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_dialog_ui (GtkOpenWithDialog *self)
|
build_dialog_ui (GtkAppChooserDialog *self)
|
||||||
{
|
{
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *vbox2;
|
GtkWidget *vbox2;
|
||||||
@ -342,16 +342,16 @@ build_dialog_ui (GtkOpenWithDialog *self)
|
|||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (self->priv->label);
|
gtk_widget_show (self->priv->label);
|
||||||
|
|
||||||
self->priv->open_with_widget =
|
self->priv->app_chooser_widget =
|
||||||
gtk_open_with_widget_new (self->priv->content_type);
|
gtk_app_chooser_widget_new (self->priv->content_type);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), self->priv->open_with_widget, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), self->priv->app_chooser_widget, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (self->priv->open_with_widget);
|
gtk_widget_show (self->priv->app_chooser_widget);
|
||||||
|
|
||||||
g_signal_connect (self->priv->open_with_widget, "application-selected",
|
g_signal_connect (self->priv->app_chooser_widget, "application-selected",
|
||||||
G_CALLBACK (widget_application_selected_cb), self);
|
G_CALLBACK (widget_application_selected_cb), self);
|
||||||
g_signal_connect (self->priv->open_with_widget, "application-activated",
|
g_signal_connect (self->priv->app_chooser_widget, "application-activated",
|
||||||
G_CALLBACK (widget_application_activated_cb), self);
|
G_CALLBACK (widget_application_activated_cb), self);
|
||||||
g_signal_connect (self->priv->open_with_widget, "notify::show-all",
|
g_signal_connect (self->priv->app_chooser_widget, "notify::show-all",
|
||||||
G_CALLBACK (widget_notify_for_button_cb), self);
|
G_CALLBACK (widget_notify_for_button_cb), self);
|
||||||
|
|
||||||
button = gtk_button_new_with_label (_("Show other applications"));
|
button = gtk_button_new_with_label (_("Show other applications"));
|
||||||
@ -359,7 +359,7 @@ build_dialog_ui (GtkOpenWithDialog *self)
|
|||||||
w = gtk_image_new_from_stock (GTK_STOCK_ADD,
|
w = gtk_image_new_from_stock (GTK_STOCK_ADD,
|
||||||
GTK_ICON_SIZE_BUTTON);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_button_set_image (GTK_BUTTON (button), w);
|
gtk_button_set_image (GTK_BUTTON (button), w);
|
||||||
gtk_box_pack_start (GTK_BOX (self->priv->open_with_widget), button, FALSE, FALSE, 6);
|
gtk_box_pack_start (GTK_BOX (self->priv->app_chooser_widget), button, FALSE, FALSE, 6);
|
||||||
gtk_widget_show_all (button);
|
gtk_widget_show_all (button);
|
||||||
|
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
@ -402,7 +402,7 @@ build_dialog_ui (GtkOpenWithDialog *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_gfile_and_content_type (GtkOpenWithDialog *self,
|
set_gfile_and_content_type (GtkAppChooserDialog *self,
|
||||||
GFile *file)
|
GFile *file)
|
||||||
{
|
{
|
||||||
GFileInfo *info;
|
GFileInfo *info;
|
||||||
@ -421,9 +421,9 @@ set_gfile_and_content_type (GtkOpenWithDialog *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GAppInfo *
|
static GAppInfo *
|
||||||
gtk_open_with_dialog_get_app_info (GtkOpenWith *object)
|
gtk_app_chooser_dialog_get_app_info (GtkAppChooser *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
|
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
|
||||||
GAppInfo *app = NULL;
|
GAppInfo *app = NULL;
|
||||||
|
|
||||||
if (!check_application (self, &app))
|
if (!check_application (self, &app))
|
||||||
@ -433,48 +433,48 @@ gtk_open_with_dialog_get_app_info (GtkOpenWith *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_refresh (GtkOpenWith *object)
|
gtk_app_chooser_dialog_refresh (GtkAppChooser *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
|
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self->priv->open_with_widget));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_constructed (GObject *object)
|
gtk_app_chooser_dialog_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
|
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
|
||||||
|
|
||||||
g_assert (self->priv->content_type != NULL ||
|
g_assert (self->priv->content_type != NULL ||
|
||||||
self->priv->gfile != NULL);
|
self->priv->gfile != NULL);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (gtk_open_with_dialog_parent_class)->constructed != NULL)
|
if (G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed != NULL)
|
||||||
G_OBJECT_CLASS (gtk_open_with_dialog_parent_class)->constructed (object);
|
G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed (object);
|
||||||
|
|
||||||
build_dialog_ui (self);
|
build_dialog_ui (self);
|
||||||
set_dialog_properties (self);
|
set_dialog_properties (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_finalize (GObject *object)
|
gtk_app_chooser_dialog_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
|
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
|
||||||
|
|
||||||
if (self->priv->gfile)
|
if (self->priv->gfile)
|
||||||
g_object_unref (self->priv->gfile);
|
g_object_unref (self->priv->gfile);
|
||||||
|
|
||||||
g_free (self->priv->content_type);
|
g_free (self->priv->content_type);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_open_with_dialog_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_set_property (GObject *object,
|
gtk_app_chooser_dialog_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
|
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@ -493,12 +493,12 @@ gtk_open_with_dialog_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_get_property (GObject *object,
|
gtk_app_chooser_dialog_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (object);
|
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@ -516,23 +516,23 @@ gtk_open_with_dialog_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_iface_init (GtkOpenWithIface *iface)
|
gtk_app_chooser_dialog_iface_init (GtkAppChooserIface *iface)
|
||||||
{
|
{
|
||||||
iface->get_app_info = gtk_open_with_dialog_get_app_info;
|
iface->get_app_info = gtk_app_chooser_dialog_get_app_info;
|
||||||
iface->refresh = gtk_open_with_dialog_refresh;
|
iface->refresh = gtk_app_chooser_dialog_refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_class_init (GtkOpenWithDialogClass *klass)
|
gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
gobject_class->finalize = gtk_open_with_dialog_finalize;
|
gobject_class->finalize = gtk_app_chooser_dialog_finalize;
|
||||||
gobject_class->set_property = gtk_open_with_dialog_set_property;
|
gobject_class->set_property = gtk_app_chooser_dialog_set_property;
|
||||||
gobject_class->get_property = gtk_open_with_dialog_get_property;
|
gobject_class->get_property = gtk_app_chooser_dialog_get_property;
|
||||||
gobject_class->constructed = gtk_open_with_dialog_constructed;
|
gobject_class->constructed = gtk_app_chooser_dialog_constructed;
|
||||||
|
|
||||||
g_object_class_override_property (gobject_class, PROP_CONTENT_TYPE, "content-type");
|
g_object_class_override_property (gobject_class, PROP_CONTENT_TYPE, "content-type");
|
||||||
|
|
||||||
@ -544,14 +544,14 @@ gtk_open_with_dialog_class_init (GtkOpenWithDialogClass *klass)
|
|||||||
G_PARAM_STATIC_STRINGS);
|
G_PARAM_STATIC_STRINGS);
|
||||||
g_object_class_install_property (gobject_class, PROP_GFILE, pspec);
|
g_object_class_install_property (gobject_class, PROP_GFILE, pspec);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GtkOpenWithDialogPrivate));
|
g_type_class_add_private (klass, sizeof (GtkAppChooserDialogPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_dialog_init (GtkOpenWithDialog *self)
|
gtk_app_chooser_dialog_init (GtkAppChooserDialog *self)
|
||||||
{
|
{
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_OPEN_WITH_DIALOG,
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_APP_CHOOSER_DIALOG,
|
||||||
GtkOpenWithDialogPrivate);
|
GtkAppChooserDialogPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -571,28 +571,28 @@ set_parent_and_flags (GtkWidget *dialog,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_open_with_dialog_new:
|
* gtk_app_chooser_dialog_new:
|
||||||
* @parent: (allow-none): a #GtkWindow, or %NULL
|
* @parent: (allow-none): a #GtkWindow, or %NULL
|
||||||
* @flags: flags for this dialog
|
* @flags: flags for this dialog
|
||||||
* @file: a #GFile
|
* @file: a #GFile
|
||||||
*
|
*
|
||||||
* Creates a new #GtkOpenWithDialog for the provided #GFile, to allow
|
* Creates a new #GtkAppChooserDialog for the provided #GFile, to allow
|
||||||
* the user to select an application for it.
|
* the user to select an application for it.
|
||||||
*
|
*
|
||||||
* Returns: a newly created #GtkOpenWithDialog
|
* Returns: a newly created #GtkAppChooserDialog
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_open_with_dialog_new (GtkWindow *parent,
|
gtk_app_chooser_dialog_new (GtkWindow *parent,
|
||||||
GtkDialogFlags flags,
|
GtkDialogFlags flags,
|
||||||
GFile *file)
|
GFile *file)
|
||||||
{
|
{
|
||||||
GtkWidget *retval;
|
GtkWidget *retval;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
||||||
|
|
||||||
retval = g_object_new (GTK_TYPE_OPEN_WITH_DIALOG,
|
retval = g_object_new (GTK_TYPE_APP_CHOOSER_DIALOG,
|
||||||
"gfile", file,
|
"gfile", file,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -602,28 +602,28 @@ gtk_open_with_dialog_new (GtkWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_open_with_dialog_new_for_content_type:
|
* gtk_app_chooser_dialog_new_for_content_type:
|
||||||
* @parent: (allow-none): a #GtkWindow, or %NULL
|
* @parent: (allow-none): a #GtkWindow, or %NULL
|
||||||
* @flags: flags for this dialog
|
* @flags: flags for this dialog
|
||||||
* @content_type: a content type string
|
* @content_type: a content type string
|
||||||
*
|
*
|
||||||
* Creates a new #GtkOpenWithDialog for the provided content type, to allow
|
* Creates a new #GtkAppChooserDialog for the provided content type, to allow
|
||||||
* the user to select an application for it.
|
* the user to select an application for it.
|
||||||
*
|
*
|
||||||
* Returns: a newly created #GtkOpenWithDialog
|
* Returns: a newly created #GtkAppChooserDialog
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_open_with_dialog_new_for_content_type (GtkWindow *parent,
|
gtk_app_chooser_dialog_new_for_content_type (GtkWindow *parent,
|
||||||
GtkDialogFlags flags,
|
GtkDialogFlags flags,
|
||||||
const gchar *content_type)
|
const gchar *content_type)
|
||||||
{
|
{
|
||||||
GtkWidget *retval;
|
GtkWidget *retval;
|
||||||
|
|
||||||
g_return_val_if_fail (content_type != NULL, NULL);
|
g_return_val_if_fail (content_type != NULL, NULL);
|
||||||
|
|
||||||
retval = g_object_new (GTK_TYPE_OPEN_WITH_DIALOG,
|
retval = g_object_new (GTK_TYPE_APP_CHOOSER_DIALOG,
|
||||||
"content-type", content_type,
|
"content-type", content_type,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -633,9 +633,9 @@ gtk_open_with_dialog_new_for_content_type (GtkWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_open_with_dialog_get_widget (GtkOpenWithDialog *self)
|
gtk_app_chooser_dialog_get_widget (GtkAppChooserDialog *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_DIALOG (self), NULL);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_DIALOG (self), NULL);
|
||||||
|
|
||||||
return self->priv->open_with_widget;
|
return self->priv->app_chooser_widget;
|
||||||
}
|
}
|
79
gtk/gtkappchooserdialog.h
Normal file
79
gtk/gtkappchooserdialog.h
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* gtkappchooserdialog.h: an app-chooser dialog
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004 Novell, Inc.
|
||||||
|
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Dave Camp <dave@novell.com>
|
||||||
|
* Alexander Larsson <alexl@redhat.com>
|
||||||
|
* Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GTK_APP_CHOOSER_DIALOG_H__
|
||||||
|
#define __GTK_APP_CHOOSER_DIALOG_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkdialog.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#define GTK_TYPE_APP_CHOOSER_DIALOG\
|
||||||
|
(gtk_app_chooser_dialog_get_type ())
|
||||||
|
#define GTK_APP_CHOOSER_DIALOG(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APP_CHOOSER_DIALOG, GtkAppChooserDialog))
|
||||||
|
#define GTK_APP_CHOOSER_DIALOG_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APP_CHOOSER_DIALOG, GtkAppChooserDialogClass))
|
||||||
|
#define GTK_IS_APP_CHOOSER_DIALOG(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APP_CHOOSER_DIALOG))
|
||||||
|
#define GTK_IS_APP_CHOOSER_DIALOG_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APP_CHOOSER_DIALOG))
|
||||||
|
#define GTK_APP_CHOOSER_DIALOG_GET_CLASS(obj)\
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APP_CHOOSER_DIALOG, GtkAppChooserDialogClass))
|
||||||
|
|
||||||
|
typedef struct _GtkAppChooserDialog GtkAppChooserDialog;
|
||||||
|
typedef struct _GtkAppChooserDialogClass GtkAppChooserDialogClass;
|
||||||
|
typedef struct _GtkAppChooserDialogPrivate GtkAppChooserDialogPrivate;
|
||||||
|
|
||||||
|
struct _GtkAppChooserDialog {
|
||||||
|
GtkDialog parent;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
GtkAppChooserDialogPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkAppChooserDialogClass {
|
||||||
|
GtkDialogClass parent_class;
|
||||||
|
|
||||||
|
/* padding for future class expansion */
|
||||||
|
gpointer padding[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gtk_app_chooser_dialog_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GtkWidget * gtk_app_chooser_dialog_new (GtkWindow *parent,
|
||||||
|
GtkDialogFlags flags,
|
||||||
|
GFile *file);
|
||||||
|
GtkWidget * gtk_app_chooser_dialog_new_for_content_type (GtkWindow *parent,
|
||||||
|
GtkDialogFlags flags,
|
||||||
|
const gchar *content_type);
|
||||||
|
|
||||||
|
GtkWidget * gtk_app_chooser_dialog_get_widget (GtkAppChooserDialog *self);
|
||||||
|
|
||||||
|
#endif /* __GTK_APP_CHOOSER_DIALOG_H__ */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithmodule.c: an extension point for online integration
|
* gtkappchoosermodule.c: an extension point for online integration
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -23,21 +23,21 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwithmodule.h"
|
#include "gtkappchoosermodule.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include "gtkopenwithonline.h"
|
#include "gtkappchooseronline.h"
|
||||||
#include "gtkopenwithonlinedummy.h"
|
#include "gtkappchooseronlinedummy.h"
|
||||||
|
|
||||||
#ifdef ENABLE_PACKAGEKIT
|
#ifdef ENABLE_PACKAGEKIT
|
||||||
#include "gtkopenwithonlinepk.h"
|
#include "gtkappchooseronlinepk.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
G_LOCK_DEFINE_STATIC (registered_ep);
|
G_LOCK_DEFINE_STATIC (registered_ep);
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_open_with_module_ensure (void)
|
_gtk_app_chooser_module_ensure (void)
|
||||||
{
|
{
|
||||||
static gboolean registered_ep = FALSE;
|
static gboolean registered_ep = FALSE;
|
||||||
GIOExtensionPoint *ep;
|
GIOExtensionPoint *ep;
|
||||||
@ -48,13 +48,13 @@ _gtk_open_with_module_ensure (void)
|
|||||||
{
|
{
|
||||||
registered_ep = TRUE;
|
registered_ep = TRUE;
|
||||||
|
|
||||||
ep = g_io_extension_point_register ("gtkopenwith-online");
|
ep = g_io_extension_point_register ("gtkappchooser-online");
|
||||||
g_io_extension_point_set_required_type (ep, GTK_TYPE_OPEN_WITH_ONLINE);
|
g_io_extension_point_set_required_type (ep, GTK_TYPE_APP_CHOOSER_ONLINE);
|
||||||
|
|
||||||
_gtk_open_with_online_dummy_get_type ();
|
_gtk_app_chooser_online_dummy_get_type ();
|
||||||
|
|
||||||
#ifdef ENABLE_PACKAGEKIT
|
#ifdef ENABLE_PACKAGEKIT
|
||||||
_gtk_open_with_online_pk_get_type ();
|
_gtk_app_chooser_online_pk_get_type ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithmodule.h: an extension point for PackageKit integration
|
* gtkappchoosermodule.h: an extension point for online integration
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -21,15 +21,15 @@
|
|||||||
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_MODULE_H__
|
#ifndef __GTK_APP_CHOOSER_MODULE_H__
|
||||||
#define __GTK_OPEN_WITH_MODULE_H__
|
#define __GTK_APP_CHOOSER_MODULE_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
void _gtk_open_with_module_ensure (void);
|
void _gtk_app_chooser_module_ensure (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_MODULE_H__ */
|
#endif /* __GTK_APP_CHOOSER_MODULE_H__ */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithonline.h: an extension point for online integration
|
* gtkappchooseronline.h: an extension point for online integration
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -23,32 +23,32 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwithonline.h"
|
#include "gtkappchooseronline.h"
|
||||||
|
|
||||||
#include "gtkopenwithonlinedummy.h"
|
#include "gtkappchooseronlinedummy.h"
|
||||||
#include "gtkopenwithmodule.h"
|
#include "gtkappchoosermodule.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (GtkOpenWithOnline, gtk_open_with_online, G_TYPE_OBJECT);
|
G_DEFINE_INTERFACE (GtkAppChooserOnline, gtk_app_chooser_online, G_TYPE_OBJECT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_online_default_init (GtkOpenWithOnlineInterface *iface)
|
gtk_app_chooser_online_default_init (GtkAppChooserOnlineInterface *iface)
|
||||||
{
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkOpenWithOnline *
|
GtkAppChooserOnline *
|
||||||
gtk_open_with_online_get_default (void)
|
gtk_app_chooser_online_get_default (void)
|
||||||
{
|
{
|
||||||
GIOExtensionPoint *ep;
|
GIOExtensionPoint *ep;
|
||||||
GIOExtension *extension;
|
GIOExtension *extension;
|
||||||
GList *extensions;
|
GList *extensions;
|
||||||
GtkOpenWithOnline *retval;
|
GtkAppChooserOnline *retval;
|
||||||
|
|
||||||
_gtk_open_with_module_ensure ();
|
_gtk_app_chooser_module_ensure ();
|
||||||
|
|
||||||
ep = g_io_extension_point_lookup ("gtkopenwith-online");
|
ep = g_io_extension_point_lookup ("gtkappchooser-online");
|
||||||
extensions = g_io_extension_point_get_extensions (ep);
|
extensions = g_io_extension_point_get_extensions (ep);
|
||||||
|
|
||||||
if (extensions != NULL)
|
if (extensions != NULL)
|
||||||
@ -60,7 +60,7 @@ gtk_open_with_online_get_default (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retval = g_object_new (GTK_TYPE_OPEN_WITH_ONLINE_DUMMY,
|
retval = g_object_new (GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,31 +68,31 @@ gtk_open_with_online_get_default (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_online_search_for_mimetype_async (GtkOpenWithOnline *self,
|
gtk_app_chooser_online_search_for_mimetype_async (GtkAppChooserOnline *self,
|
||||||
const gchar *content_type,
|
const gchar *content_type,
|
||||||
GtkWindow *parent,
|
GtkWindow *parent,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnlineInterface *iface;
|
GtkAppChooserOnlineInterface *iface;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_ONLINE (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self));
|
||||||
|
|
||||||
iface = GTK_OPEN_WITH_ONLINE_GET_IFACE (self);
|
iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
|
||||||
|
|
||||||
(* iface->search_for_mimetype_async) (self, content_type, parent, callback, user_data);
|
(* iface->search_for_mimetype_async) (self, content_type, parent, callback, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_open_with_online_search_for_mimetype_finish (GtkOpenWithOnline *self,
|
gtk_app_chooser_online_search_for_mimetype_finish (GtkAppChooserOnline *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnlineInterface *iface;
|
GtkAppChooserOnlineInterface *iface;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_ONLINE (self), FALSE);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self), FALSE);
|
||||||
|
|
||||||
iface = GTK_OPEN_WITH_ONLINE_GET_IFACE (self);
|
iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
|
||||||
|
|
||||||
return ((* iface->search_for_mimetype_finish) (self, res, error));
|
return ((* iface->search_for_mimetype_finish) (self, res, error));
|
||||||
}
|
}
|
73
gtk/gtkappchooseronline.h
Normal file
73
gtk/gtkappchooseronline.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* gtkappchooseronline.h: an extension point for online integration
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_APP_CHOOSER_ONLINE_H__
|
||||||
|
#define __GTK_APP_CHOOSER_ONLINE_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <gtk/gtkwindow.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GTK_TYPE_APP_CHOOSER_ONLINE\
|
||||||
|
(gtk_app_chooser_online_get_type ())
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE(o)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_APP_CHOOSER_ONLINE, GtkAppChooserOnline))
|
||||||
|
#define GTK_IS_APP_CHOOSER_ONLINE(o)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_APP_CHOOSER_ONLINE))
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_GET_IFACE(obj)\
|
||||||
|
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_APP_CHOOSER_ONLINE, GtkAppChooserOnlineInterface))
|
||||||
|
|
||||||
|
typedef struct _GtkAppChooserOnline GtkAppChooserOnline;
|
||||||
|
typedef struct _GtkAppChooserOnlineInterface GtkAppChooserOnlineInterface;
|
||||||
|
|
||||||
|
struct _GtkAppChooserOnlineInterface {
|
||||||
|
GTypeInterface g_iface;
|
||||||
|
|
||||||
|
/* Methods */
|
||||||
|
void (*search_for_mimetype_async) (GtkAppChooserOnline *self,
|
||||||
|
const gchar *content_type,
|
||||||
|
GtkWindow *parent,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
gboolean (*search_for_mimetype_finish) (GtkAppChooserOnline *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gtk_app_chooser_online_get_type (void) G_GNUC_CONST;
|
||||||
|
void gtk_app_chooser_online_search_for_mimetype_async (GtkAppChooserOnline *self,
|
||||||
|
const gchar *content_type,
|
||||||
|
GtkWindow *parent,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean gtk_app_chooser_online_search_for_mimetype_finish (GtkAppChooserOnline *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
GtkAppChooserOnline * gtk_app_chooser_online_get_default (void);
|
||||||
|
|
||||||
|
#endif /* __GTK_APP_CHOOSER_ONLINE_H__ */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithonlinedummy.c: an extension point for online integration
|
* gtkappchooseronlinedummy.c: an extension point for online integration
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -23,38 +23,38 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwithonlinedummy.h"
|
#include "gtkappchooseronlinedummy.h"
|
||||||
|
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkopenwithonline.h"
|
#include "gtkappchooseronline.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#define gtk_open_with_online_dummy_get_type _gtk_open_with_online_dummy_get_type
|
#define gtk_app_chooser_online_dummy_get_type _gtk_app_chooser_online_dummy_get_type
|
||||||
static void open_with_online_iface_init (GtkOpenWithOnlineInterface *iface);
|
static void app_chooser_online_iface_init (GtkAppChooserOnlineInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkOpenWithOnlineDummy, gtk_open_with_online_dummy,
|
G_DEFINE_TYPE_WITH_CODE (GtkAppChooserOnlineDummy, gtk_app_chooser_online_dummy,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_OPEN_WITH_ONLINE,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_APP_CHOOSER_ONLINE,
|
||||||
open_with_online_iface_init)
|
app_chooser_online_iface_init)
|
||||||
g_io_extension_point_implement ("gtkopenwith-online",
|
g_io_extension_point_implement ("gtkappchooser-online",
|
||||||
g_define_type_id,
|
g_define_type_id,
|
||||||
"dummy", 0));
|
"dummy", 0));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_online_dummy_class_init (GtkOpenWithOnlineDummyClass *klass)
|
gtk_app_chooser_online_dummy_class_init (GtkAppChooserOnlineDummyClass *klass)
|
||||||
{
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_online_dummy_init (GtkOpenWithOnlineDummy *self)
|
gtk_app_chooser_online_dummy_init (GtkAppChooserOnlineDummy *self)
|
||||||
{
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
dummy_search_mime_finish (GtkOpenWithOnline *obj,
|
dummy_search_mime_finish (GtkAppChooserOnline *obj,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ dummy_search_mime_finish (GtkOpenWithOnline *obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dummy_search_mime_async (GtkOpenWithOnline *obj,
|
dummy_search_mime_async (GtkAppChooserOnline *obj,
|
||||||
const gchar *content_type,
|
const gchar *content_type,
|
||||||
GtkWindow *parent,
|
GtkWindow *parent,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
@ -79,7 +79,7 @@ dummy_search_mime_async (GtkOpenWithOnline *obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
open_with_online_iface_init (GtkOpenWithOnlineInterface *iface)
|
app_chooser_online_iface_init (GtkAppChooserOnlineInterface *iface)
|
||||||
{
|
{
|
||||||
iface->search_for_mimetype_async = dummy_search_mime_async;
|
iface->search_for_mimetype_async = dummy_search_mime_async;
|
||||||
iface->search_for_mimetype_finish = dummy_search_mime_finish;
|
iface->search_for_mimetype_finish = dummy_search_mime_finish;
|
59
gtk/gtkappchooseronlinedummy.h
Normal file
59
gtk/gtkappchooseronlinedummy.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* gtkappchooseronlinedummy.h: an extension point for online integration
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_APP_CHOOSER_ONLINE_DUMMY_H__
|
||||||
|
#define __GTK_APP_CHOOSER_ONLINE_DUMMY_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkappchooseronline.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#define GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY\
|
||||||
|
(_gtk_app_chooser_online_dummy_get_type ())
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_DUMMY(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY, GtkAppChooserOnlineDummy))
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_DUMMY_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY, GtkAppChooserOnlineDummyClass))
|
||||||
|
#define GTK_IS_APP_CHOOSER_ONLINE_DUMMY(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY))
|
||||||
|
#define GTK_IS_APP_CHOOSER_ONLINE_DUMMY_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY))
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_DUMMY_GET_CLASS(obj)\
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_DUMMY, GtkAppChooserOnlineDummyClass))
|
||||||
|
|
||||||
|
typedef struct _GtkAppChooserOnlineDummy GtkAppChooserOnlineDummy;
|
||||||
|
typedef struct _GtkAppChooserOnlineDummyClass GtkAppChooserOnlineDummyClass;
|
||||||
|
typedef struct _GtkAppChooserOnlineDummyPrivate GtkAppChooserOnlineDummyPrivate;
|
||||||
|
|
||||||
|
struct _GtkAppChooserOnlineDummy {
|
||||||
|
GObject parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkAppChooserOnlineDummyClass {
|
||||||
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
GtkAppChooserOnlineDummy *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType _gtk_app_chooser_online_dummy_get_type (void);
|
||||||
|
|
||||||
|
#endif /* __GTK_APP_CHOOSER_ONLINE_DUMMY_H__ */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithonlinepk.c: packagekit module for open with
|
* gtkappchooseronlinepk.c: packagekit module for app-chooser
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -23,60 +23,60 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwithonlinepk.h"
|
#include "gtkappchooseronlinepk.h"
|
||||||
|
|
||||||
#include "gtkopenwithonline.h"
|
#include "gtkappchooseronline.h"
|
||||||
#include "x11/gdkx.h"
|
#include "x11/gdkx.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#define gtk_open_with_online_pk_get_type _gtk_open_with_online_pk_get_type
|
#define gtk_app_chooser_online_pk_get_type _gtk_app_chooser_online_pk_get_type
|
||||||
static void open_with_online_iface_init (GtkOpenWithOnlineInterface *iface);
|
static void app_chooser_online_iface_init (GtkAppChooserOnlineInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkOpenWithOnlinePk, gtk_open_with_online_pk,
|
G_DEFINE_TYPE_WITH_CODE (GtkAppChooserOnlinePk, gtk_app_chooser_online_pk,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_OPEN_WITH_ONLINE,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_APP_CHOOSER_ONLINE,
|
||||||
open_with_online_iface_init)
|
app_chooser_online_iface_init)
|
||||||
g_io_extension_point_implement ("gtkopenwith-online",
|
g_io_extension_point_implement ("gtkappchooser-online",
|
||||||
g_define_type_id,
|
g_define_type_id,
|
||||||
"packagekit", 10));
|
"packagekit", 10));
|
||||||
|
|
||||||
struct _GtkOpenWithOnlinePkPrivate {
|
struct _GtkAppChooserOnlinePkPrivate {
|
||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
gchar *content_type;
|
gchar *content_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_online_pk_finalize (GObject *obj)
|
gtk_app_chooser_online_pk_finalize (GObject *obj)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnlinePk *self = GTK_OPEN_WITH_ONLINE_PK (obj);
|
GtkAppChooserOnlinePk *self = GTK_APP_CHOOSER_ONLINE_PK (obj);
|
||||||
|
|
||||||
g_free (self->priv->content_type);
|
g_free (self->priv->content_type);
|
||||||
g_clear_object (&self->priv->result);
|
g_clear_object (&self->priv->result);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_open_with_online_pk_parent_class)->finalize (obj);
|
G_OBJECT_CLASS (gtk_app_chooser_online_pk_parent_class)->finalize (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_online_pk_class_init (GtkOpenWithOnlinePkClass *klass)
|
gtk_app_chooser_online_pk_class_init (GtkAppChooserOnlinePkClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *oclass = G_OBJECT_CLASS (klass);
|
GObjectClass *oclass = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
oclass->finalize = gtk_open_with_online_pk_finalize;
|
oclass->finalize = gtk_app_chooser_online_pk_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GtkOpenWithOnlinePkPrivate));
|
g_type_class_add_private (klass, sizeof (GtkAppChooserOnlinePkPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_online_pk_init (GtkOpenWithOnlinePk *self)
|
gtk_app_chooser_online_pk_init (GtkAppChooserOnlinePk *self)
|
||||||
{
|
{
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_OPEN_WITH_ONLINE_PK,
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_APP_CHOOSER_ONLINE_PK,
|
||||||
GtkOpenWithOnlinePkPrivate);
|
GtkAppChooserOnlinePkPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
pk_search_mime_finish (GtkOpenWithOnline *obj,
|
pk_search_mime_finish (GtkAppChooserOnline *obj,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ install_mime_types_ready_cb (GObject *source,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnlinePk *self = user_data;
|
GtkAppChooserOnlinePk *self = user_data;
|
||||||
GDBusProxy *proxy = G_DBUS_PROXY (source);
|
GDBusProxy *proxy = G_DBUS_PROXY (source);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *variant;
|
GVariant *variant;
|
||||||
@ -116,7 +116,7 @@ pk_proxy_appeared_cb (GObject *source,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnlinePk *self = user_data;
|
GtkAppChooserOnlinePk *self = user_data;
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
guint xid = 0;
|
guint xid = 0;
|
||||||
@ -154,17 +154,17 @@ pk_proxy_appeared_cb (GObject *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pk_search_mime_async (GtkOpenWithOnline *obj,
|
pk_search_mime_async (GtkAppChooserOnline *obj,
|
||||||
const gchar *content_type,
|
const gchar *content_type,
|
||||||
GtkWindow *parent,
|
GtkWindow *parent,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithOnlinePk *self = GTK_OPEN_WITH_ONLINE_PK (obj);
|
GtkAppChooserOnlinePk *self = GTK_APP_CHOOSER_ONLINE_PK (obj);
|
||||||
|
|
||||||
self->priv->result = g_simple_async_result_new (G_OBJECT (self),
|
self->priv->result = g_simple_async_result_new (G_OBJECT (self),
|
||||||
callback, user_data,
|
callback, user_data,
|
||||||
gtk_open_with_online_search_for_mimetype_async);
|
gtk_app_chooser_online_search_for_mimetype_async);
|
||||||
self->priv->parent = parent;
|
self->priv->parent = parent;
|
||||||
self->priv->content_type = g_strdup (content_type);
|
self->priv->content_type = g_strdup (content_type);
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ pk_search_mime_async (GtkOpenWithOnline *obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
open_with_online_iface_init (GtkOpenWithOnlineInterface *iface)
|
app_chooser_online_iface_init (GtkAppChooserOnlineInterface *iface)
|
||||||
{
|
{
|
||||||
iface->search_for_mimetype_async = pk_search_mime_async;
|
iface->search_for_mimetype_async = pk_search_mime_async;
|
||||||
iface->search_for_mimetype_finish = pk_search_mime_finish;
|
iface->search_for_mimetype_finish = pk_search_mime_finish;
|
59
gtk/gtkappchooseronlinepk.h
Normal file
59
gtk/gtkappchooseronlinepk.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* gtkappchooseronlinepk.h: an extension point for online integration
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_APP_CHOOSER_ONLINE_PK_H__
|
||||||
|
#define __GTK_APP_CHOOSER_ONLINE_PK_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkappchooseronline.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#define GTK_TYPE_APP_CHOOSER_ONLINE_PK\
|
||||||
|
(_gtk_app_chooser_online_pk_get_type ())
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_PK(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_PK, GtkAppChooserOnlinePk))
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_PK_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APP_CHOOSER_ONLINE_PK, GtkAppChooserOnlinePkClass))
|
||||||
|
#define GTK_IS_APP_CHOOSER_ONLINE_PK(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_PK))
|
||||||
|
#define GTK_IS_APP_CHOOSER_ONLINE_PK_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APP_CHOOSER_ONLINE_PK))
|
||||||
|
#define GTK_APP_CHOOSER_ONLINE_PK_GET_CLASS(obj)\
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APP_CHOOSER_ONLINE_PK, GtkAppChooserOnlinePkClass))
|
||||||
|
|
||||||
|
typedef struct _GtkAppChooserOnlinePk GtkAppChooserOnlinePk;
|
||||||
|
typedef struct _GtkAppChooserOnlinePkClass GtkAppChooserOnlinePkClass;
|
||||||
|
typedef struct _GtkAppChooserOnlinePkPrivate GtkAppChooserOnlinePkPrivate;
|
||||||
|
|
||||||
|
struct _GtkAppChooserOnlinePk {
|
||||||
|
GObject parent;
|
||||||
|
|
||||||
|
GtkAppChooserOnlinePkPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkAppChooserOnlinePkClass {
|
||||||
|
GObjectClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType _gtk_app_chooser_online_pk_get_type (void);
|
||||||
|
|
||||||
|
#endif /* __GTK_APP_CHOOSER_ONLINE_PK_H__ */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwith.c: open-with interface
|
* gtkappchooserprivate.h: app-chooser interface
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@ -21,25 +21,25 @@
|
|||||||
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_PRIVATE_H__
|
#ifndef __GTK_APP_CHOOSER_PRIVATE_H__
|
||||||
#define __GTK_OPEN_WITH_PRIVATE_H__
|
#define __GTK_APP_CHOOSER_PRIVATE_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include "gtkopenwithwidget.h"
|
#include "gtkappchooserwidget.h"
|
||||||
|
|
||||||
typedef struct _GtkOpenWithIface GtkOpenWithIface;
|
typedef struct _GtkAppChooserIface GtkAppChooserIface;
|
||||||
typedef GtkOpenWithIface GtkOpenWithInterface;
|
typedef GtkAppChooserIface GtkAppChooserInterface;
|
||||||
|
|
||||||
#define GTK_OPEN_WITH_GET_IFACE(inst)\
|
#define GTK_APP_CHOOSER_GET_IFACE(inst)\
|
||||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_OPEN_WITH, GtkOpenWithIface))
|
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_APP_CHOOSER, GtkAppChooserIface))
|
||||||
|
|
||||||
struct _GtkOpenWithIface {
|
struct _GtkAppChooserIface {
|
||||||
GTypeInterface base_iface;
|
GTypeInterface base_iface;
|
||||||
|
|
||||||
GAppInfo * (* get_app_info) (GtkOpenWith *object);
|
GAppInfo * (* get_app_info) (GtkAppChooser *object);
|
||||||
void (* refresh) (GtkOpenWith *object);
|
void (* refresh) (GtkAppChooser *object);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_PRIVATE_H__ */
|
#endif /* __GTK_APP_CHOOSER_PRIVATE_H__ */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* gtkopenwithwidget.c: an open-with widget
|
* gtkappchooserwidget.c: an app-chooser widget
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Novell, Inc.
|
* Copyright (C) 2004 Novell, Inc.
|
||||||
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
||||||
@ -26,19 +26,19 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkopenwithwidget.h"
|
#include "gtkappchooserwidget.h"
|
||||||
|
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkopenwith.h"
|
#include "gtkappchooser.h"
|
||||||
#include "gtkopenwithprivate.h"
|
#include "gtkappchooserprivate.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
struct _GtkOpenWithWidgetPrivate {
|
struct _GtkAppChooserWidgetPrivate {
|
||||||
GAppInfo *selected_app_info;
|
GAppInfo *selected_app_info;
|
||||||
|
|
||||||
gchar *content_type;
|
gchar *content_type;
|
||||||
@ -90,14 +90,14 @@ enum {
|
|||||||
|
|
||||||
static guint signals[N_SIGNALS] = { 0, };
|
static guint signals[N_SIGNALS] = { 0, };
|
||||||
|
|
||||||
static void gtk_open_with_widget_iface_init (GtkOpenWithIface *iface);
|
static void gtk_app_chooser_widget_iface_init (GtkAppChooserIface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkOpenWithWidget, gtk_open_with_widget, GTK_TYPE_BOX,
|
G_DEFINE_TYPE_WITH_CODE (GtkAppChooserWidget, gtk_app_chooser_widget, GTK_TYPE_BOX,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_OPEN_WITH,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_APP_CHOOSER,
|
||||||
gtk_open_with_widget_iface_init));
|
gtk_app_chooser_widget_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
refresh_and_emit_app_selected (GtkOpenWithWidget *self,
|
refresh_and_emit_app_selected (GtkAppChooserWidget *self,
|
||||||
GtkTreeSelection *selection)
|
GtkTreeSelection *selection)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
@ -159,7 +159,7 @@ program_list_selection_activated (GtkTreeView *view,
|
|||||||
GtkTreeViewColumn *column,
|
GtkTreeViewColumn *column,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = user_data;
|
GtkAppChooserWidget *self = user_data;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
if (path_is_heading (view, path))
|
if (path_is_heading (view, path))
|
||||||
@ -174,11 +174,11 @@ program_list_selection_activated (GtkTreeView *view,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_open_with_search_equal_func (GtkTreeModel *model,
|
gtk_app_chooser_search_equal_func (GtkTreeModel *model,
|
||||||
int column,
|
int column,
|
||||||
const char *key,
|
const char *key,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
char *normalized_key;
|
char *normalized_key;
|
||||||
char *name, *normalized_name;
|
char *name, *normalized_name;
|
||||||
@ -244,10 +244,10 @@ gtk_open_with_search_equal_func (GtkTreeModel *model,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_open_with_sort_func (GtkTreeModel *model,
|
gtk_app_chooser_sort_func (GtkTreeModel *model,
|
||||||
GtkTreeIter *a,
|
GtkTreeIter *a,
|
||||||
GtkTreeIter *b,
|
GtkTreeIter *b,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean a_recommended, b_recommended;
|
gboolean a_recommended, b_recommended;
|
||||||
gboolean a_fallback, b_fallback;
|
gboolean a_fallback, b_fallback;
|
||||||
@ -378,11 +378,11 @@ padding_cell_renderer_func (GtkTreeViewColumn *column,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_open_with_selection_func (GtkTreeSelection *selection,
|
gtk_app_chooser_selection_func (GtkTreeSelection *selection,
|
||||||
GtkTreeModel *model,
|
GtkTreeModel *model,
|
||||||
GtkTreePath *path,
|
GtkTreePath *path,
|
||||||
gboolean path_currently_selected,
|
gboolean path_currently_selected,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gboolean heading;
|
gboolean heading;
|
||||||
@ -403,13 +403,13 @@ compare_apps_func (gconstpointer a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_open_with_widget_add_section (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_add_section (GtkAppChooserWidget *self,
|
||||||
const gchar *heading_title,
|
const gchar *heading_title,
|
||||||
gboolean show_headings,
|
gboolean show_headings,
|
||||||
gboolean recommended,
|
gboolean recommended,
|
||||||
gboolean fallback,
|
gboolean fallback,
|
||||||
GList *applications,
|
GList *applications,
|
||||||
GList *exclude_apps)
|
GList *exclude_apps)
|
||||||
{
|
{
|
||||||
gboolean heading_added, unref_icon;
|
gboolean heading_added, unref_icon;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@ -486,8 +486,8 @@ gtk_open_with_widget_add_section (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_add_default (GtkOpenWithWidget *self,
|
gtk_app_chooser_add_default (GtkAppChooserWidget *self,
|
||||||
GAppInfo *app)
|
GAppInfo *app)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
@ -537,7 +537,7 @@ gtk_open_with_add_default (GtkOpenWithWidget *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_no_applications_label (GtkOpenWithWidget *self)
|
add_no_applications_label (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
gchar *text = NULL, *desc;
|
gchar *text = NULL, *desc;
|
||||||
const gchar *string;
|
const gchar *string;
|
||||||
@ -565,7 +565,7 @@ add_no_applications_label (GtkOpenWithWidget *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_select_first (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_select_first (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GAppInfo *info = NULL;
|
GAppInfo *info = NULL;
|
||||||
@ -599,7 +599,7 @@ gtk_open_with_widget_select_first (GtkOpenWithWidget *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_real_add_items (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_real_add_items (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
GList *all_applications = NULL, *recommended_apps = NULL, *fallback_apps = NULL;
|
GList *all_applications = NULL, *recommended_apps = NULL, *fallback_apps = NULL;
|
||||||
GList *exclude_apps = NULL;
|
GList *exclude_apps = NULL;
|
||||||
@ -619,7 +619,7 @@ gtk_open_with_widget_real_add_items (GtkOpenWithWidget *self)
|
|||||||
|
|
||||||
if (default_app != NULL)
|
if (default_app != NULL)
|
||||||
{
|
{
|
||||||
gtk_open_with_add_default (self, default_app);
|
gtk_app_chooser_add_default (self, default_app);
|
||||||
apps_added = TRUE;
|
apps_added = TRUE;
|
||||||
exclude_apps = g_list_prepend (exclude_apps, default_app);
|
exclude_apps = g_list_prepend (exclude_apps, default_app);
|
||||||
}
|
}
|
||||||
@ -629,11 +629,11 @@ gtk_open_with_widget_real_add_items (GtkOpenWithWidget *self)
|
|||||||
{
|
{
|
||||||
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
|
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
|
||||||
|
|
||||||
apps_added |= gtk_open_with_widget_add_section (self, _("Recommended Applications"),
|
apps_added |= gtk_app_chooser_widget_add_section (self, _("Recommended Applications"),
|
||||||
show_headings,
|
show_headings,
|
||||||
!self->priv->show_all, /* mark as recommended */
|
!self->priv->show_all, /* mark as recommended */
|
||||||
FALSE, /* mark as fallback */
|
FALSE, /* mark as fallback */
|
||||||
recommended_apps, exclude_apps);
|
recommended_apps, exclude_apps);
|
||||||
|
|
||||||
exclude_apps = g_list_concat (exclude_apps,
|
exclude_apps = g_list_concat (exclude_apps,
|
||||||
g_list_copy (recommended_apps));
|
g_list_copy (recommended_apps));
|
||||||
@ -643,11 +643,11 @@ gtk_open_with_widget_real_add_items (GtkOpenWithWidget *self)
|
|||||||
{
|
{
|
||||||
fallback_apps = g_app_info_get_fallback_for_type (self->priv->content_type);
|
fallback_apps = g_app_info_get_fallback_for_type (self->priv->content_type);
|
||||||
|
|
||||||
apps_added |= gtk_open_with_widget_add_section (self, _("Related Applications"),
|
apps_added |= gtk_app_chooser_widget_add_section (self, _("Related Applications"),
|
||||||
show_headings,
|
show_headings,
|
||||||
FALSE, /* mark as recommended */
|
FALSE, /* mark as recommended */
|
||||||
!self->priv->show_all, /* mark as fallback */
|
!self->priv->show_all, /* mark as fallback */
|
||||||
fallback_apps, exclude_apps);
|
fallback_apps, exclude_apps);
|
||||||
exclude_apps = g_list_concat (exclude_apps,
|
exclude_apps = g_list_concat (exclude_apps,
|
||||||
g_list_copy (fallback_apps));
|
g_list_copy (fallback_apps));
|
||||||
}
|
}
|
||||||
@ -656,17 +656,17 @@ gtk_open_with_widget_real_add_items (GtkOpenWithWidget *self)
|
|||||||
{
|
{
|
||||||
all_applications = g_app_info_get_all ();
|
all_applications = g_app_info_get_all ();
|
||||||
|
|
||||||
apps_added |= gtk_open_with_widget_add_section (self, _("Other Applications"),
|
apps_added |= gtk_app_chooser_widget_add_section (self, _("Other Applications"),
|
||||||
show_headings,
|
show_headings,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE,
|
FALSE,
|
||||||
all_applications, exclude_apps);
|
all_applications, exclude_apps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!apps_added)
|
if (!apps_added)
|
||||||
add_no_applications_label (self);
|
add_no_applications_label (self);
|
||||||
|
|
||||||
gtk_open_with_widget_select_first (self);
|
gtk_app_chooser_widget_select_first (self);
|
||||||
|
|
||||||
if (default_app != NULL)
|
if (default_app != NULL)
|
||||||
g_object_unref (default_app);
|
g_object_unref (default_app);
|
||||||
@ -685,7 +685,7 @@ gtk_open_with_widget_real_add_items (GtkOpenWithWidget *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_add_items (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_add_items (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
@ -712,12 +712,12 @@ gtk_open_with_widget_add_items (GtkOpenWithWidget *self)
|
|||||||
GTK_SORT_ASCENDING);
|
GTK_SORT_ASCENDING);
|
||||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sort),
|
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sort),
|
||||||
COLUMN_NAME,
|
COLUMN_NAME,
|
||||||
gtk_open_with_sort_func,
|
gtk_app_chooser_sort_func,
|
||||||
self, NULL);
|
self, NULL);
|
||||||
gtk_tree_view_set_search_column (GTK_TREE_VIEW (self->priv->program_list),
|
gtk_tree_view_set_search_column (GTK_TREE_VIEW (self->priv->program_list),
|
||||||
COLUMN_NAME);
|
COLUMN_NAME);
|
||||||
gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (self->priv->program_list),
|
gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (self->priv->program_list),
|
||||||
gtk_open_with_search_equal_func,
|
gtk_app_chooser_search_equal_func,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new ();
|
column = gtk_tree_view_column_new ();
|
||||||
@ -776,16 +776,16 @@ gtk_open_with_widget_add_items (GtkOpenWithWidget *self)
|
|||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (self->priv->program_list), column);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (self->priv->program_list), column);
|
||||||
|
|
||||||
/* populate the widget */
|
/* populate the widget */
|
||||||
gtk_open_with_widget_real_add_items (self);
|
gtk_app_chooser_widget_real_add_items (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_set_property (GObject *object,
|
gtk_app_chooser_widget_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@ -793,22 +793,22 @@ gtk_open_with_widget_set_property (GObject *object,
|
|||||||
self->priv->content_type = g_value_dup_string (value);
|
self->priv->content_type = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_DEFAULT:
|
case PROP_SHOW_DEFAULT:
|
||||||
gtk_open_with_widget_set_show_default (self, g_value_get_boolean (value));
|
gtk_app_chooser_widget_set_show_default (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_RECOMMENDED:
|
case PROP_SHOW_RECOMMENDED:
|
||||||
gtk_open_with_widget_set_show_recommended (self, g_value_get_boolean (value));
|
gtk_app_chooser_widget_set_show_recommended (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_FALLBACK:
|
case PROP_SHOW_FALLBACK:
|
||||||
gtk_open_with_widget_set_show_fallback (self, g_value_get_boolean (value));
|
gtk_app_chooser_widget_set_show_fallback (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_OTHER:
|
case PROP_SHOW_OTHER:
|
||||||
gtk_open_with_widget_set_show_other (self, g_value_get_boolean (value));
|
gtk_app_chooser_widget_set_show_other (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_ALL:
|
case PROP_SHOW_ALL:
|
||||||
gtk_open_with_widget_set_show_all (self, g_value_get_boolean (value));
|
gtk_app_chooser_widget_set_show_all (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
case PROP_DEFAULT_TEXT:
|
case PROP_DEFAULT_TEXT:
|
||||||
gtk_open_with_widget_set_default_text (self, g_value_get_string (value));
|
gtk_app_chooser_widget_set_default_text (self, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
@ -817,12 +817,12 @@ gtk_open_with_widget_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_get_property (GObject *object,
|
gtk_app_chooser_widget_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@ -854,33 +854,33 @@ gtk_open_with_widget_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_constructed (GObject *object)
|
gtk_app_chooser_widget_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
g_assert (self->priv->content_type != NULL);
|
g_assert (self->priv->content_type != NULL);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (gtk_open_with_widget_parent_class)->constructed != NULL)
|
if (G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->constructed != NULL)
|
||||||
G_OBJECT_CLASS (gtk_open_with_widget_parent_class)->constructed (object);
|
G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->constructed (object);
|
||||||
|
|
||||||
gtk_open_with_widget_add_items (self);
|
gtk_app_chooser_widget_add_items (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_finalize (GObject *object)
|
gtk_app_chooser_widget_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
g_free (self->priv->content_type);
|
g_free (self->priv->content_type);
|
||||||
g_free (self->priv->default_text);
|
g_free (self->priv->default_text);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_open_with_widget_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_dispose (GObject *object)
|
gtk_app_chooser_widget_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
if (self->priv->selected_app_info != NULL)
|
if (self->priv->selected_app_info != NULL)
|
||||||
{
|
{
|
||||||
@ -888,21 +888,21 @@ gtk_open_with_widget_dispose (GObject *object)
|
|||||||
self->priv->selected_app_info = NULL;
|
self->priv->selected_app_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_open_with_widget_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_class_init (GtkOpenWithWidgetClass *klass)
|
gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
gobject_class->dispose = gtk_open_with_widget_dispose;
|
gobject_class->dispose = gtk_app_chooser_widget_dispose;
|
||||||
gobject_class->finalize = gtk_open_with_widget_finalize;
|
gobject_class->finalize = gtk_app_chooser_widget_finalize;
|
||||||
gobject_class->set_property = gtk_open_with_widget_set_property;
|
gobject_class->set_property = gtk_app_chooser_widget_set_property;
|
||||||
gobject_class->get_property = gtk_open_with_widget_get_property;
|
gobject_class->get_property = gtk_app_chooser_widget_get_property;
|
||||||
gobject_class->constructed = gtk_open_with_widget_constructed;
|
gobject_class->constructed = gtk_app_chooser_widget_constructed;
|
||||||
|
|
||||||
g_object_class_override_property (gobject_class, PROP_CONTENT_TYPE, "content-type");
|
g_object_class_override_property (gobject_class, PROP_CONTENT_TYPE, "content-type");
|
||||||
|
|
||||||
@ -950,9 +950,9 @@ gtk_open_with_widget_class_init (GtkOpenWithWidgetClass *klass)
|
|||||||
|
|
||||||
signals[SIGNAL_APPLICATION_SELECTED] =
|
signals[SIGNAL_APPLICATION_SELECTED] =
|
||||||
g_signal_new ("application-selected",
|
g_signal_new ("application-selected",
|
||||||
GTK_TYPE_OPEN_WITH_WIDGET,
|
GTK_TYPE_APP_CHOOSER_WIDGET,
|
||||||
G_SIGNAL_RUN_FIRST,
|
G_SIGNAL_RUN_FIRST,
|
||||||
G_STRUCT_OFFSET (GtkOpenWithWidgetClass, application_selected),
|
G_STRUCT_OFFSET (GtkAppChooserWidgetClass, application_selected),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_VOID__OBJECT,
|
_gtk_marshal_VOID__OBJECT,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
@ -960,25 +960,25 @@ gtk_open_with_widget_class_init (GtkOpenWithWidgetClass *klass)
|
|||||||
|
|
||||||
signals[SIGNAL_APPLICATION_ACTIVATED] =
|
signals[SIGNAL_APPLICATION_ACTIVATED] =
|
||||||
g_signal_new ("application-activated",
|
g_signal_new ("application-activated",
|
||||||
GTK_TYPE_OPEN_WITH_WIDGET,
|
GTK_TYPE_APP_CHOOSER_WIDGET,
|
||||||
G_SIGNAL_RUN_FIRST,
|
G_SIGNAL_RUN_FIRST,
|
||||||
G_STRUCT_OFFSET (GtkOpenWithWidgetClass, application_activated),
|
G_STRUCT_OFFSET (GtkAppChooserWidgetClass, application_activated),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_VOID__OBJECT,
|
_gtk_marshal_VOID__OBJECT,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
1, G_TYPE_APP_INFO);
|
1, G_TYPE_APP_INFO);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GtkOpenWithWidgetPrivate));
|
g_type_class_add_private (klass, sizeof (GtkAppChooserWidgetPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_init (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_init (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_OPEN_WITH_WIDGET,
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_APP_CHOOSER_WIDGET,
|
||||||
GtkOpenWithWidgetPrivate);
|
GtkAppChooserWidgetPrivate);
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
|
||||||
|
|
||||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||||
@ -999,7 +999,7 @@ gtk_open_with_widget_init (GtkOpenWithWidget *self)
|
|||||||
|
|
||||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->program_list));
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->program_list));
|
||||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
||||||
gtk_tree_selection_set_select_function (selection, gtk_open_with_selection_func,
|
gtk_tree_selection_set_select_function (selection, gtk_app_chooser_selection_func,
|
||||||
self, NULL);
|
self, NULL);
|
||||||
g_signal_connect_swapped (selection, "changed",
|
g_signal_connect_swapped (selection, "changed",
|
||||||
G_CALLBACK (refresh_and_emit_app_selected),
|
G_CALLBACK (refresh_and_emit_app_selected),
|
||||||
@ -1010,9 +1010,9 @@ gtk_open_with_widget_init (GtkOpenWithWidget *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GAppInfo *
|
static GAppInfo *
|
||||||
gtk_open_with_widget_get_app_info (GtkOpenWith *object)
|
gtk_app_chooser_widget_get_app_info (GtkAppChooser *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
if (self->priv->selected_app_info == NULL)
|
if (self->priv->selected_app_info == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1021,9 +1021,9 @@ gtk_open_with_widget_get_app_info (GtkOpenWith *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_refresh (GtkOpenWith *object)
|
gtk_app_chooser_widget_refresh (GtkAppChooser *object)
|
||||||
{
|
{
|
||||||
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
||||||
|
|
||||||
if (self->priv->program_list_store != NULL)
|
if (self->priv->program_list_store != NULL)
|
||||||
{
|
{
|
||||||
@ -1034,30 +1034,30 @@ gtk_open_with_widget_refresh (GtkOpenWith *object)
|
|||||||
"visible", !self->priv->show_all,
|
"visible", !self->priv->show_all,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_open_with_widget_real_add_items (self);
|
gtk_app_chooser_widget_real_add_items (self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_open_with_widget_iface_init (GtkOpenWithIface *iface)
|
gtk_app_chooser_widget_iface_init (GtkAppChooserIface *iface)
|
||||||
{
|
{
|
||||||
iface->get_app_info = gtk_open_with_widget_get_app_info;
|
iface->get_app_info = gtk_app_chooser_widget_get_app_info;
|
||||||
iface->refresh = gtk_open_with_widget_refresh;
|
iface->refresh = gtk_app_chooser_widget_refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_open_with_widget_new (const gchar *content_type)
|
gtk_app_chooser_widget_new (const gchar *content_type)
|
||||||
{
|
{
|
||||||
return g_object_new (GTK_TYPE_OPEN_WITH_WIDGET,
|
return g_object_new (GTK_TYPE_APP_CHOOSER_WIDGET,
|
||||||
"content-type", content_type,
|
"content-type", content_type,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_widget_set_show_default (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_set_show_default (GtkAppChooserWidget *self,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_WIDGET (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self));
|
||||||
|
|
||||||
if (self->priv->show_default != setting)
|
if (self->priv->show_default != setting)
|
||||||
{
|
{
|
||||||
@ -1065,23 +1065,23 @@ gtk_open_with_widget_set_show_default (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "show-default");
|
g_object_notify (G_OBJECT (self), "show-default");
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_open_with_widget_get_show_default (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_get_show_default (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_WIDGET (self), FALSE);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self), FALSE);
|
||||||
|
|
||||||
return self->priv->show_default;
|
return self->priv->show_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_widget_set_show_recommended (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_set_show_recommended (GtkAppChooserWidget *self,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_WIDGET (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self));
|
||||||
|
|
||||||
if (self->priv->show_recommended != setting)
|
if (self->priv->show_recommended != setting)
|
||||||
{
|
{
|
||||||
@ -1089,23 +1089,23 @@ gtk_open_with_widget_set_show_recommended (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "show-recommended");
|
g_object_notify (G_OBJECT (self), "show-recommended");
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_open_with_widget_get_show_recommended (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_get_show_recommended (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_WIDGET (self), FALSE);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self), FALSE);
|
||||||
|
|
||||||
return self->priv->show_recommended;
|
return self->priv->show_recommended;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_widget_set_show_fallback (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_set_show_fallback (GtkAppChooserWidget *self,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_WIDGET (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self));
|
||||||
|
|
||||||
if (self->priv->show_fallback != setting)
|
if (self->priv->show_fallback != setting)
|
||||||
{
|
{
|
||||||
@ -1113,23 +1113,23 @@ gtk_open_with_widget_set_show_fallback (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "show-fallback");
|
g_object_notify (G_OBJECT (self), "show-fallback");
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_open_with_widget_get_show_fallback (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_get_show_fallback (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_WIDGET (self), FALSE);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self), FALSE);
|
||||||
|
|
||||||
return self->priv->show_fallback;
|
return self->priv->show_fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_widget_set_show_other (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_set_show_other (GtkAppChooserWidget *self,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_WIDGET (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self));
|
||||||
|
|
||||||
if (self->priv->show_other != setting)
|
if (self->priv->show_other != setting)
|
||||||
{
|
{
|
||||||
@ -1137,22 +1137,22 @@ gtk_open_with_widget_set_show_other (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "show-other");
|
g_object_notify (G_OBJECT (self), "show-other");
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean gtk_open_with_widget_get_show_other (GtkOpenWithWidget *self)
|
gboolean gtk_app_chooser_widget_get_show_other (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_WIDGET (self), FALSE);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self), FALSE);
|
||||||
|
|
||||||
return self->priv->show_other;
|
return self->priv->show_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_widget_set_show_all (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_set_show_all (GtkAppChooserWidget *self,
|
||||||
gboolean setting)
|
gboolean setting)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_WIDGET (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self));
|
||||||
|
|
||||||
if (self->priv->show_all != setting)
|
if (self->priv->show_all != setting)
|
||||||
{
|
{
|
||||||
@ -1160,23 +1160,23 @@ gtk_open_with_widget_set_show_all (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "show-all");
|
g_object_notify (G_OBJECT (self), "show-all");
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_open_with_widget_get_show_all (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_get_show_all (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_WIDGET (self), FALSE);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self), FALSE);
|
||||||
|
|
||||||
return self->priv->show_all;
|
return self->priv->show_all;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_open_with_widget_set_default_text (GtkOpenWithWidget *self,
|
gtk_app_chooser_widget_set_default_text (GtkAppChooserWidget *self,
|
||||||
const gchar *text)
|
const gchar *text)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OPEN_WITH_WIDGET (self));
|
g_return_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self));
|
||||||
|
|
||||||
if (g_strcmp0 (text, self->priv->default_text) != 0)
|
if (g_strcmp0 (text, self->priv->default_text) != 0)
|
||||||
{
|
{
|
||||||
@ -1185,14 +1185,14 @@ gtk_open_with_widget_set_default_text (GtkOpenWithWidget *self,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "default-text");
|
g_object_notify (G_OBJECT (self), "default-text");
|
||||||
|
|
||||||
gtk_open_with_refresh (GTK_OPEN_WITH (self));
|
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
gtk_open_with_widget_get_default_text (GtkOpenWithWidget *self)
|
gtk_app_chooser_widget_get_default_text (GtkAppChooserWidget *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_OPEN_WITH_WIDGET (self), NULL);
|
g_return_val_if_fail (GTK_IS_APP_CHOOSER_WIDGET (self), NULL);
|
||||||
|
|
||||||
return self->priv->default_text;
|
return self->priv->default_text;
|
||||||
}
|
}
|
109
gtk/gtkappchooserwidget.h
Normal file
109
gtk/gtkappchooserwidget.h
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* gtkappchooserwidget.h: an app-chooser widget
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004 Novell, Inc.
|
||||||
|
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Dave Camp <dave@novell.com>
|
||||||
|
* Alexander Larsson <alexl@redhat.com>
|
||||||
|
* Cosimo Cecchi <ccecchi@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GTK_APP_CHOOSER_WIDGET_H__
|
||||||
|
#define __GTK_APP_CHOOSER_WIDGET_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkbox.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#define GTK_TYPE_APP_CHOOSER_WIDGET\
|
||||||
|
(gtk_app_chooser_widget_get_type ())
|
||||||
|
#define GTK_APP_CHOOSER_WIDGET(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APP_CHOOSER_WIDGET, GtkAppChooserWidget))
|
||||||
|
#define GTK_APP_CHOOSER_WIDGET_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APP_CHOOSER_WIDGET, GtkAppChooserWidgetClass))
|
||||||
|
#define GTK_IS_APP_CHOOSER_WIDGET(obj)\
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APP_CHOOSER_WIDGET))
|
||||||
|
#define GTK_IS_APP_CHOOSER_WIDGET_CLASS(klass)\
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APP_CHOOSER_WIDGET))
|
||||||
|
#define GTK_APP_CHOOSER_WIDGET_GET_CLASS(obj)\
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APP_CHOOSER_WIDGET, GtkAppChooserWidgetClass))
|
||||||
|
|
||||||
|
typedef struct _GtkAppChooserWidget GtkAppChooserWidget;
|
||||||
|
typedef struct _GtkAppChooserWidgetClass GtkAppChooserWidgetClass;
|
||||||
|
typedef struct _GtkAppChooserWidgetPrivate GtkAppChooserWidgetPrivate;
|
||||||
|
|
||||||
|
struct _GtkAppChooserWidget {
|
||||||
|
GtkBox parent;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
GtkAppChooserWidgetPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkAppChooserWidgetClass {
|
||||||
|
GtkBoxClass parent_class;
|
||||||
|
|
||||||
|
void (* application_selected) (GtkAppChooserWidget *self,
|
||||||
|
GAppInfo *app_info);
|
||||||
|
|
||||||
|
void (* application_activated) (GtkAppChooserWidget *self,
|
||||||
|
GAppInfo *app_info);
|
||||||
|
|
||||||
|
/* padding for future class expansion */
|
||||||
|
gpointer padding[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GTK_APP_CHOOSER_WIDGET_SHOW_RECOMMENDED = 1 << 0,
|
||||||
|
GTK_APP_CHOOSER_WIDGET_SHOW_FALLBACK = 1 << 1,
|
||||||
|
GTK_APP_CHOOSER_WIDGET_SHOW_OTHER = 1 << 2,
|
||||||
|
GTK_APP_CHOOSER_WIDGET_SHOW_ALL = 1 << 3,
|
||||||
|
} GtkAppChooserWidgetShowFlags;
|
||||||
|
|
||||||
|
GType gtk_app_chooser_widget_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GtkWidget * gtk_app_chooser_widget_new (const gchar *content_type);
|
||||||
|
|
||||||
|
void gtk_app_chooser_widget_set_show_default (GtkAppChooserWidget *self,
|
||||||
|
gboolean setting);
|
||||||
|
gboolean gtk_app_chooser_widget_get_show_default (GtkAppChooserWidget *self);
|
||||||
|
|
||||||
|
void gtk_app_chooser_widget_set_show_recommended (GtkAppChooserWidget *self,
|
||||||
|
gboolean setting);
|
||||||
|
gboolean gtk_app_chooser_widget_get_show_recommended (GtkAppChooserWidget *self);
|
||||||
|
|
||||||
|
void gtk_app_chooser_widget_set_show_fallback (GtkAppChooserWidget *self,
|
||||||
|
gboolean setting);
|
||||||
|
gboolean gtk_app_chooser_widget_get_show_fallback (GtkAppChooserWidget *self);
|
||||||
|
|
||||||
|
void gtk_app_chooser_widget_set_show_other (GtkAppChooserWidget *self,
|
||||||
|
gboolean setting);
|
||||||
|
gboolean gtk_app_chooser_widget_get_show_other (GtkAppChooserWidget *self);
|
||||||
|
|
||||||
|
void gtk_app_chooser_widget_set_show_all (GtkAppChooserWidget *self,
|
||||||
|
gboolean show_all);
|
||||||
|
gboolean gtk_app_chooser_widget_get_show_all (GtkAppChooserWidget *self);
|
||||||
|
|
||||||
|
void gtk_app_chooser_widget_set_default_text (GtkAppChooserWidget *self,
|
||||||
|
const gchar *text);
|
||||||
|
const gchar * gtk_app_chooser_widget_get_default_text (GtkAppChooserWidget *self);
|
||||||
|
|
||||||
|
#endif /* __GTK_APP_CHOOSER_WIDGET_H__ */
|
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* gtkopenwithdialog.h: an open-with dialog
|
|
||||||
*
|
|
||||||
* Copyright (C) 2004 Novell, Inc.
|
|
||||||
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
||||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* Authors: Dave Camp <dave@novell.com>
|
|
||||||
* Alexander Larsson <alexl@redhat.com>
|
|
||||||
* Cosimo Cecchi <ccecchi@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
|
||||||
#error "Only <gtk/gtk.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_DIALOG_H__
|
|
||||||
#define __GTK_OPEN_WITH_DIALOG_H__
|
|
||||||
|
|
||||||
#include <gtk/gtkdialog.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
|
|
||||||
#define GTK_TYPE_OPEN_WITH_DIALOG\
|
|
||||||
(gtk_open_with_dialog_get_type ())
|
|
||||||
#define GTK_OPEN_WITH_DIALOG(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_OPEN_WITH_DIALOG, GtkOpenWithDialog))
|
|
||||||
#define GTK_OPEN_WITH_DIALOG_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_OPEN_WITH_DIALOG, GtkOpenWithDialogClass))
|
|
||||||
#define GTK_IS_OPEN_WITH_DIALOG(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_OPEN_WITH_DIALOG))
|
|
||||||
#define GTK_IS_OPEN_WITH_DIALOG_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OPEN_WITH_DIALOG))
|
|
||||||
#define GTK_OPEN_WITH_DIALOG_GET_CLASS(obj)\
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_OPEN_WITH_DIALOG, GtkOpenWithDialogClass))
|
|
||||||
|
|
||||||
typedef struct _GtkOpenWithDialog GtkOpenWithDialog;
|
|
||||||
typedef struct _GtkOpenWithDialogClass GtkOpenWithDialogClass;
|
|
||||||
typedef struct _GtkOpenWithDialogPrivate GtkOpenWithDialogPrivate;
|
|
||||||
|
|
||||||
struct _GtkOpenWithDialog {
|
|
||||||
GtkDialog parent;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
GtkOpenWithDialogPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkOpenWithDialogClass {
|
|
||||||
GtkDialogClass parent_class;
|
|
||||||
|
|
||||||
/* padding for future class expansion */
|
|
||||||
gpointer padding[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gtk_open_with_dialog_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
GtkWidget * gtk_open_with_dialog_new (GtkWindow *parent,
|
|
||||||
GtkDialogFlags flags,
|
|
||||||
GFile *file);
|
|
||||||
GtkWidget * gtk_open_with_dialog_new_for_content_type (GtkWindow *parent,
|
|
||||||
GtkDialogFlags flags,
|
|
||||||
const gchar *content_type);
|
|
||||||
|
|
||||||
GtkWidget * gtk_open_with_dialog_get_widget (GtkOpenWithDialog *self);
|
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_DIALOG_H__ */
|
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* gtkopenwithonline.h: an extension point for online integration
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
||||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_ONLINE_H__
|
|
||||||
#define __GTK_OPEN_WITH_ONLINE_H__
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include <gtk/gtkwindow.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define GTK_TYPE_OPEN_WITH_ONLINE\
|
|
||||||
(gtk_open_with_online_get_type ())
|
|
||||||
#define GTK_OPEN_WITH_ONLINE(o)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_OPEN_WITH_ONLINE, GtkOpenWithOnline))
|
|
||||||
#define GTK_IS_OPEN_WITH_ONLINE(o)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_OPEN_WITH_ONLINE))
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_GET_IFACE(obj)\
|
|
||||||
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_OPEN_WITH_ONLINE, GtkOpenWithOnlineInterface))
|
|
||||||
|
|
||||||
typedef struct _GtkOpenWithOnline GtkOpenWithOnline;
|
|
||||||
typedef struct _GtkOpenWithOnlineInterface GtkOpenWithOnlineInterface;
|
|
||||||
|
|
||||||
struct _GtkOpenWithOnlineInterface {
|
|
||||||
GTypeInterface g_iface;
|
|
||||||
|
|
||||||
/* Methods */
|
|
||||||
void (*search_for_mimetype_async) (GtkOpenWithOnline *self,
|
|
||||||
const gchar *content_type,
|
|
||||||
GtkWindow *parent,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
gboolean (*search_for_mimetype_finish) (GtkOpenWithOnline *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gtk_open_with_online_get_type (void) G_GNUC_CONST;
|
|
||||||
void gtk_open_with_online_search_for_mimetype_async (GtkOpenWithOnline *self,
|
|
||||||
const gchar *content_type,
|
|
||||||
GtkWindow *parent,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
gboolean gtk_open_with_online_search_for_mimetype_finish (GtkOpenWithOnline *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
GtkOpenWithOnline * gtk_open_with_online_get_default (void);
|
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_ONLINE_H__ */
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* gtkopenwithonlinedummy.h: an extension point for online integration
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
||||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_ONLINE_DUMMY_H__
|
|
||||||
#define __GTK_OPEN_WITH_ONLINE_DUMMY_H__
|
|
||||||
|
|
||||||
#include <gtk/gtkopenwithonline.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#define GTK_TYPE_OPEN_WITH_ONLINE_DUMMY\
|
|
||||||
(_gtk_open_with_online_dummy_get_type ())
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_DUMMY(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_OPEN_WITH_ONLINE_DUMMY, GtkOpenWithOnlineDummy))
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_DUMMY_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_OPEN_WITH_ONLINE_DUMMY, GtkOpenWithOnlineDummyClass))
|
|
||||||
#define GTK_IS_OPEN_WITH_ONLINE_DUMMY(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_OPEN_WITH_ONLINE_DUMMY))
|
|
||||||
#define GTK_IS_OPEN_WITH_ONLINE_DUMMY_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OPEN_WITH_ONLINE_DUMMY))
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_DUMMY_GET_CLASS(obj)\
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_OPEN_WITH_ONLINE_DUMMY, GtkOpenWithOnlineDummyClass))
|
|
||||||
|
|
||||||
typedef struct _GtkOpenWithOnlineDummy GtkOpenWithOnlineDummy;
|
|
||||||
typedef struct _GtkOpenWithOnlineDummyClass GtkOpenWithOnlineDummyClass;
|
|
||||||
typedef struct _GtkOpenWithOnlineDummyPrivate GtkOpenWithOnlineDummyPrivate;
|
|
||||||
|
|
||||||
struct _GtkOpenWithOnlineDummy {
|
|
||||||
GObject parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkOpenWithOnlineDummyClass {
|
|
||||||
GObjectClass parent_class;
|
|
||||||
|
|
||||||
GtkOpenWithOnlineDummy *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType _gtk_open_with_online_dummy_get_type (void);
|
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_ONLINE_DUMMY_H__ */
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* gtkopenwithonlinepk.h: an extension point for online integration
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
||||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* Authors: Cosimo Cecchi <ccecchi@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_ONLINE_PK_H__
|
|
||||||
#define __GTK_OPEN_WITH_ONLINE_PK_H__
|
|
||||||
|
|
||||||
#include <gtk/gtkopenwithonline.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#define GTK_TYPE_OPEN_WITH_ONLINE_PK\
|
|
||||||
(_gtk_open_with_online_pk_get_type ())
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_PK(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_OPEN_WITH_ONLINE_PK, GtkOpenWithOnlinePk))
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_PK_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_OPEN_WITH_ONLINE_PK, GtkOpenWithOnlinePkClass))
|
|
||||||
#define GTK_IS_OPEN_WITH_ONLINE_PK(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_OPEN_WITH_ONLINE_PK))
|
|
||||||
#define GTK_IS_OPEN_WITH_ONLINE_PK_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OPEN_WITH_ONLINE_PK))
|
|
||||||
#define GTK_OPEN_WITH_ONLINE_PK_GET_CLASS(obj)\
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_OPEN_WITH_ONLINE_PK, GtkOpenWithOnlinePkClass))
|
|
||||||
|
|
||||||
typedef struct _GtkOpenWithOnlinePk GtkOpenWithOnlinePk;
|
|
||||||
typedef struct _GtkOpenWithOnlinePkClass GtkOpenWithOnlinePkClass;
|
|
||||||
typedef struct _GtkOpenWithOnlinePkPrivate GtkOpenWithOnlinePkPrivate;
|
|
||||||
|
|
||||||
struct _GtkOpenWithOnlinePk {
|
|
||||||
GObject parent;
|
|
||||||
|
|
||||||
GtkOpenWithOnlinePkPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkOpenWithOnlinePkClass {
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType _gtk_open_with_online_pk_get_type (void);
|
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_ONLINE_PK_H__ */
|
|
@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
* gtkopenwithwidget.h: an open-with widget
|
|
||||||
*
|
|
||||||
* Copyright (C) 2004 Novell, Inc.
|
|
||||||
* Copyright (C) 2007, 2010 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
||||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* Authors: Dave Camp <dave@novell.com>
|
|
||||||
* Alexander Larsson <alexl@redhat.com>
|
|
||||||
* Cosimo Cecchi <ccecchi@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
|
||||||
#error "Only <gtk/gtk.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __GTK_OPEN_WITH_WIDGET_H__
|
|
||||||
#define __GTK_OPEN_WITH_WIDGET_H__
|
|
||||||
|
|
||||||
#include <gtk/gtkbox.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
|
|
||||||
#define GTK_TYPE_OPEN_WITH_WIDGET\
|
|
||||||
(gtk_open_with_widget_get_type ())
|
|
||||||
#define GTK_OPEN_WITH_WIDGET(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_OPEN_WITH_WIDGET, GtkOpenWithWidget))
|
|
||||||
#define GTK_OPEN_WITH_WIDGET_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_OPEN_WITH_WIDGET, GtkOpenWithWidgetClass))
|
|
||||||
#define GTK_IS_OPEN_WITH_WIDGET(obj)\
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_OPEN_WITH_WIDGET))
|
|
||||||
#define GTK_IS_OPEN_WITH_WIDGET_CLASS(klass)\
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OPEN_WITH_WIDGET))
|
|
||||||
#define GTK_OPEN_WITH_WIDGET_GET_CLASS(obj)\
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_OPEN_WITH_WIDGET, GtkOpenWithWidgetClass))
|
|
||||||
|
|
||||||
typedef struct _GtkOpenWithWidget GtkOpenWithWidget;
|
|
||||||
typedef struct _GtkOpenWithWidgetClass GtkOpenWithWidgetClass;
|
|
||||||
typedef struct _GtkOpenWithWidgetPrivate GtkOpenWithWidgetPrivate;
|
|
||||||
|
|
||||||
struct _GtkOpenWithWidget {
|
|
||||||
GtkBox parent;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
GtkOpenWithWidgetPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkOpenWithWidgetClass {
|
|
||||||
GtkBoxClass parent_class;
|
|
||||||
|
|
||||||
void (* application_selected) (GtkOpenWithWidget *self,
|
|
||||||
GAppInfo *app_info);
|
|
||||||
|
|
||||||
void (* application_activated) (GtkOpenWithWidget *self,
|
|
||||||
GAppInfo *app_info);
|
|
||||||
|
|
||||||
/* padding for future class expansion */
|
|
||||||
gpointer padding[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GTK_OPEN_WITH_WIDGET_SHOW_RECOMMENDED = 1 << 0,
|
|
||||||
GTK_OPEN_WITH_WIDGET_SHOW_FALLBACK = 1 << 1,
|
|
||||||
GTK_OPEN_WITH_WIDGET_SHOW_OTHER = 1 << 2,
|
|
||||||
GTK_OPEN_WITH_WIDGET_SHOW_ALL = 1 << 3,
|
|
||||||
} GtkOpenWithWidgetShowFlags;
|
|
||||||
|
|
||||||
GType gtk_open_with_widget_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
GtkWidget * gtk_open_with_widget_new (const gchar *content_type);
|
|
||||||
|
|
||||||
void gtk_open_with_widget_set_show_default (GtkOpenWithWidget *self,
|
|
||||||
gboolean setting);
|
|
||||||
gboolean gtk_open_with_widget_get_show_default (GtkOpenWithWidget *self);
|
|
||||||
|
|
||||||
void gtk_open_with_widget_set_show_recommended (GtkOpenWithWidget *self,
|
|
||||||
gboolean setting);
|
|
||||||
gboolean gtk_open_with_widget_get_show_recommended (GtkOpenWithWidget *self);
|
|
||||||
|
|
||||||
void gtk_open_with_widget_set_show_fallback (GtkOpenWithWidget *self,
|
|
||||||
gboolean setting);
|
|
||||||
gboolean gtk_open_with_widget_get_show_fallback (GtkOpenWithWidget *self);
|
|
||||||
|
|
||||||
void gtk_open_with_widget_set_show_other (GtkOpenWithWidget *self,
|
|
||||||
gboolean setting);
|
|
||||||
gboolean gtk_open_with_widget_get_show_other (GtkOpenWithWidget *self);
|
|
||||||
|
|
||||||
void gtk_open_with_widget_set_show_all (GtkOpenWithWidget *self,
|
|
||||||
gboolean show_all);
|
|
||||||
gboolean gtk_open_with_widget_get_show_all (GtkOpenWithWidget *self);
|
|
||||||
|
|
||||||
void gtk_open_with_widget_set_default_text (GtkOpenWithWidget *self,
|
|
||||||
const gchar *text);
|
|
||||||
const gchar * gtk_open_with_widget_get_default_text (GtkOpenWithWidget *self);
|
|
||||||
|
|
||||||
#endif /* __GTK_OPEN_WITH_WIDGET_H__ */
|
|
@ -66,7 +66,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
|
|||||||
testoffscreen \
|
testoffscreen \
|
||||||
testoffscreenwindow \
|
testoffscreenwindow \
|
||||||
testorientable \
|
testorientable \
|
||||||
testopenwith \
|
testappchooser \
|
||||||
testprint \
|
testprint \
|
||||||
testrecentchooser \
|
testrecentchooser \
|
||||||
testrecentchoosermenu \
|
testrecentchoosermenu \
|
||||||
@ -154,7 +154,7 @@ testnotebookdnd_DEPENDENCIES = $(TEST_DEPS)
|
|||||||
testnouiprint_DEPENDENCIES = $(TEST_DEPS)
|
testnouiprint_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testoffscreen_DEPENDENCIES = $(TEST_DEPS)
|
testoffscreen_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testoffscreenwindow_DEPENDENCIES = $(TEST_DEPS)
|
testoffscreenwindow_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testopenwith_DEPENDENCIES = $(TEST_DEPS)
|
testappchooser_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testorientable_DEPENDENCIES = $(TEST_DEPS)
|
testorientable_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testprint_DEPENDENCIES = $(TEST_DEPS)
|
testprint_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testrecentchooser_DEPENDENCIES = $(TEST_DEPS)
|
testrecentchooser_DEPENDENCIES = $(TEST_DEPS)
|
||||||
@ -227,7 +227,7 @@ testnotebookdnd_LDADD = $(LDADDS)
|
|||||||
testnouiprint_LDADD = $(LDADDS)
|
testnouiprint_LDADD = $(LDADDS)
|
||||||
testoffscreen_LDADD = $(LDADDS)
|
testoffscreen_LDADD = $(LDADDS)
|
||||||
testoffscreenwindow_LDADD = $(LDADDS)
|
testoffscreenwindow_LDADD = $(LDADDS)
|
||||||
testopenwith_LDADD = $(LDADDS)
|
testappchooser_LDADD = $(LDADDS)
|
||||||
testorientable_LDADD = $(LDADDS)
|
testorientable_LDADD = $(LDADDS)
|
||||||
testprint_LDADD = $(LDADDS)
|
testprint_LDADD = $(LDADDS)
|
||||||
testrecentchooser_LDADD = $(LDADDS)
|
testrecentchooser_LDADD = $(LDADDS)
|
||||||
@ -378,8 +378,8 @@ testoffscreen_SOURCES = \
|
|||||||
testoffscreenwindow_SOURCES = \
|
testoffscreenwindow_SOURCES = \
|
||||||
testoffscreenwindow.c
|
testoffscreenwindow.c
|
||||||
|
|
||||||
testopenwith_SOURCES = \
|
testappchooser_SOURCES = \
|
||||||
testopenwith.c
|
testappchooser.c
|
||||||
|
|
||||||
testwindows_SOURCES = \
|
testwindows_SOURCES = \
|
||||||
testwindows.c
|
testwindows.c
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* testopenwith.c
|
/* testappchooser.c
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010 Red Hat, Inc.
|
||||||
* Authors: Cosimo Cecchi
|
* Authors: Cosimo Cecchi
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ static GtkWidget *toplevel;
|
|||||||
static GFile *file;
|
static GFile *file;
|
||||||
static GtkWidget *grid, *file_l, *open;
|
static GtkWidget *grid, *file_l, *open;
|
||||||
static GtkWidget *radio_file, *radio_content, *dialog;
|
static GtkWidget *radio_file, *radio_content, *dialog;
|
||||||
static GtkWidget *open_with_widget;
|
static GtkWidget *app_chooser_widget;
|
||||||
static GtkWidget *recommended, *fallback, *other, *all, *radio;
|
static GtkWidget *recommended, *fallback, *other, *all, *radio;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -42,7 +42,7 @@ dialog_response (GtkDialog *d,
|
|||||||
|
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
if (response_id == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
app_info = gtk_open_with_get_app_info (GTK_OPEN_WITH (d));
|
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (d));
|
||||||
name = g_app_info_get_name (app_info);
|
name = g_app_info_get_name (app_info);
|
||||||
g_print ("Application selected: %s\n", name);
|
g_print ("Application selected: %s\n", name);
|
||||||
|
|
||||||
@ -57,19 +57,19 @@ static void
|
|||||||
bind_props (void)
|
bind_props (void)
|
||||||
{
|
{
|
||||||
g_object_bind_property (recommended, "active",
|
g_object_bind_property (recommended, "active",
|
||||||
open_with_widget, "show-recommended",
|
app_chooser_widget, "show-recommended",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
g_object_bind_property (fallback, "active",
|
g_object_bind_property (fallback, "active",
|
||||||
open_with_widget, "show-fallback",
|
app_chooser_widget, "show-fallback",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
g_object_bind_property (other, "active",
|
g_object_bind_property (other, "active",
|
||||||
open_with_widget, "show-other",
|
app_chooser_widget, "show-other",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
g_object_bind_property (all, "active",
|
g_object_bind_property (all, "active",
|
||||||
open_with_widget, "show-all",
|
app_chooser_widget, "show-all",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
g_object_bind_property (radio, "active",
|
g_object_bind_property (radio, "active",
|
||||||
open_with_widget, "radio-mode",
|
app_chooser_widget, "radio-mode",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ prepare_dialog (void)
|
|||||||
|
|
||||||
if (use_file)
|
if (use_file)
|
||||||
{
|
{
|
||||||
dialog = gtk_open_with_dialog_new (GTK_WINDOW (toplevel),
|
dialog = gtk_app_chooser_dialog_new (GTK_WINDOW (toplevel),
|
||||||
0, file);
|
0, file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -100,7 +100,7 @@ prepare_dialog (void)
|
|||||||
|
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
|
|
||||||
dialog = gtk_open_with_dialog_new_for_content_type (GTK_WINDOW (toplevel),
|
dialog = gtk_app_chooser_dialog_new_for_content_type (GTK_WINDOW (toplevel),
|
||||||
0, content_type);
|
0, content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ prepare_dialog (void)
|
|||||||
|
|
||||||
g_free (content_type);
|
g_free (content_type);
|
||||||
|
|
||||||
open_with_widget = gtk_open_with_dialog_get_widget (GTK_OPEN_WITH_DIALOG (dialog));
|
app_chooser_widget = gtk_app_chooser_dialog_get_widget (GTK_APP_CHOOSER_DIALOG (dialog));
|
||||||
bind_props ();
|
bind_props ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ main (int argc,
|
|||||||
gtk_grid_attach_next_to (GTK_GRID (grid), radio_content,
|
gtk_grid_attach_next_to (GTK_GRID (grid), radio_content,
|
||||||
radio_file, GTK_POS_BOTTOM, 1, 1);
|
radio_file, GTK_POS_BOTTOM, 1, 1);
|
||||||
|
|
||||||
open = gtk_button_new_with_label ("Trigger Open With dialog");
|
open = gtk_button_new_with_label ("Trigger App Chooser dialog");
|
||||||
gtk_grid_attach_next_to (GTK_GRID (grid), open,
|
gtk_grid_attach_next_to (GTK_GRID (grid), open,
|
||||||
radio_content, GTK_POS_BOTTOM, 1, 1);
|
radio_content, GTK_POS_BOTTOM, 1, 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user