|
|
25dd04 |
From c815f8ce277750699eeadd33f6ee0733589db3ce Mon Sep 17 00:00:00 2001
|
|
|
25dd04 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
25dd04 |
Date: Wed, 23 Sep 2015 09:29:11 -0400
|
|
|
25dd04 |
Subject: [PATCH 1/3] GtkAppChooserButton: Hide compat desktop entries
|
|
|
25dd04 |
|
|
|
25dd04 |
RHEL maintains some NoDisplay compat desktop entries to keep old user
|
|
|
25dd04 |
mime associations working in the 7.1 to 7.2 rebase.
|
|
|
25dd04 |
|
|
|
25dd04 |
These NoDisplay desktop files aren't meant to show up in the UI but do
|
|
|
25dd04 |
in the details panel of control-center (since GtkAppChooserButton
|
|
|
25dd04 |
specifically wants to show NoDisplay desktop files, see bug 702681)
|
|
|
25dd04 |
|
|
|
25dd04 |
This commit checks a downstream specific key, X-RHEL-AliasOf, that is
|
|
|
25dd04 |
used to mark desktop files that are compat entries. An example of the
|
|
|
25dd04 |
use would be in totem.desktop:
|
|
|
25dd04 |
|
|
|
25dd04 |
X-RHEL-AliasOf=org.gnome.Totem
|
|
|
25dd04 |
|
|
|
25dd04 |
https://bugzilla.redhat.com/show_bug.cgi?id=1259292
|
|
|
25dd04 |
---
|
|
|
25dd04 |
gtk/gtkappchooserbutton.c | 6 +++++-
|
|
|
25dd04 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
25dd04 |
|
|
|
25dd04 |
diff --git a/gtk/gtkappchooserbutton.c b/gtk/gtkappchooserbutton.c
|
|
|
25dd04 |
index ea4bd90..d129786 100644
|
|
|
25dd04 |
--- a/gtk/gtkappchooserbutton.c
|
|
|
25dd04 |
+++ b/gtk/gtkappchooserbutton.c
|
|
|
25dd04 |
@@ -34,60 +34,61 @@
|
|
|
25dd04 |
*
|
|
|
25dd04 |
* The list of applications shown in a #GtkAppChooserButton includes
|
|
|
25dd04 |
* the recommended applications for the given content type. When
|
|
|
25dd04 |
* #GtkAppChooserButton:show-default-item is set, the default application
|
|
|
25dd04 |
* is also included. To let the user chooser other applications,
|
|
|
25dd04 |
* you can set the #GtkAppChooserButton:show-dialog-item property,
|
|
|
25dd04 |
* which allows to open a full #GtkAppChooserDialog.
|
|
|
25dd04 |
*
|
|
|
25dd04 |
* It is possible to add custom items to the list, using
|
|
|
25dd04 |
* gtk_app_chooser_button_append_custom_item(). These items cause
|
|
|
25dd04 |
* the #GtkAppChooserButton::custom-item-activated signal to be
|
|
|
25dd04 |
* emitted when they are selected.
|
|
|
25dd04 |
*
|
|
|
25dd04 |
* To track changes in the selected application, use the
|
|
|
25dd04 |
* #GtkComboBox::changed signal.
|
|
|
25dd04 |
*/
|
|
|
25dd04 |
#include "config.h"
|
|
|
25dd04 |
|
|
|
25dd04 |
#include "gtkappchooserbutton.h"
|
|
|
25dd04 |
|
|
|
25dd04 |
#include "gtkappchooser.h"
|
|
|
25dd04 |
#include "gtkappchooserdialog.h"
|
|
|
25dd04 |
#include "gtkappchooserprivate.h"
|
|
|
25dd04 |
#include "gtkcelllayout.h"
|
|
|
25dd04 |
#include "gtkcellrendererpixbuf.h"
|
|
|
25dd04 |
#include "gtkcellrenderertext.h"
|
|
|
25dd04 |
#include "gtkcombobox.h"
|
|
|
25dd04 |
#include "gtkdialog.h"
|
|
|
25dd04 |
#include "gtkintl.h"
|
|
|
25dd04 |
#include "gtkmarshalers.h"
|
|
|
25dd04 |
+#include "gio/gdesktopappinfo.h"
|
|
|
25dd04 |
|
|
|
25dd04 |
enum {
|
|
|
25dd04 |
PROP_CONTENT_TYPE = 1,
|
|
|
25dd04 |
PROP_SHOW_DIALOG_ITEM,
|
|
|
25dd04 |
PROP_SHOW_DEFAULT_ITEM,
|
|
|
25dd04 |
PROP_HEADING
|
|
|
25dd04 |
};
|
|
|
25dd04 |
|
|
|
25dd04 |
enum {
|
|
|
25dd04 |
SIGNAL_CUSTOM_ITEM_ACTIVATED,
|
|
|
25dd04 |
NUM_SIGNALS
|
|
|
25dd04 |
};
|
|
|
25dd04 |
|
|
|
25dd04 |
enum {
|
|
|
25dd04 |
COLUMN_APP_INFO,
|
|
|
25dd04 |
COLUMN_NAME,
|
|
|
25dd04 |
COLUMN_LABEL,
|
|
|
25dd04 |
COLUMN_ICON,
|
|
|
25dd04 |
COLUMN_CUSTOM,
|
|
|
25dd04 |
COLUMN_SEPARATOR,
|
|
|
25dd04 |
NUM_COLUMNS,
|
|
|
25dd04 |
};
|
|
|
25dd04 |
|
|
|
25dd04 |
#define CUSTOM_ITEM_OTHER_APP "gtk-internal-item-other-app"
|
|
|
25dd04 |
|
|
|
25dd04 |
static void app_chooser_iface_init (GtkAppChooserIface *iface);
|
|
|
25dd04 |
|
|
|
25dd04 |
static void real_insert_custom_item (GtkAppChooserButton *self,
|
|
|
25dd04 |
const gchar *name,
|
|
|
25dd04 |
const gchar *label,
|
|
|
25dd04 |
@@ -308,78 +309,81 @@ insert_one_application (GtkAppChooserButton *self,
|
|
|
25dd04 |
|
|
|
25dd04 |
gtk_list_store_set (self->priv->store, iter,
|
|
|
25dd04 |
COLUMN_APP_INFO, app,
|
|
|
25dd04 |
COLUMN_LABEL, g_app_info_get_name (app),
|
|
|
25dd04 |
COLUMN_ICON, icon,
|
|
|
25dd04 |
COLUMN_CUSTOM, FALSE,
|
|
|
25dd04 |
-1);
|
|
|
25dd04 |
|
|
|
25dd04 |
g_object_unref (icon);
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
static void
|
|
|
25dd04 |
gtk_app_chooser_button_populate (GtkAppChooserButton *self)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
GList *recommended_apps = NULL, *l;
|
|
|
25dd04 |
GAppInfo *app, *default_app = NULL;
|
|
|
25dd04 |
GtkTreeIter iter, iter2;
|
|
|
25dd04 |
gboolean cycled_recommended;
|
|
|
25dd04 |
|
|
|
25dd04 |
#ifndef G_OS_WIN32
|
|
|
25dd04 |
if (self->priv->content_type)
|
|
|
25dd04 |
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
|
|
|
25dd04 |
#endif
|
|
|
25dd04 |
cycled_recommended = FALSE;
|
|
|
25dd04 |
|
|
|
25dd04 |
if (self->priv->show_default_item)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
if (self->priv->content_type)
|
|
|
25dd04 |
default_app = g_app_info_get_default_for_type (self->priv->content_type, FALSE);
|
|
|
25dd04 |
|
|
|
25dd04 |
- if (default_app != NULL)
|
|
|
25dd04 |
+ if (default_app != NULL && (!G_IS_DESKTOP_APP_INFO (default_app) || !g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (default_app), "X-RHEL-AliasOf")))
|
|
|
25dd04 |
{
|
|
|
25dd04 |
get_first_iter (self->priv->store, &iter);
|
|
|
25dd04 |
cycled_recommended = TRUE;
|
|
|
25dd04 |
|
|
|
25dd04 |
insert_one_application (self, default_app, &iter);
|
|
|
25dd04 |
|
|
|
25dd04 |
g_object_unref (default_app);
|
|
|
25dd04 |
}
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
for (l = recommended_apps; l != NULL; l = l->next)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
app = l->data;
|
|
|
25dd04 |
|
|
|
25dd04 |
if (default_app != NULL && g_app_info_equal (app, default_app))
|
|
|
25dd04 |
continue;
|
|
|
25dd04 |
|
|
|
25dd04 |
+ if (G_IS_DESKTOP_APP_INFO (app) && g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app), "X-RHEL-AliasOf"))
|
|
|
25dd04 |
+ continue;
|
|
|
25dd04 |
+
|
|
|
25dd04 |
if (cycled_recommended)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
gtk_list_store_insert_after (self->priv->store, &iter2, &iter);
|
|
|
25dd04 |
iter = iter2;
|
|
|
25dd04 |
}
|
|
|
25dd04 |
else
|
|
|
25dd04 |
{
|
|
|
25dd04 |
get_first_iter (self->priv->store, &iter);
|
|
|
25dd04 |
cycled_recommended = TRUE;
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
insert_one_application (self, app, &iter);
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
if (recommended_apps != NULL)
|
|
|
25dd04 |
g_list_free_full (recommended_apps, g_object_unref);
|
|
|
25dd04 |
|
|
|
25dd04 |
if (!cycled_recommended)
|
|
|
25dd04 |
gtk_app_chooser_button_ensure_dialog_item (self, NULL);
|
|
|
25dd04 |
else
|
|
|
25dd04 |
gtk_app_chooser_button_ensure_dialog_item (self, &iter);
|
|
|
25dd04 |
|
|
|
25dd04 |
gtk_combo_box_set_active (GTK_COMBO_BOX (self), 0);
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
static void
|
|
|
25dd04 |
gtk_app_chooser_button_build_ui (GtkAppChooserButton *self)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
GtkCellRenderer *cell;
|
|
|
25dd04 |
GtkCellArea *area;
|
|
|
25dd04 |
--
|
|
|
25dd04 |
2.5.0
|
|
|
25dd04 |
|
|
|
25dd04 |
|
|
|
25dd04 |
From 6fc9af4caea6e4dd86b2808b2fd01b8d7b624100 Mon Sep 17 00:00:00 2001
|
|
|
25dd04 |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
25dd04 |
Date: Tue, 22 Sep 2015 16:07:13 -0400
|
|
|
25dd04 |
Subject: [PATCH 2/3] app chooser widget: protect against show_all
|
|
|
25dd04 |
|
|
|
25dd04 |
The visibility of the 'no apps' placeholder is managed by
|
|
|
25dd04 |
the dialog, it should not be affected by gtk_widget_show_all.
|
|
|
25dd04 |
|
|
|
25dd04 |
https://bugzilla.gnome.org/show_bug.cgi?id=748080
|
|
|
25dd04 |
---
|
|
|
25dd04 |
gtk/resources/ui/gtkappchooserwidget.ui | 1 +
|
|
|
25dd04 |
1 file changed, 1 insertion(+)
|
|
|
25dd04 |
|
|
|
25dd04 |
diff --git a/gtk/resources/ui/gtkappchooserwidget.ui b/gtk/resources/ui/gtkappchooserwidget.ui
|
|
|
25dd04 |
index 4b23628..3cc65f7 100644
|
|
|
25dd04 |
--- a/gtk/resources/ui/gtkappchooserwidget.ui
|
|
|
25dd04 |
+++ b/gtk/resources/ui/gtkappchooserwidget.ui
|
|
|
25dd04 |
@@ -71,60 +71,61 @@
|
|
|
25dd04 |
<attribute name="visible">6</attribute>
|
|
|
25dd04 |
<attribute name="markup">7</attribute>
|
|
|
25dd04 |
</attributes>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
<child>
|
|
|
25dd04 |
<object class="GtkCellRendererText" id="secondary_padding"/>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
<child>
|
|
|
25dd04 |
<object class="GtkCellRendererPixbuf" id="app_icon"/>
|
|
|
25dd04 |
<attributes>
|
|
|
25dd04 |
<attribute name="gicon">1</attribute>
|
|
|
25dd04 |
</attributes>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
<child>
|
|
|
25dd04 |
<object class="GtkCellRendererText" id="app_name">
|
|
|
25dd04 |
<property name="ellipsize">end</property>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
<attributes>
|
|
|
25dd04 |
<attribute name="markup">3</attribute>
|
|
|
25dd04 |
</attributes>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
<child type="overlay">
|
|
|
25dd04 |
<object class="GtkBox" id="no_apps">
|
|
|
25dd04 |
<property name="orientation">vertical</property>
|
|
|
25dd04 |
+ <property name="no-show-all">True</property>
|
|
|
25dd04 |
<property name="halign">center</property>
|
|
|
25dd04 |
<property name="valign">center</property>
|
|
|
25dd04 |
<child>
|
|
|
25dd04 |
<object class="GtkImage">
|
|
|
25dd04 |
<property name="visible">True</property>
|
|
|
25dd04 |
<property name="icon-name">gnome-software-symbolic</property>
|
|
|
25dd04 |
<property name="pixel-size">48</property>
|
|
|
25dd04 |
<property name="margin">12</property>
|
|
|
25dd04 |
<style>
|
|
|
25dd04 |
<class name="dim-label"/>
|
|
|
25dd04 |
</style>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
<child>
|
|
|
25dd04 |
<object class="GtkLabel" id="no_apps_label">
|
|
|
25dd04 |
<property name="visible">True</property>
|
|
|
25dd04 |
<property name="label" translatable="yes">No applications found.</property>
|
|
|
25dd04 |
<property name="halign">center</property>
|
|
|
25dd04 |
<property name="valign">center</property>
|
|
|
25dd04 |
<attributes>
|
|
|
25dd04 |
<attribute name="scale" value="1.2"/>
|
|
|
25dd04 |
</attributes>
|
|
|
25dd04 |
<style>
|
|
|
25dd04 |
<class name="dim-label"/>
|
|
|
25dd04 |
</style>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
</child>
|
|
|
25dd04 |
</object>
|
|
|
25dd04 |
--
|
|
|
25dd04 |
2.5.0
|
|
|
25dd04 |
|
|
|
25dd04 |
|
|
|
25dd04 |
From 0bd4176f0cd7e5febd6434e94a822dc9626f6d88 Mon Sep 17 00:00:00 2001
|
|
|
25dd04 |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
25dd04 |
Date: Tue, 22 Sep 2015 15:14:00 -0400
|
|
|
25dd04 |
Subject: [PATCH 3/3] app chooser: Avoid duplicates
|
|
|
25dd04 |
|
|
|
25dd04 |
At the time we populate the model "initially" in constructed(),
|
|
|
25dd04 |
it has already been filled and cleared a couple of times (we do
|
|
|
25dd04 |
that every time one of the construct properties gets set). So
|
|
|
25dd04 |
we can't assume that the model is empty, and have to clear it
|
|
|
25dd04 |
first. Otherwise, we add duplicates to the list.
|
|
|
25dd04 |
|
|
|
25dd04 |
https://bugzilla.gnome.org/show_bug.cgi?id=748080
|
|
|
25dd04 |
---
|
|
|
25dd04 |
gtk/gtkappchooserwidget.c | 2 +-
|
|
|
25dd04 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
25dd04 |
|
|
|
25dd04 |
diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c
|
|
|
25dd04 |
index 01f9a4b..5c90460 100644
|
|
|
25dd04 |
--- a/gtk/gtkappchooserwidget.c
|
|
|
25dd04 |
+++ b/gtk/gtkappchooserwidget.c
|
|
|
25dd04 |
@@ -786,61 +786,61 @@ gtk_app_chooser_widget_real_add_items (GtkAppChooserWidget *self)
|
|
|
25dd04 |
FALSE,
|
|
|
25dd04 |
FALSE,
|
|
|
25dd04 |
all_applications, exclude_apps);
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
if (!apps_added)
|
|
|
25dd04 |
update_no_applications_label (self);
|
|
|
25dd04 |
|
|
|
25dd04 |
gtk_widget_set_visible (self->priv->no_apps, !apps_added);
|
|
|
25dd04 |
|
|
|
25dd04 |
gtk_app_chooser_widget_select_first (self);
|
|
|
25dd04 |
|
|
|
25dd04 |
if (default_app != NULL)
|
|
|
25dd04 |
g_object_unref (default_app);
|
|
|
25dd04 |
|
|
|
25dd04 |
g_list_free_full (all_applications, g_object_unref);
|
|
|
25dd04 |
g_list_free_full (recommended_apps, g_object_unref);
|
|
|
25dd04 |
g_list_free_full (fallback_apps, g_object_unref);
|
|
|
25dd04 |
g_list_free (exclude_apps);
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
static void
|
|
|
25dd04 |
gtk_app_chooser_widget_initialize_items (GtkAppChooserWidget *self)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
/* initial padding */
|
|
|
25dd04 |
g_object_set (self->priv->padding_renderer,
|
|
|
25dd04 |
"xpad", self->priv->show_all ? 0 : 6,
|
|
|
25dd04 |
NULL);
|
|
|
25dd04 |
|
|
|
25dd04 |
/* populate the widget */
|
|
|
25dd04 |
- gtk_app_chooser_widget_real_add_items (self);
|
|
|
25dd04 |
+ gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
static void
|
|
|
25dd04 |
app_info_changed (GAppInfoMonitor *monitor,
|
|
|
25dd04 |
GtkAppChooserWidget *self)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
static void
|
|
|
25dd04 |
gtk_app_chooser_widget_set_property (GObject *object,
|
|
|
25dd04 |
guint property_id,
|
|
|
25dd04 |
const GValue *value,
|
|
|
25dd04 |
GParamSpec *pspec)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
|
|
|
25dd04 |
|
|
|
25dd04 |
switch (property_id)
|
|
|
25dd04 |
{
|
|
|
25dd04 |
case PROP_CONTENT_TYPE:
|
|
|
25dd04 |
self->priv->content_type = g_value_dup_string (value);
|
|
|
25dd04 |
break;
|
|
|
25dd04 |
case PROP_SHOW_DEFAULT:
|
|
|
25dd04 |
gtk_app_chooser_widget_set_show_default (self, g_value_get_boolean (value));
|
|
|
25dd04 |
break;
|
|
|
25dd04 |
case PROP_SHOW_RECOMMENDED:
|
|
|
25dd04 |
gtk_app_chooser_widget_set_show_recommended (self, g_value_get_boolean (value));
|
|
|
25dd04 |
break;
|
|
|
25dd04 |
case PROP_SHOW_FALLBACK:
|
|
|
25dd04 |
gtk_app_chooser_widget_set_show_fallback (self, g_value_get_boolean (value));
|
|
|
25dd04 |
--
|
|
|
25dd04 |
2.5.0
|
|
|
25dd04 |
|