[gnome-panel/wip/muktupavels/launcher: 9/9] panel: do not load launcher objects
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/muktupavels/launcher: 9/9] panel: do not load launcher objects
- Date: Sun, 12 Apr 2020 23:36:33 +0000 (UTC)
commit 03d5da565c131ba639f2f06cec7ce1a3a3987c1b
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Apr 12 17:37:13 2020 +0300
panel: do not load launcher objects
Existing launcher objects will be turned into applets. We can not
remove PANEL_OBJECT_LAUNCHER yet as we still need it for some drag
& drop functionality.
gnome-panel/applet.c | 7 -
gnome-panel/button-widget.c | 34 --
gnome-panel/button-widget.h | 4 -
gnome-panel/launcher.c | 890 -------------------------------
gnome-panel/launcher.h | 18 -
gnome-panel/libpanel-util/panel-launch.c | 30 +-
gnome-panel/libpanel-util/panel-launch.h | 11 -
gnome-panel/panel-addto-dialog.c | 407 +-------------
gnome-panel/panel-addto-dialog.ui | 23 +-
gnome-panel/panel-ditem-editor.c | 8 -
gnome-panel/panel-ditem-editor.h | 1 -
gnome-panel/panel-object-loader.c | 11 +-
gnome-panel/panel-util.c | 25 -
gnome-panel/panel-util.h | 1 -
gnome-panel/panel.c | 7 -
15 files changed, 15 insertions(+), 1462 deletions(-)
---
diff --git a/gnome-panel/applet.c b/gnome-panel/applet.c
index ece1599e9..fa798e5e6 100644
--- a/gnome-panel/applet.c
+++ b/gnome-panel/applet.c
@@ -72,9 +72,6 @@ panel_applet_clean (AppletInfo *info)
{
g_return_if_fail (info != NULL);
- if (info->type == PANEL_OBJECT_LAUNCHER)
- panel_launcher_delete (info->data);
-
if (info->widget) {
GtkWidget *widget = info->widget;
@@ -137,10 +134,6 @@ applet_callback_callback (GtkWidget *widget,
switch (menu->info->type) {
case PANEL_OBJECT_LAUNCHER:
- if (!strcmp (menu->name, "launch"))
- launcher_launch (menu->info->data, widget);
- else if (!strcmp (menu->name, "properties"))
- launcher_properties (menu->info->data);
break;
case PANEL_OBJECT_ACTION:
panel_action_button_invoke_menu (
diff --git a/gnome-panel/button-widget.c b/gnome-panel/button-widget.c
index e223805ab..c5904565a 100644
--- a/gnome-panel/button-widget.c
+++ b/gnome-panel/button-widget.c
@@ -605,21 +605,6 @@ button_widget_class_init (ButtonWidgetClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
-GtkWidget *
-button_widget_new (const char *filename,
- PanelOrientation orientation)
-{
- GtkWidget *retval;
-
- retval = g_object_new (
- BUTTON_TYPE_WIDGET,
- "orientation", orientation,
- "icon-name", filename,
- NULL);
-
- return retval;
-}
-
void
button_widget_set_activatable (ButtonWidget *button,
gboolean activatable)
@@ -688,14 +673,6 @@ button_widget_set_orientation (ButtonWidget *button,
g_object_notify (G_OBJECT (button), "orientation");
}
-PanelOrientation
-button_widget_get_orientation (ButtonWidget *button)
-{
- g_return_val_if_fail (BUTTON_IS_WIDGET (button), 0);
-
- return button->priv->orientation;
-}
-
void
button_widget_set_dnd_highlight (ButtonWidget *button,
gboolean dnd_highlight)
@@ -721,14 +698,3 @@ button_widget_get_icon_theme (ButtonWidget *button)
return button->priv->icon_theme;
}
-
-GdkPixbuf *
-button_widget_get_pixbuf (ButtonWidget *button)
-{
- g_return_val_if_fail (BUTTON_IS_WIDGET (button), NULL);
-
- if (!button->priv->pixbuf)
- return NULL;
-
- return g_object_ref (button->priv->pixbuf);
-}
diff --git a/gnome-panel/button-widget.h b/gnome-panel/button-widget.h
index dc87fd3d1..91fcb2a65 100644
--- a/gnome-panel/button-widget.h
+++ b/gnome-panel/button-widget.h
@@ -27,19 +27,15 @@ struct _ButtonWidgetClass {
};
GType button_widget_get_type (void) G_GNUC_CONST;
-GtkWidget * button_widget_new (const char *pixmap,
- PanelOrientation orientation);
void button_widget_set_activatable (ButtonWidget *button,
gboolean activatable);
void button_widget_set_icon_name (ButtonWidget *button,
const char *icon_name);
void button_widget_set_orientation (ButtonWidget *button,
PanelOrientation orientation);
-PanelOrientation button_widget_get_orientation (ButtonWidget *button);
void button_widget_set_dnd_highlight (ButtonWidget *button,
gboolean dnd_highlight);
GtkIconTheme *button_widget_get_icon_theme (ButtonWidget *button);
-GdkPixbuf *button_widget_get_pixbuf (ButtonWidget *button);
G_END_DECLS
diff --git a/gnome-panel/launcher.c b/gnome-panel/launcher.c
index b1cd9f0f5..f2c27cfbc 100644
--- a/gnome-panel/launcher.c
+++ b/gnome-panel/launcher.c
@@ -43,700 +43,6 @@
#include "panel-icon-names.h"
#include "panel-schemas.h"
-/* zoom factor, steps and delay if composited (factor must be odd) */
-#define ZOOM_FACTOR 5
-#define ZOOM_STEPS 14
-#define ZOOM_DELAY 10
-
-typedef struct {
- int size;
- int size_start;
- int size_end;
- PanelOrientation orientation;
- double opacity;
- GdkPixbuf *pixbuf;
- guint timeout_id;
-} CompositedZoomData;
-
-static gboolean
-zoom_timeout (GtkWidget *window)
-{
- gtk_widget_queue_draw (window);
- return TRUE;
-}
-
-static gboolean
-idle_destroy (gpointer data)
-{
- gtk_widget_destroy (GTK_WIDGET (data));
-
- return FALSE;
-}
-
-static gboolean
-zoom_draw (GtkWidget *widget,
- cairo_t *cr,
- gpointer user_data)
-{
- CompositedZoomData *zoom;
-
- zoom = user_data;
-
- if (zoom->size >= zoom->size_end) {
- if (zoom->timeout_id)
- g_source_remove (zoom->timeout_id);
- zoom->timeout_id = 0;
-
- gtk_widget_hide (widget);
- g_idle_add (idle_destroy, widget);
-
- g_object_unref (zoom->pixbuf);
- zoom->pixbuf = NULL;
-
- g_slice_free (CompositedZoomData, zoom);
- } else {
- GdkPixbuf *scaled;
- int width, height;
- int x = 0, y = 0;
-
- gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
-
- zoom->size += MAX ((zoom->size_end - zoom->size_start) / ZOOM_STEPS, 1);
- zoom->opacity -= 1.0 / ((double) ZOOM_STEPS + 1);
-
- scaled = gdk_pixbuf_scale_simple (zoom->pixbuf,
- zoom->size, zoom->size,
- GDK_INTERP_BILINEAR);
-
- switch (zoom->orientation) {
- case PANEL_ORIENTATION_TOP:
- x = (width - gdk_pixbuf_get_width (scaled)) / 2;
- y = 0;
- break;
-
- case PANEL_ORIENTATION_RIGHT:
- x = width - gdk_pixbuf_get_width (scaled);
- y = (height - gdk_pixbuf_get_height (scaled)) / 2;
- break;
-
- case PANEL_ORIENTATION_BOTTOM:
- x = (width - gdk_pixbuf_get_width (scaled)) / 2;
- y = height - gdk_pixbuf_get_height (scaled);
- break;
-
- case PANEL_ORIENTATION_LEFT:
- x = 0;
- y = (height - gdk_pixbuf_get_height (scaled)) / 2;
- break;
-
- default:
- break;
- }
-
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_rgba (cr, 0, 0, 0, 0.0);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
-
- gdk_cairo_set_source_pixbuf (cr, scaled, x, y);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_paint_with_alpha (cr, MAX (zoom->opacity, 0));
-
- g_object_unref (scaled);
- }
-
- return FALSE;
-}
-
-static void
-draw_zoom_animation_composited (GdkScreen *gscreen,
- int x, int y, int w, int h,
- GdkPixbuf *pixbuf,
- PanelOrientation orientation)
-{
- GtkWidget *win;
- CompositedZoomData *zoom;
- int wx = 0, wy = 0;
-
- w += 2;
- h += 2;
-
- zoom = g_slice_new (CompositedZoomData);
- zoom->size = MIN (w,h);
- zoom->size_start = zoom->size;
- zoom->size_end = zoom->size * ZOOM_FACTOR;
- zoom->orientation = orientation;
- zoom->opacity = 1.0;
- zoom->pixbuf = g_object_ref (pixbuf);
- zoom->timeout_id = 0;
-
- win = gtk_window_new (GTK_WINDOW_POPUP);
-
- gtk_window_set_screen (GTK_WINDOW (win), gscreen);
- gtk_window_set_keep_above (GTK_WINDOW (win), TRUE);
- gtk_window_set_decorated (GTK_WINDOW (win), FALSE);
- gtk_widget_set_app_paintable(win, TRUE);
- gtk_widget_set_visual (win, gdk_screen_get_rgba_visual (gscreen));
-
- gtk_window_set_gravity (GTK_WINDOW (win), GDK_GRAVITY_STATIC);
- gtk_window_set_default_size (GTK_WINDOW (win),
- w * ZOOM_FACTOR, h * ZOOM_FACTOR);
-
- switch (zoom->orientation) {
- case PANEL_ORIENTATION_TOP:
- wx = x - w * (ZOOM_FACTOR / 2);
- wy = y;
- break;
-
- case PANEL_ORIENTATION_RIGHT:
- wx = x - w * (ZOOM_FACTOR - 1);
- wy = y - h * (ZOOM_FACTOR / 2);
- break;
-
- case PANEL_ORIENTATION_BOTTOM:
- wx = x - w * (ZOOM_FACTOR / 2);
- wy = y - h * (ZOOM_FACTOR - 1);
- break;
-
- case PANEL_ORIENTATION_LEFT:
- wx = x;
- wy = y - h * (ZOOM_FACTOR / 2);
- break;
-
- default:
- break;
- }
-
- gtk_window_move (GTK_WINDOW (win), wx, wy);
-
- g_signal_connect (G_OBJECT (win), "draw",
- G_CALLBACK (zoom_draw), zoom);
-
- /* see doc for gtk_widget_set_app_paintable() */
- gtk_widget_realize (win);
- gtk_widget_show (win);
-
- zoom->timeout_id = g_timeout_add (ZOOM_DELAY,
- (GSourceFunc) zoom_timeout,
- win);
-}
-
-static GdkScreen *
-launcher_get_screen (Launcher *launcher)
-{
- PanelWidget *panel_widget;
-
- g_return_val_if_fail (launcher != NULL, NULL);
- g_return_val_if_fail (launcher->info != NULL, NULL);
- g_return_val_if_fail (launcher->info->widget != NULL, NULL);
-
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (launcher->info->widget));
-
- return gtk_window_get_screen (GTK_WINDOW (panel_widget->toplevel));
-}
-
-static void
-launcher_widget_open_dialog_destroyed (GtkWidget *dialog,
- Launcher *launcher)
-{
- g_return_if_fail (launcher->error_dialogs != NULL);
-
- launcher->error_dialogs = g_slist_remove (launcher->error_dialogs, dialog);
-}
-
-static void
-launcher_widget_destroy_open_dialogs (Launcher *launcher)
-{
- GSList *l, *list;
-
- list = launcher->error_dialogs;
- launcher->error_dialogs = NULL;
-
- for (l = list; l; l = l->next) {
- g_signal_handlers_disconnect_by_func (G_OBJECT (l->data),
- G_CALLBACK (launcher_widget_open_dialog_destroyed),
- launcher);
- gtk_widget_destroy (l->data);
- }
- g_slist_free (list);
-}
-
-static void
-launcher_register_error_dialog (Launcher *launcher,
- GtkWidget *dialog)
-{
- launcher->error_dialogs = g_slist_append (launcher->error_dialogs,
- dialog);
- g_signal_connect (dialog, "destroy",
- G_CALLBACK (launcher_widget_open_dialog_destroyed),
- launcher);
-}
-
-static void
-launcher_do_zoom_animation (GtkWidget *widget)
-{
- GdkScreen *screen;
- GtkSettings *settings;
- gboolean enable_animations;
- ButtonWidget *button_widget;
- GdkPixbuf *pixbuf;
- PanelOrientation orientation;
- gint x, y;
- GtkAllocation allocation;
-
- screen = gtk_widget_get_screen (widget);
- settings = gtk_widget_get_settings (widget);
-
- enable_animations = TRUE;
- g_object_get (settings,
- "gtk-enable-animations", &enable_animations,
- NULL);
-
- if (!enable_animations || !gdk_screen_is_composited (screen))
- return;
-
- button_widget = BUTTON_WIDGET (widget);
- pixbuf = button_widget_get_pixbuf (button_widget);
- orientation = button_widget_get_orientation (button_widget);
-
- if (!pixbuf)
- return;
-
- gdk_window_get_origin (gtk_widget_get_window (widget), &x, &y);
- gtk_widget_get_allocation (widget, &allocation);
-
- if (!gtk_widget_get_has_window (widget)) {
- x += allocation.x;
- y += allocation.y;
- }
-
- draw_zoom_animation_composited (screen, x, y,
- allocation.width, allocation.height,
- pixbuf, orientation);
-
- g_object_unref (pixbuf);
-}
-
-static void
-launch_url (Launcher *launcher)
-{
- char *url;
- GdkScreen *screen;
-
- g_return_if_fail (launcher != NULL);
- g_return_if_fail (launcher->key_file != NULL);
-
- /* FIXME panel_ditem_launch() should be enough for this! */
- url = panel_key_file_get_string (launcher->key_file, "URL");
-
- screen = launcher_get_screen (launcher);
-
- if (!url || *url == 0) {
- GtkWidget *error_dialog;
-
- error_dialog = panel_error_dialog (NULL, screen,
- "no_url_dialog", TRUE,
- _("Could not show this URL"),
- _("No URL was specified."));
- launcher_register_error_dialog (launcher, error_dialog);
- g_free (url);
- return;
- }
-
- panel_show_uri (screen, url, gtk_get_current_event_time (), NULL);
-
- g_free (url);
-}
-
-void
-launcher_launch (Launcher *launcher,
- GtkWidget *widget)
-{
- char *type;
-
- g_return_if_fail (launcher != NULL);
- g_return_if_fail (launcher->key_file != NULL);
-
- launcher_do_zoom_animation (widget);
-
- type = panel_key_file_get_string (launcher->key_file, "Type");
- if (type && !strcmp (type, "Link"))
- launch_url (launcher);
- else {
- GError *error = NULL;
-
- panel_launch_key_file (launcher->key_file, NULL,
- launcher_get_screen (launcher), &error);
- if (error) {
- GtkWidget *error_dialog;
-
- error_dialog = panel_error_dialog (
- NULL,
- launcher_get_screen (launcher),
- "cannot_launch_application",
- TRUE,
- _("Could not launch application"),
- error->message);
- launcher_register_error_dialog (launcher, error_dialog);
- g_clear_error (&error);
- }
- }
- g_free (type);
-}
-
-static void
-drag_data_received_cb (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- Launcher *launcher)
-{
- GError *error = NULL;
- char **uris;
- int i;
- GList *file_list;
-
- launcher_do_zoom_animation (widget);
-
- file_list = NULL;
- uris = g_uri_list_extract_uris ((const char *) gtk_selection_data_get_data (selection_data));
- for (i = 0; uris[i]; i++)
- file_list = g_list_prepend (file_list, uris[i]);
- file_list = g_list_reverse (file_list);
-
- panel_launch_key_file (launcher->key_file, file_list,
- launcher_get_screen (launcher), &error);
-
- g_list_free (file_list);
- g_strfreev (uris);
-
- if (error) {
- GtkWidget *error_dialog;
- error_dialog = panel_error_dialog (NULL,
- launcher_get_screen (launcher),
- "cannot_use_dropped_item",
- TRUE,
- _("Could not use dropped item"),
- error->message);
- launcher_register_error_dialog (launcher, error_dialog);
- g_clear_error (&error);
- }
-
- gtk_drag_finish (context, TRUE, FALSE, time);
-}
-
-static void
-destroy_launcher (GtkWidget *widget,
- Launcher *launcher)
-{
- launcher_properties_destroy (launcher);
- launcher_widget_destroy_open_dialogs (launcher);
-}
-
-void
-launcher_properties_destroy (Launcher *launcher)
-{
- GtkWidget *dialog;
-
- dialog = launcher->prop_dialog;
- launcher->prop_dialog = NULL;
-
- if (dialog)
- gtk_widget_destroy (dialog);
-}
-
-static void
-free_launcher (gpointer data)
-{
- Launcher *launcher = data;
-
- if (launcher->key_file)
- g_key_file_free (launcher->key_file);
- launcher->key_file = NULL;
-
- if (launcher->location != NULL)
- g_free (launcher->location);
- launcher->location = NULL;
-
- g_free (launcher);
-}
-
-void
-panel_launcher_delete (Launcher *launcher)
-{
- if (!launcher->location)
- return;
-
- /* do not remove the file if it's not in the user's launchers path */
- if (panel_launcher_is_in_personal_path (launcher->location)) {
- GError *error;
- GFile *file;
-
- file = panel_launcher_get_gfile (launcher->location);
-
- error = NULL;
- if (!g_file_delete (file, NULL, &error)) {
- char *path;
-
- path = g_file_get_path (file);
- g_warning ("Error deleting '%s': %s\n",
- path, error->message);
- g_free (path);
- g_error_free (error);
- }
-
- g_object_unref (file);
- }
-}
-
-static gboolean
-is_this_drop_ok (GtkWidget *widget,
- GdkDragContext *context)
-{
- static GdkAtom text_uri_list = GDK_NONE;
- GList *l;
- GtkWidget *source;
-
- source = gtk_drag_get_source_widget (context);
-
- if (source == widget)
- return FALSE;
-
- if (!(gdk_drag_context_get_actions (context) & GDK_ACTION_COPY))
- return FALSE;
-
- if (!text_uri_list)
- text_uri_list = gdk_atom_intern_static_string ("text/uri-list");
-
- for (l = gdk_drag_context_list_targets (context); l; l = l->next) {
- if (GDK_POINTER_TO_ATOM (l->data) == text_uri_list)
- break;
- }
-
- return l ? TRUE : FALSE;
-}
-
-static void
-drag_leave_cb(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- Launcher *launcher)
-{
- button_widget_set_dnd_highlight(BUTTON_WIDGET(widget), FALSE);
-}
-
-
-static gboolean
-drag_motion_cb(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- Launcher *launcher)
-{
- if ( ! is_this_drop_ok (widget, context))
- return FALSE;
-
- gdk_drag_status (context, GDK_ACTION_COPY, time);
-
- button_widget_set_dnd_highlight(BUTTON_WIDGET(widget), TRUE);
-
- return TRUE;
-}
-
-static gboolean
-drag_drop_cb (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- Launcher *launcher)
-{
- static GdkAtom text_uri_list = NULL;
-
- if ( ! is_this_drop_ok (widget, context))
- return FALSE;
-
- if (text_uri_list == NULL)
- text_uri_list = gdk_atom_intern_static_string ("text/uri-list");
-
- gtk_drag_get_data (widget, context, text_uri_list, time);
-
- return TRUE;
-}
-
-static Launcher *
-create_launcher (const char *location)
-{
- GKeyFile *key_file;
- char *scheme;
- gboolean is_uri;
- gboolean loaded;
- Launcher *launcher;
- GError *error = NULL;
- char *new_location;
-
- if (!location) {
- g_printerr (_("No URI provided for panel launcher desktop file\n"));
- return NULL;
- }
-
- new_location = NULL;
- key_file = g_key_file_new ();
-
- scheme = g_uri_parse_scheme (location);
- is_uri = scheme != NULL;
- g_free (scheme);
-
- if (!is_uri && !g_path_is_absolute (location)) {
- /* try to first load a file in our config directory, and if it
- * doesn't exist there, try to find it in the xdg data dirs */
- char *path;
-
- path = panel_make_full_path (NULL, location);
-
- if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
- g_free (path);
- path = panel_g_lookup_in_applications_dirs (location);
- /* it's important to keep the full path if the desktop
- * file comes from a data dir: when the user will edit
- * it, we'll want to save it in PANEL_LAUNCHERS_PATH
- * with a random name (and not evolution.desktop, eg)
- * and having only a basename as location will make
- * this impossible */
- if (path)
- new_location = g_strdup (path);
- }
-
- if (path) {
- loaded = g_key_file_load_from_file (key_file, path,
-
G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS,
- &error);
- g_free (path);
- } else {
- loaded = FALSE;
- }
- } else
- loaded = panel_key_file_load_from_uri (key_file, location,
- G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS,
- &error);
-
- if (!loaded) {
- g_printerr (_("Unable to open desktop file %s for panel launcher%s%s\n"),
- location,
- error ? ": " : "",
- error ? error->message : "");
- if (error)
- g_error_free (error);
-
- g_key_file_free (key_file);
-
- return NULL; /*button is null*/
- }
-
- if (!new_location)
- new_location = g_strdup (location);
-
- launcher = g_new0 (Launcher, 1);
-
- launcher->info = NULL;
- launcher->button = NULL;
- launcher->location = new_location;
- launcher->key_file = key_file;
- launcher->prop_dialog = NULL;
- launcher->destroy_handler = 0;
-
- /* Icon will be setup later */
- launcher->button = button_widget_new (NULL /* icon */,
- PANEL_ORIENTATION_TOP);
-
- gtk_widget_show (launcher->button);
-
- gtk_drag_dest_set (GTK_WIDGET (launcher->button),
- 0, NULL, 0, 0);
-
- g_signal_connect (launcher->button, "drag_data_received",
- G_CALLBACK (drag_data_received_cb), launcher);
- g_signal_connect (launcher->button, "drag_motion",
- G_CALLBACK (drag_motion_cb), launcher);
- g_signal_connect (launcher->button, "drag_drop",
- G_CALLBACK (drag_drop_cb), launcher);
- g_signal_connect (launcher->button, "drag_leave",
- G_CALLBACK (drag_leave_cb), launcher);
- g_signal_connect_swapped (launcher->button, "clicked",
- G_CALLBACK (launcher_launch), launcher);
-
- launcher->destroy_handler =
- g_signal_connect (launcher->button, "destroy",
- G_CALLBACK (destroy_launcher),
- launcher);
-
- return launcher;
-}
-
-static void
-setup_button (Launcher *launcher)
-{
- char *comment;
- char *name;
- char *str;
- char *icon;
- char *unescaped_str;
-
- g_return_if_fail (launcher != NULL);
-
- name = panel_key_file_get_locale_string (launcher->key_file, "Name");
- comment = panel_key_file_get_locale_string (launcher->key_file,
- "Comment");
-
- /* Setup tooltip */
- if (!PANEL_GLIB_STR_EMPTY (name) && !PANEL_GLIB_STR_EMPTY (comment))
- str = g_strdup_printf ("%s\n%s", name, comment);
- else if (!PANEL_GLIB_STR_EMPTY (name))
- str = g_strdup (name);
- else
- str = g_strdup (comment);
-
- g_free (name);
- g_free (comment);
-
- /* If we can unescape the string, then we probably have an escaped
- * string (a location e.g.). If we can't, then it most probably means
- * we have a % that is not here to encode a character, and we don't
- * want to unescape in this case. See bug #170516 for details. */
- unescaped_str = g_uri_unescape_string (str, NULL);
- if (unescaped_str) {
- g_free (str);
- str = unescaped_str;
- }
-
- panel_util_set_tooltip_text (launcher->button, str);
-
- /* Setup accessible name */
- panel_a11y_set_atk_name_desc (launcher->button, str, NULL);
-
- g_free (str);
-
- /* Setup icon */
- icon = panel_key_file_get_locale_string (launcher->key_file, "Icon");
- if (icon && icon[0] == '\0') {
- g_free (icon);
- icon = NULL;
- }
-
- if (!icon)
- icon = guess_icon_from_exec (button_widget_get_icon_theme (BUTTON_WIDGET (launcher->button)),
- launcher->key_file);
- if (!icon)
- icon = g_strdup (PANEL_ICON_LAUNCHER);
-
- button_widget_set_icon_name (BUTTON_WIDGET (launcher->button), icon);
- g_free (icon);
-}
-
static char *
panel_launcher_find_writable_uri (const char *launcher_location,
const char *source)
@@ -767,38 +73,6 @@ panel_launcher_find_writable_uri (const char *launcher_location,
return panel_make_unique_desktop_uri (NULL, source);
}
-static void
-launcher_changed (PanelDItemEditor *dialog,
- Launcher *launcher)
-{
- /* Setup the button look */
- setup_button (launcher);
-}
-
-static void
-launcher_command_changed (PanelDItemEditor *dialog,
- const char *command,
- Launcher *launcher)
-{
- char *exec;
- char *old_exec;
- GKeyFile *revert_key_file;
-
- revert_key_file = panel_ditem_editor_get_revert_key_file (dialog);
-
- if (revert_key_file) {
- exec = panel_key_file_get_string (launcher->key_file, "Exec");
- old_exec = panel_key_file_get_string (revert_key_file, "Exec");
-
- if (!old_exec || !exec || strcmp (old_exec, exec))
- panel_key_file_remove_key (launcher->key_file,
- "StartupNotify");
-
- g_free (exec);
- g_free (old_exec);
- }
-}
-
static char *
launcher_save_uri (PanelDItemEditor *dialog,
gpointer data)
@@ -840,30 +114,6 @@ launcher_save_uri (PanelDItemEditor *dialog,
return NULL;
}
-static void
-launcher_saved (GtkWidget *dialog,
- Launcher *launcher)
-{
- const char *uri;
-
- uri = panel_ditem_editor_get_uri (PANEL_DITEM_EDITOR (dialog));
- if (panel_launcher_get_filename (uri) != NULL)
- uri = panel_launcher_get_filename (uri);
-
- if (uri && launcher->location && strcmp (uri, launcher->location)) {
- GSettings *settings;
-
- settings = panel_layout_get_instance_settings (launcher->info->settings,
- PANEL_LAUNCHER_SCHEMA);
- g_settings_set_string (settings, PANEL_LOCATION_KEY, uri);
- g_object_unref (settings);
-
- if (launcher->location)
- g_free (launcher->location);
- launcher->location = g_strdup (uri);
- }
-}
-
static void
launcher_error_reported (GtkWidget *dialog,
const char *primary,
@@ -875,146 +125,6 @@ launcher_error_reported (GtkWidget *dialog,
primary, secondary);
}
-void
-launcher_properties (Launcher *launcher)
-{
- if (launcher->prop_dialog != NULL) {
- gtk_window_set_screen (GTK_WINDOW (launcher->prop_dialog),
- gtk_widget_get_screen (launcher->button));
- gtk_window_present (GTK_WINDOW (launcher->prop_dialog));
- return;
- }
-
- launcher->prop_dialog = panel_ditem_editor_new (NULL,
- launcher->key_file,
- launcher->location,
- _("Launcher Properties"));
- gtk_window_set_screen (GTK_WINDOW (launcher->prop_dialog),
- gtk_widget_get_screen (launcher->button));
-
- panel_widget_register_open_dialog (PANEL_WIDGET
- (gtk_widget_get_parent (launcher->info->widget)),
- launcher->prop_dialog);
-
- panel_ditem_register_save_uri_func (PANEL_DITEM_EDITOR (launcher->prop_dialog),
- launcher_save_uri,
- launcher);
-
- g_signal_connect (launcher->prop_dialog, "changed",
- G_CALLBACK (launcher_changed), launcher);
-
- g_signal_connect (launcher->prop_dialog, "command_changed",
- G_CALLBACK (launcher_command_changed), launcher);
-
- g_signal_connect (launcher->prop_dialog, "saved",
- G_CALLBACK (launcher_saved), launcher);
-
- g_signal_connect (launcher->prop_dialog, "error_reported",
- G_CALLBACK (launcher_error_reported), NULL);
-
- g_signal_connect (launcher->prop_dialog, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &launcher->prop_dialog);
-
- gtk_widget_show (launcher->prop_dialog);
-}
-
-static gboolean
-lancher_properties_enabled (void)
-{
- if (panel_lockdown_get_panels_locked_down_s () ||
- panel_lockdown_get_disable_command_line_s ())
- return FALSE;
-
- return TRUE;
-}
-
-static Launcher *
-load_launcher_applet (const char *location,
- PanelWidget *panel,
- const char *id,
- GSettings *settings)
-{
- Launcher *launcher;
-
- launcher = create_launcher (location);
-
- if (!launcher)
- return NULL;
-
- launcher->info = panel_applet_register (launcher->button, panel,
- PANEL_OBJECT_LAUNCHER, id,
- settings,
- launcher, free_launcher);
- if (!launcher->info) {
- free_launcher (launcher);
- return NULL;
- }
-
- panel_applet_add_callback (launcher->info,
- "launch",
- _("_Launch"),
- NULL);
-
- panel_applet_add_callback (launcher->info,
- "properties",
- _("_Properties"),
- lancher_properties_enabled);
-
- panel_widget_set_applet_expandable (panel, GTK_WIDGET (launcher->button), FALSE, TRUE);
- panel_widget_set_applet_size_constrained (panel, GTK_WIDGET (launcher->button), TRUE);
-
- /* setup button according to ditem */
- setup_button (launcher);
-
- return launcher;
-}
-
-void
-launcher_load (PanelWidget *panel_widget,
- const char *id,
- GSettings *settings)
-{
- GSettings *settings_instance;
- Launcher *launcher;
- char *launcher_location;
-
- g_return_if_fail (panel_widget != NULL);
- g_return_if_fail (id != NULL);
-
- settings_instance = panel_layout_get_instance_settings (settings,
- PANEL_LAUNCHER_SCHEMA);
-
- launcher_location = g_settings_get_string (settings_instance,
- PANEL_LOCATION_KEY);
-
- if (PANEL_GLIB_STR_EMPTY (launcher_location)) {
- g_printerr (_("Launcher location is not set, cannot load launcher\n"));
- g_free (launcher_location);
- g_object_unref (settings_instance);
- return;
- }
-
- launcher = load_launcher_applet (launcher_location,
- panel_widget,
- id, settings);
-
- if (launcher) {
- if (!g_settings_is_writable (settings_instance,
- PANEL_LOCATION_KEY)) {
- AppletUserMenu *menu;
-
- menu = panel_applet_get_callback (launcher->info->user_menu,
- "properties");
- if (menu != NULL)
- menu->sensitive = FALSE;
- }
- }
-
- g_free (launcher_location);
- g_object_unref (settings_instance);
-}
-
static void
launcher_new_saved (GtkWidget *dialog,
gpointer data)
diff --git a/gnome-panel/launcher.h b/gnome-panel/launcher.h
index 875078ab5..2392b6c6a 100644
--- a/gnome-panel/launcher.h
+++ b/gnome-panel/launcher.h
@@ -22,11 +22,6 @@ typedef struct {
char *location;
GKeyFile *key_file;
-
- GtkWidget *prop_dialog;
- GSList *error_dialogs;
-
- gulong destroy_handler;
} Launcher;
void panel_launcher_create (PanelToplevel *toplevel,
@@ -42,23 +37,10 @@ void panel_launcher_create_from_info (PanelToplevel *toplevel,
const char *comment,
const char *icon);
-void launcher_launch (Launcher *launcher,
- GtkWidget *widget);
-
-void launcher_properties (Launcher *launcher);
-
-void launcher_load (PanelWidget *panel_widget,
- const char *id,
- GSettings *settings);
-
-void panel_launcher_delete (Launcher *launcher);
-
void ask_about_launcher (const char *file,
PanelWidget *panel,
PanelObjectPackType pack_type);
-void launcher_properties_destroy (Launcher *launcher);
-
G_END_DECLS
#endif
diff --git a/gnome-panel/libpanel-util/panel-launch.c b/gnome-panel/libpanel-util/panel-launch.c
index 44ebfdef1..290315ef2 100644
--- a/gnome-panel/libpanel-util/panel-launch.c
+++ b/gnome-panel/libpanel-util/panel-launch.c
@@ -99,7 +99,7 @@ gather_pid_callback (GDesktopAppInfo *gapp,
g_child_watch_add (pid, dummy_child_watch, NULL);
}
-gboolean
+static gboolean
panel_app_info_launch_uris (GAppInfo *appinfo,
GList *uris,
GdkScreen *screen,
@@ -132,34 +132,6 @@ panel_app_info_launch_uris (GAppInfo *appinfo,
screen, local_error, error);
}
-gboolean
-panel_launch_key_file (GKeyFile *keyfile,
- GList *uri_list,
- GdkScreen *screen,
- GError **error)
-{
- GDesktopAppInfo *appinfo;
- gboolean retval;
-
- g_return_val_if_fail (keyfile != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- appinfo = g_desktop_app_info_new_from_keyfile (keyfile);
-
- if (appinfo == NULL)
- return FALSE;
-
- retval = panel_app_info_launch_uris (G_APP_INFO (appinfo),
- uri_list, screen,
- gtk_get_current_event_time (),
- error);
-
- g_object_unref (appinfo);
-
- return retval;
-}
-
gboolean
panel_launch_desktop_file (const char *desktop_file,
GdkScreen *screen,
diff --git a/gnome-panel/libpanel-util/panel-launch.h b/gnome-panel/libpanel-util/panel-launch.h
index b2c5a4bd3..608482bca 100644
--- a/gnome-panel/libpanel-util/panel-launch.h
+++ b/gnome-panel/libpanel-util/panel-launch.h
@@ -28,17 +28,6 @@
G_BEGIN_DECLS
-gboolean panel_app_info_launch_uris (GAppInfo *appinfo,
- GList *uris,
- GdkScreen *screen,
- guint32 timestamp,
- GError **error);
-
-gboolean panel_launch_key_file (GKeyFile *keyfile,
- GList *uri_list,
- GdkScreen *screen,
- GError **error);
-
gboolean panel_launch_desktop_file (const char *desktop_file,
GdkScreen *screen,
GError **error);
diff --git a/gnome-panel/panel-addto-dialog.c b/gnome-panel/panel-addto-dialog.c
index 1193be920..1163a6047 100644
--- a/gnome-panel/panel-addto-dialog.c
+++ b/gnome-panel/panel-addto-dialog.c
@@ -26,11 +26,8 @@
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
-#include <gmenu-tree.h>
-
#include <libpanel-util/panel-glib.h>
-#include "launcher.h"
#include "panel.h"
#include "panel-applets-manager.h"
#include "panel-applet-frame.h"
@@ -50,22 +47,14 @@ struct _PanelAddtoDialog
GtkWidget *dialog_vbox;
GtkWidget *label;
GtkWidget *search_entry;
- GtkWidget *back_button;
GtkWidget *add_button;
GtkWidget *close_button;
GtkWidget *tree_view;
- GtkWidget *tree_view_selection;
GtkTreeModel *applet_model;
GtkTreeModel *filter_applet_model;
- GtkTreeModel *application_model;
- GtkTreeModel *filter_application_model;
-
- GMenuTree *menu_tree;
GSList *applet_list;
- GSList *application_list;
- GSList *settings_list;
gchar *search_text;
gchar *applet_search_text;
@@ -79,11 +68,7 @@ static GQuark panel_addto_dialog_quark = 0;
typedef enum {
PANEL_ADDTO_APPLET,
- PANEL_ADDTO_ACTION,
- PANEL_ADDTO_LAUNCHER_MENU,
- PANEL_ADDTO_LAUNCHER,
- PANEL_ADDTO_LAUNCHER_NEW,
- PANEL_ADDTO_MENU
+ PANEL_ADDTO_ACTION
} PanelAddtoItemType;
typedef struct {
@@ -92,7 +77,6 @@ typedef struct {
char *description;
GIcon *icon;
PanelActionButtonType action_type;
- char *launcher_path;
char *iid;
} PanelAddtoItemInfo;
@@ -109,8 +93,6 @@ enum {
NUMBER_COLUMNS
};
-static void panel_addto_present_applications (PanelAddtoDialog *dialog);
-static void panel_addto_present_applets (PanelAddtoDialog *dialog);
static gboolean panel_addto_filter_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data);
@@ -243,23 +225,6 @@ panel_addto_setup_drag (GtkTreeView *tree_view,
NULL);
}
-static void
-panel_addto_setup_launcher_drag (GtkTreeView *tree_view,
- const char *path)
-{
- static const GtkTargetEntry target[] = {
- { (gchar *) "text/uri-list", 0, 0 }
- };
- char *uri;
- char *uri_list;
-
- uri = g_filename_to_uri (path, NULL, NULL);
- uri_list = g_strconcat (uri, "\r\n", NULL);
- panel_addto_setup_drag (tree_view, target, uri_list);
- g_free (uri_list);
- g_free (uri);
-}
-
static void
panel_addto_setup_applet_drag (GtkTreeView *tree_view,
const char *iid)
@@ -356,33 +321,6 @@ panel_addto_append_item (PanelAddtoDialog *dialog,
}
}
-static void
-panel_addto_append_special_applets (PanelAddtoDialog *dialog,
- GtkListStore *model)
-{
- PanelAddtoItemInfo *special;
-
- if (!panel_lockdown_get_disable_command_line_s ()) {
- special = g_new0 (PanelAddtoItemInfo, 1);
- special->type = PANEL_ADDTO_LAUNCHER_NEW;
- special->name = g_strdup (_("Custom Application Launcher"));
- special->description = g_strdup (_("Create a new launcher"));
- special->icon = g_themed_icon_new (PANEL_ICON_LAUNCHER);
- special->action_type = PANEL_ACTION_NONE;
- special->iid = g_strdup ("LAUNCHER:ASK");
- panel_addto_append_item (dialog, model, special);
- }
-
- special = g_new0 (PanelAddtoItemInfo, 1);
- special->type = PANEL_ADDTO_LAUNCHER_MENU;
- special->name = g_strdup (_("Application Launcher..."));
- special->description = g_strdup (_("Copy a launcher from the applications menu"));
- special->icon = g_themed_icon_new (PANEL_ICON_LAUNCHER);
- special->action_type = PANEL_ACTION_NONE;
- special->iid = g_strdup ("LAUNCHER:MENU");
- panel_addto_append_item (dialog, model, special);
-}
-
static void
panel_addto_make_applet_model (PanelAddtoDialog *dialog)
{
@@ -407,7 +345,6 @@ panel_addto_make_applet_model (PanelAddtoDialog *dialog)
G_TYPE_STRING);
if (panel_layout_is_writable ()) {
- panel_addto_append_special_applets (dialog, model);
if (dialog->applet_list)
panel_addto_append_item (dialog, model, NULL);
}
@@ -423,257 +360,6 @@ panel_addto_make_applet_model (PanelAddtoDialog *dialog)
dialog, NULL);
}
-typedef enum {
- PANEL_ADDTO_MENU_SHOW_DIRECTORIES = 1 << 0,
- PANEL_ADDTO_MENU_SHOW_ENTRIES = 1 << 1,
- PANEL_ADDTO_MENU_SHOW_ALIAS = 1 << 2
-#define PANEL_ADDTO_MENU_SHOW_ALL (PANEL_ADDTO_MENU_SHOW_DIRECTORIES | PANEL_ADDTO_MENU_SHOW_ENTRIES |
PANEL_ADDTO_MENU_SHOW_ALIAS)
-} PanelAddtoMenuShowFlags;
-
-static void panel_addto_make_application_list (GSList **parent_list,
- GMenuTreeDirectory *directory,
- const char *filename,
- PanelAddtoMenuShowFlags show_flags);
-
-static void
-panel_addto_prepend_directory (GSList **parent_list,
- GMenuTreeDirectory *directory,
- const char *filename)
-{
- PanelAddtoAppList *data;
- GIcon *icon;
-
- data = g_new0 (PanelAddtoAppList, 1);
-
- icon = gmenu_tree_directory_get_icon (directory);
- if (icon)
- g_object_ref (icon);
-
- data->item_info.type = PANEL_ADDTO_MENU;
- data->item_info.name = g_strdup (gmenu_tree_directory_get_name (directory));
- data->item_info.description = g_strdup (gmenu_tree_directory_get_comment (directory));
- data->item_info.icon = icon;
-
- *parent_list = g_slist_prepend (*parent_list, data);
-
- /* We always want to show everything in non-root directories */
- panel_addto_make_application_list (&data->children, directory,
- filename, PANEL_ADDTO_MENU_SHOW_ALL);
-}
-
-static void
-panel_addto_prepend_entry (GSList **parent_list,
- GMenuTreeEntry *entry,
- const char *filename)
-{
- PanelAddtoAppList *data;
- GAppInfo *app_info;
- GIcon *icon;
-
- data = g_new0 (PanelAddtoAppList, 1);
-
- app_info = G_APP_INFO (gmenu_tree_entry_get_app_info (entry));
-
- icon = g_app_info_get_icon (app_info);
- if (icon)
- g_object_ref (icon);
-
- data->item_info.type = PANEL_ADDTO_LAUNCHER;
- data->item_info.name = g_strdup (g_app_info_get_display_name (app_info));
- data->item_info.description = g_strdup (g_app_info_get_description (app_info));
- data->item_info.icon = icon;
- data->item_info.launcher_path = g_strdup (gmenu_tree_entry_get_desktop_file_path (entry));
-
- *parent_list = g_slist_prepend (*parent_list, data);
-}
-
-static void
-panel_addto_prepend_alias (GSList **parent_list,
- GMenuTreeAlias *alias,
- const char *filename)
-{
- GMenuTreeItemType type;
-
- type = gmenu_tree_alias_get_aliased_item_type (alias);
-
- if (type == GMENU_TREE_ITEM_DIRECTORY) {
- GMenuTreeDirectory *directory = gmenu_tree_alias_get_aliased_directory (alias);
- panel_addto_prepend_directory (parent_list,
- directory,
- filename);
- gmenu_tree_item_unref (directory);
- } else if (type == GMENU_TREE_ITEM_ENTRY) {
- GMenuTreeEntry *entry = gmenu_tree_alias_get_aliased_entry (alias);
- panel_addto_prepend_entry (parent_list,
- entry,
- filename);
- gmenu_tree_item_unref (entry);
- }
-}
-
-static void
-panel_addto_make_application_list (GSList **parent_list,
- GMenuTreeDirectory *directory,
- const char *filename,
- PanelAddtoMenuShowFlags show_flags)
-{
- GMenuTreeIter *iter;
- GMenuTreeItemType next_type;
-
- iter = gmenu_tree_directory_iter (directory);
-
- while ((next_type = gmenu_tree_iter_next (iter)) != GMENU_TREE_ITEM_INVALID) {
- if (next_type == GMENU_TREE_ITEM_DIRECTORY) {
- if (show_flags & PANEL_ADDTO_MENU_SHOW_DIRECTORIES) {
- GMenuTreeDirectory *dir = gmenu_tree_iter_get_directory (iter);
- panel_addto_prepend_directory (parent_list, dir, filename);
- gmenu_tree_item_unref (dir);
- }
- } else if (next_type == GMENU_TREE_ITEM_ENTRY) {
- if (show_flags & PANEL_ADDTO_MENU_SHOW_ENTRIES) {
- GMenuTreeEntry *entry = gmenu_tree_iter_get_entry (iter);
- panel_addto_prepend_entry (parent_list, entry, filename);
- gmenu_tree_item_unref (entry);
- }
- } else if (next_type == GMENU_TREE_ITEM_ALIAS) {
- if (show_flags & PANEL_ADDTO_MENU_SHOW_ALIAS) {
- GMenuTreeAlias *alias = gmenu_tree_iter_get_alias (iter);
- panel_addto_prepend_alias (parent_list, alias, filename);
- gmenu_tree_item_unref (alias);
- }
- }
- }
- gmenu_tree_iter_unref (iter);
-
- *parent_list = g_slist_reverse (*parent_list);
-}
-
-static void
-panel_addto_populate_application_model (GtkTreeStore *store,
- GtkTreeIter *parent,
- GSList *app_list)
-{
- PanelAddtoAppList *data;
- GtkTreeIter iter;
- char *text;
- GSList *app;
-
- for (app = app_list; app != NULL; app = app->next) {
- PanelAddtoItemInfo *column_data;
-
- data = app->data;
- gtk_tree_store_append (store, &iter, parent);
-
- text = panel_addto_make_text (data->item_info.name,
- data->item_info.description);
-
- column_data = NULL;
- if (data->item_info.type != PANEL_ADDTO_MENU)
- column_data = &data->item_info;
-
- gtk_tree_store_set (store, &iter,
- COLUMN_ICON, data->item_info.icon,
- COLUMN_TEXT, text,
- COLUMN_DATA, column_data,
- COLUMN_SEARCH, data->item_info.name,
- -1);
-
- g_free (text);
-
- if (data->children != NULL)
- panel_addto_populate_application_model (store,
- &iter,
- data->children);
- }
-}
-
-static gchar *
-get_applications_menu (void)
-{
- const gchar *xdg_menu_prefx = g_getenv ("XDG_MENU_PREFIX");
- return g_strdup_printf ("%sapplications.menu",
- !PANEL_GLIB_STR_EMPTY (xdg_menu_prefx) ? xdg_menu_prefx : "gnome-");
-}
-
-static void
-panel_addto_make_application_model (PanelAddtoDialog *dialog)
-{
- GtkTreeStore *store;
- GMenuTree *tree;
- GMenuTreeDirectory *root;
- gchar *applications_menu;
-
- if (dialog->filter_application_model != NULL)
- return;
-
- store = gtk_tree_store_new (NUMBER_COLUMNS,
- G_TYPE_ICON,
- G_TYPE_STRING,
- G_TYPE_POINTER,
- G_TYPE_STRING);
-
- applications_menu = get_applications_menu ();
- tree = gmenu_tree_new (applications_menu, GMENU_TREE_FLAGS_SORT_DISPLAY_NAME);
-
- if (!gmenu_tree_load_sync (tree, NULL)) {
- g_object_unref (tree);
- tree = NULL;
- }
-
- if (tree != NULL && (root = gmenu_tree_get_root_directory (tree))) {
- panel_addto_make_application_list (&dialog->application_list,
- root, applications_menu,
- PANEL_ADDTO_MENU_SHOW_ALL);
- panel_addto_populate_application_model (store, NULL, dialog->application_list);
-
- gmenu_tree_item_unref (root);
- }
-
- g_free (applications_menu);
-
- if (tree != NULL)
- g_object_unref (tree);
-
- tree = gmenu_tree_new ("gnomecc.menu", GMENU_TREE_FLAGS_SORT_DISPLAY_NAME);
-
- if (!gmenu_tree_load_sync (tree, NULL)) {
- g_object_unref (tree);
- tree = NULL;
- }
-
- if (tree != NULL && (root = gmenu_tree_get_root_directory (tree))) {
- GtkTreeIter iter;
-
- gtk_tree_store_append (store, &iter, NULL);
- gtk_tree_store_set (store, &iter,
- COLUMN_ICON, NULL,
- COLUMN_TEXT, NULL,
- COLUMN_DATA, NULL,
- COLUMN_SEARCH, NULL,
- -1);
-
- /* The gnome-control-center shell does not display toplevel
- * entries that are not directories, so do the same. */
- panel_addto_make_application_list (&dialog->settings_list,
- root, "gnomecc.menu",
- PANEL_ADDTO_MENU_SHOW_DIRECTORIES);
- panel_addto_populate_application_model (store, NULL,
- dialog->settings_list);
-
- gmenu_tree_item_unref (root);
- }
-
- if (tree != NULL)
- g_object_unref (tree);
-
- dialog->application_model = GTK_TREE_MODEL (store);
- dialog->filter_application_model = gtk_tree_model_filter_new (GTK_TREE_MODEL
(dialog->application_model),
- NULL);
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (dialog->filter_application_model),
- panel_addto_filter_func,
- dialog, NULL);
-}
-
typedef struct
{
PanelAddtoDialog *dialog;
@@ -763,20 +449,6 @@ panel_addto_add_item (PanelAddtoDialog *dialog,
pack_index,
item_info->action_type);
break;
- case PANEL_ADDTO_LAUNCHER_MENU:
- panel_addto_present_applications (dialog);
- break;
- case PANEL_ADDTO_LAUNCHER:
- panel_launcher_create (dialog->panel_widget->toplevel,
- dialog->insert_pack_type,
- pack_index,
- item_info->launcher_path);
- break;
- case PANEL_ADDTO_LAUNCHER_NEW:
- ask_about_launcher (NULL, dialog->panel_widget,
- dialog->insert_pack_type);
- break;
- case PANEL_ADDTO_MENU:
default:
break;
}
@@ -810,13 +482,6 @@ panel_addto_dialog_add_button_cb (PanelAddtoDialog *dialog,
}
}
-static void
-panel_addto_dialog_back_button_cb (PanelAddtoDialog *dialog,
- GtkWidget *widget)
-{
- panel_addto_present_applets (dialog);
-}
-
static void
panel_addto_dialog_close_button_cb (PanelAddtoDialog *dialog,
GtkWidget *widget)
@@ -824,25 +489,6 @@ panel_addto_dialog_close_button_cb (PanelAddtoDialog *dialog,
gtk_widget_destroy (GTK_WIDGET (dialog));
}
-static void
-panel_addto_present_applications (PanelAddtoDialog *dialog)
-{
- if (dialog->filter_application_model == NULL)
- panel_addto_make_application_model (dialog);
- gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->tree_view),
- dialog->filter_application_model);
- gtk_window_set_focus (GTK_WINDOW (dialog),
- dialog->search_entry);
- gtk_widget_set_sensitive (dialog->back_button, TRUE);
-
- if (dialog->applet_search_text)
- g_free (dialog->applet_search_text);
-
- dialog->applet_search_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->search_entry)));
- /* show everything */
- gtk_entry_set_text (GTK_ENTRY (dialog->search_entry), "");
-}
-
static void
panel_addto_present_applets (PanelAddtoDialog *dialog)
{
@@ -852,7 +498,6 @@ panel_addto_present_applets (PanelAddtoDialog *dialog)
dialog->filter_applet_model);
gtk_window_set_focus (GTK_WINDOW (dialog),
dialog->search_entry);
- gtk_widget_set_sensitive (dialog->back_button, FALSE);
if (dialog->applet_search_text) {
gtk_entry_set_text (GTK_ENTRY (dialog->search_entry),
@@ -882,29 +527,6 @@ panel_addto_dialog_free_item_info (PanelAddtoItemInfo *item_info)
g_free (item_info->iid);
item_info->iid = NULL;
-
- g_free (item_info->launcher_path);
- item_info->launcher_path = NULL;
-}
-
-static void
-panel_addto_dialog_free_application_list (GSList *application_list)
-{
- PanelAddtoAppList *data;
- GSList *app;
-
- if (application_list == NULL)
- return;
-
- for (app = application_list; app != NULL; app = app->next) {
- data = app->data;
- if (data->children) {
- panel_addto_dialog_free_application_list (data->children);
- }
- panel_addto_dialog_free_item_info (&data->item_info);
- g_free (data);
- }
- g_slist_free (application_list);
}
static void
@@ -1041,26 +663,12 @@ panel_addto_selection_changed (PanelAddtoDialog *dialog,
gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), TRUE);
- if (data->type == PANEL_ADDTO_LAUNCHER_MENU) {
- gtk_button_set_label (GTK_BUTTON (dialog->add_button),
- _("_Forward"));
- } else {
- gtk_button_set_label (GTK_BUTTON (dialog->add_button),
- _("_Add"));
- }
-
/* only allow dragging applets if we can add applets */
if (panel_layout_is_writable ()) {
- if (data->type == PANEL_ADDTO_LAUNCHER) {
- panel_addto_setup_launcher_drag (GTK_TREE_VIEW (dialog->tree_view),
- data->launcher_path);
- } else if (data->type == PANEL_ADDTO_APPLET) {
+ if (data->type == PANEL_ADDTO_APPLET) {
panel_addto_setup_applet_drag (GTK_TREE_VIEW (dialog->tree_view),
data->iid);
- } else if (data->type == PANEL_ADDTO_LAUNCHER_MENU) {
- gtk_tree_view_unset_rows_drag_source (GTK_TREE_VIEW (dialog->tree_view));
- } else if (data->type == PANEL_ADDTO_MENU) {
- } else {
+ } else if (data->type == PANEL_ADDTO_ACTION) {
panel_addto_setup_internal_applet_drag (GTK_TREE_VIEW (dialog->tree_view),
data->iid);
}
@@ -1150,9 +758,6 @@ panel_addto_dialog_dispose (GObject *object)
g_clear_object (&dialog->filter_applet_model);
g_clear_object (&dialog->applet_model);
- g_clear_object (&dialog->filter_application_model);
- g_clear_object (&dialog->application_model);
- g_clear_object (&dialog->menu_tree);
G_OBJECT_CLASS (panel_addto_dialog_parent_class)->dispose (object);
}
@@ -1185,9 +790,6 @@ panel_addto_dialog_finalize (GObject *object)
}
g_slist_free (dialog->applet_list);
- panel_addto_dialog_free_application_list (dialog->application_list);
- panel_addto_dialog_free_application_list (dialog->settings_list);
-
G_OBJECT_CLASS (panel_addto_dialog_parent_class)->finalize (object);
}
@@ -1210,13 +812,10 @@ panel_addto_dialog_class_init (PanelAddtoDialogClass *dialog_class)
gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, label);
gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, search_entry);
gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, add_button);
- gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, back_button);
gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, close_button);
gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, tree_view);
- gtk_widget_class_bind_template_child (widget_class, PanelAddtoDialog, tree_view_selection);
gtk_widget_class_bind_template_callback (widget_class, panel_addto_dialog_add_button_cb);
- gtk_widget_class_bind_template_callback (widget_class, panel_addto_dialog_back_button_cb);
gtk_widget_class_bind_template_callback (widget_class, panel_addto_dialog_close_button_cb);
gtk_widget_class_bind_template_callback (widget_class, panel_addto_search_entry_changed);
gtk_widget_class_bind_template_callback (widget_class, panel_addto_search_entry_activated);
diff --git a/gnome-panel/panel-addto-dialog.ui b/gnome-panel/panel-addto-dialog.ui
index dd5f8dad9..954dea770 100644
--- a/gnome-panel/panel-addto-dialog.ui
+++ b/gnome-panel/panel-addto-dialog.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.19.0 -->
+<!-- Generated with glade 3.22.2 -->
<interface>
- <requires lib="gtk+" version="3.16"/>
+ <requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore">
<columns>
<!-- column-name icon -->
@@ -14,6 +14,9 @@
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="title" translatable="yes">Add to Panel</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="dialog_vbox">
<property name="visible">True</property>
@@ -137,22 +140,6 @@
<property name="can_focus">False</property>
<property name="spacing">5</property>
<property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="back_button">
- <property name="label" translatable="yes">_Back</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="panel_addto_dialog_back_button_cb" swapped="yes"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkButton" id="add_button">
<property name="label" translatable="yes">_Add</property>
diff --git a/gnome-panel/panel-ditem-editor.c b/gnome-panel/panel-ditem-editor.c
index cd0413e5e..43b9896a6 100644
--- a/gnome-panel/panel-ditem-editor.c
+++ b/gnome-panel/panel-ditem-editor.c
@@ -1589,14 +1589,6 @@ panel_ditem_editor_get_key_file (PanelDItemEditor *dialog)
return dialog->priv->key_file;
}
-GKeyFile *
-panel_ditem_editor_get_revert_key_file (PanelDItemEditor *dialog)
-{
- g_return_val_if_fail (PANEL_IS_DITEM_EDITOR (dialog), NULL);
-
- return dialog->priv->revert_key_file;
-}
-
const char *
panel_ditem_editor_get_uri (PanelDItemEditor *dialog)
{
diff --git a/gnome-panel/panel-ditem-editor.h b/gnome-panel/panel-ditem-editor.h
index 6f3239059..13f4f95d1 100644
--- a/gnome-panel/panel-ditem-editor.h
+++ b/gnome-panel/panel-ditem-editor.h
@@ -89,7 +89,6 @@ GtkWidget *panel_ditem_editor_new (GtkWindow *parent,
void panel_ditem_editor_sync_display (PanelDItemEditor *dialog);
GKeyFile *panel_ditem_editor_get_key_file (PanelDItemEditor *dialog);
-GKeyFile *panel_ditem_editor_get_revert_key_file (PanelDItemEditor *dialog);
void panel_ditem_editor_set_uri (PanelDItemEditor *dialog,
const char *uri);
diff --git a/gnome-panel/panel-object-loader.c b/gnome-panel/panel-object-loader.c
index 830cc3042..76a62f06a 100644
--- a/gnome-panel/panel-object-loader.c
+++ b/gnome-panel/panel-object-loader.c
@@ -201,9 +201,6 @@ panel_object_loader_idle_handler (gpointer dummy)
object->settings);
break;
case PANEL_OBJECT_LAUNCHER:
- launcher_load (panel_widget,
- object->id,
- object->settings);
break;
case PANEL_OBJECT_ACTION:
panel_action_button_load (panel_widget,
@@ -344,9 +341,10 @@ static struct {
PanelObjectType type;
const char *id;
gboolean has_detail;
+ gboolean load;
} panel_object_iid_map[] = {
- { PANEL_OBJECT_ACTION, "ActionButton" , TRUE },
- { PANEL_OBJECT_LAUNCHER, "Launcher" , FALSE }
+ { PANEL_OBJECT_ACTION, "ActionButton", TRUE, TRUE },
+ { PANEL_OBJECT_LAUNCHER, "Launcher", FALSE, FALSE }
};
char *
@@ -409,6 +407,9 @@ panel_object_iid_to_type (const char *iid,
instance_id += 2;
for (i = 0; i < G_N_ELEMENTS (panel_object_iid_map); i++) {
+ if (!panel_object_iid_map[i].load)
+ continue;
+
if (!panel_object_iid_map[i].has_detail &&
g_strcmp0 (panel_object_iid_map[i].id,
instance_id) == 0) {
diff --git a/gnome-panel/panel-util.c b/gnome-panel/panel-util.c
index 36c54e6c2..3c4a43c40 100644
--- a/gnome-panel/panel-util.c
+++ b/gnome-panel/panel-util.c
@@ -278,31 +278,6 @@ panel_launcher_get_personal_path (void)
return panel_util_get_from_personal_path ("launchers");
}
-gboolean
-panel_launcher_is_in_personal_path (const char *location)
-{
- GFile *file;
- GFile *launchers_dir;
- char *launchers_path;
- gboolean retval;
-
- if (!location)
- return FALSE;
-
- launchers_path = panel_launcher_get_personal_path ();
- launchers_dir = g_file_new_for_path (launchers_path);
- g_free (launchers_path);
-
- file = panel_launcher_get_gfile (location);
-
- retval = g_file_has_prefix (file, launchers_dir);
-
- g_object_unref (file);
- g_object_unref (launchers_dir);
-
- return retval;
-}
-
GFile *
panel_launcher_get_gfile (const char *location)
{
diff --git a/gnome-panel/panel-util.h b/gnome-panel/panel-util.h
index 30a10c0f6..2ffd74e58 100644
--- a/gnome-panel/panel-util.h
+++ b/gnome-panel/panel-util.h
@@ -30,7 +30,6 @@ char *panel_util_get_from_personal_path (const char *file);
GFile *panel_launcher_get_gfile (const char *location);
char *panel_launcher_get_uri (const char *location);
char *panel_launcher_get_filename (const char *location);
-gboolean panel_launcher_is_in_personal_path (const char *location);
char *panel_make_full_path (const char *dir,
const char *filename);
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index b770b54bf..b6484a16c 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -705,13 +705,6 @@ drop_internal_applet (PanelWidget *panel,
} else {
success = FALSE;
}
- } else if (!strcmp(applet_type,"LAUNCHER:ASK")) {
- if (panel_layout_is_writable ()) {
- ask_about_launcher (NULL, panel, pack_type);
- success = TRUE;
- } else {
- success = FALSE;
- }
}
return success;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]