[Xfce4-commits] [apps/xfce4-screensaver] 01/05: remove drag n drop themes installation

noreply at xfce.org noreply at xfce.org
Mon Jun 17 11:40:37 CEST 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit 4bb11bfe8578e2bf719cde3fb7d9344d12c03664
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Sun Jun 16 14:57:14 2019 -0400

    remove drag n drop themes installation
    
    Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
 src/Makefile.am                     |   2 -
 src/copy-theme-dialog.c             | 521 ------------------------------------
 src/copy-theme-dialog.h             |  56 ----
 src/xfce4-screensaver-preferences.c | 160 -----------
 4 files changed, 739 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index d42670d..79fb5af 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -238,8 +238,6 @@ xfce4_screensaver_preferences_built_sources = \
 xfce4_screensaver_preferences_SOURCES = \
 	$(xfce4_screensaver_preferences_built_sources)  \
 	xfce4-screensaver-preferences.c                 \
-	copy-theme-dialog.c                             \
-	copy-theme-dialog.h                             \
 	gs-theme-manager.c                              \
 	gs-theme-manager.h                              \
 	gs-job.c                                        \
diff --git a/src/copy-theme-dialog.c b/src/copy-theme-dialog.c
deleted file mode 100644
index cb21b0c..0000000
--- a/src/copy-theme-dialog.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/* copy-theme-dialog.c
- * Copyright (C) 2008 John Millikin <jmillikin at gmail.com>
- * Copyright (C) 2018 Sean Davis <bluesabre at xfce.org>
- * Copyright (C) 2018 Simon Steinbeiss <ochosi at xfce.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301, USA.
-**/
-
-#include <config.h>
-
-#include <limits.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include <gio/gio.h>
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <gtk/gtk.h>
-
-#include <libxfce4util/libxfce4util.h>
-
-#include "copy-theme-dialog.h"
-
-static void
-copy_theme_dialog_class_init (CopyThemeDialogClass *klass);
-static void
-copy_theme_dialog_init (CopyThemeDialog *dlg);
-static void
-add_file_to_dialog (gpointer data,
-                    gpointer user_data);
-static void
-single_copy_complete (GObject      *source_object,
-                      GAsyncResult *res,
-                      gpointer      user_data);
-static void
-copy_theme_dialog_copy_next (CopyThemeDialog *dialog);
-static void
-copy_theme_dialog_cancel (CopyThemeDialog *dialog);
-static void
-copy_theme_dialog_finalize (GObject *obj);
-static void
-copy_theme_dialog_update_num_files (CopyThemeDialog *dlg);
-static void
-copy_theme_dialog_response (GtkDialog *dialog,
-                            gint       response_id);
-static void
-eel_gtk_label_make_bold (GtkLabel *label);
-static void
-create_titled_label (GtkGrid    *grid,
-                     int         row,
-                     GtkWidget **title_widget,
-                     GtkWidget **label_text_widget);
-
-static GObjectClass *parent_class = NULL;
-
-enum {
-    CANCELLED = 0,
-    COMPLETE,
-    SIGNAL_COUNT
-};
-
-struct _CopyThemeDialogPrivate {
-    GtkWidget    *progress;
-    GtkWidget    *status;
-    GtkWidget    *current;
-    GtkWidget    *from;
-    GtkWidget    *to;
-
-    GFile        *theme_dir;
-    GSList       *all_files, *file;
-    GSList       *all_basenames, *basename;
-    guint         index;
-    guint         total_files;
-    GCancellable *cancellable;
-};
-
-guint signals[SIGNAL_COUNT] = {0, 0};
-
-GType
-copy_theme_dialog_get_type (void) {
-    static GType copy_theme_dialog_type = 0;
-
-    if (!copy_theme_dialog_type) {
-        static GTypeInfo copy_theme_dialog_info = {
-            sizeof (CopyThemeDialogClass),
-            NULL, /* GBaseInitFunc */
-            NULL, /* GBaseFinalizeFunc */
-            (GClassInitFunc) copy_theme_dialog_class_init,
-            NULL, /* GClassFinalizeFunc */
-            NULL, /* data */
-            sizeof (CopyThemeDialog),
-            0, /* n_preallocs */
-            (GInstanceInitFunc) copy_theme_dialog_init,
-            NULL
-        };
-
-        copy_theme_dialog_type = g_type_register_static (GTK_TYPE_DIALOG,
-                                                         "CopyThemeDialog",
-                                                         &copy_theme_dialog_info,
-                                                         0);
-    }
-
-    return copy_theme_dialog_type;
-}
-
-static void
-copy_theme_dialog_class_init (CopyThemeDialogClass *klass) {
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-    G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* GObject 2.58 */
-    g_type_class_add_private (klass, sizeof (CopyThemeDialogPrivate));
-    G_GNUC_END_IGNORE_DEPRECATIONS
-
-    klass->cancelled = copy_theme_dialog_cancel;
-    object_class->finalize = copy_theme_dialog_finalize;
-
-    GTK_DIALOG_CLASS (klass)->response = copy_theme_dialog_response;
-
-    signals[CANCELLED] = g_signal_new ("cancelled",
-                                       G_TYPE_FROM_CLASS (object_class),
-                                       G_SIGNAL_RUN_FIRST,
-                                       G_STRUCT_OFFSET (CopyThemeDialogClass, cancelled),
-                                       NULL, NULL,
-                                       g_cclosure_marshal_VOID__VOID,
-                                       G_TYPE_NONE, 0);
-
-    signals[COMPLETE] = g_signal_new ("complete",
-                                      G_TYPE_FROM_CLASS (object_class),
-                                      G_SIGNAL_RUN_LAST,
-                                      G_STRUCT_OFFSET (CopyThemeDialogClass, complete),
-                                      NULL, NULL,
-                                      g_cclosure_marshal_VOID__VOID,
-                                      G_TYPE_NONE, 0);
-
-    parent_class = g_type_class_peek_parent (klass);
-}
-
-GtkWidget*
-copy_theme_dialog_new (GList *files) {
-    GtkWidget              *dialog;
-    CopyThemeDialogPrivate *priv;
-
-    dialog = GTK_WIDGET (g_object_new (COPY_THEME_DIALOG_TYPE, NULL));
-    priv = COPY_THEME_DIALOG (dialog)->priv;
-    priv->index = 0;
-    priv->total_files = 0;
-    priv->all_files = NULL;
-    priv->all_basenames = NULL;
-
-    g_list_foreach (files, add_file_to_dialog, dialog);
-
-    priv->file = priv->all_files;
-    priv->basename = priv->all_basenames;
-
-    return dialog;
-}
-
-static gboolean
-copy_finished (CopyThemeDialog *dialog) {
-    return (g_cancellable_is_cancelled (dialog->priv->cancellable) ||
-            dialog->priv->file == NULL);
-}
-
-static void
-copy_theme_dialog_init (CopyThemeDialog *dlg) {
-    GtkWidget *vbox;
-    GtkWidget *hbox;
-    GtkWidget *progress_vbox;
-    GtkWidget *grid;
-    GtkWidget *label;
-    GtkWidget *dialog_vbox;
-    char      *markup;
-    gchar     *theme_dir_path;
-
-    dlg->priv = G_TYPE_INSTANCE_GET_PRIVATE (dlg, COPY_THEME_DIALOG_TYPE,
-                CopyThemeDialogPrivate);
-
-    /* Find and, if needed, create the directory for storing themes */
-    theme_dir_path = g_build_filename (g_get_user_data_dir (),
-                                       "applications", "screensavers",
-                                       NULL);
-    dlg->priv->theme_dir = g_file_new_for_path (theme_dir_path);
-    g_mkdir_with_parents (theme_dir_path, S_IRWXU);
-    g_free (theme_dir_path);
-
-    /* For cancelling async I/O operations */
-    dlg->priv->cancellable = g_cancellable_new ();
-
-    /* GUI settings */
-    dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
-
-    gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox),
-                                    4);
-    gtk_box_set_spacing (GTK_BOX (dialog_vbox), 4);
-
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-    gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
-    gtk_box_pack_start (GTK_BOX (dialog_vbox), vbox, TRUE, TRUE, 0);
-
-    dlg->priv->status = gtk_label_new ("");
-    markup = g_strdup_printf ("<big><b>%s</b></big>", _("Copying files"));
-    gtk_label_set_markup (GTK_LABEL (dlg->priv->status), markup);
-    g_free (markup);
-
-    gtk_widget_set_halign (dlg->priv->status, GTK_ALIGN_START);
-    gtk_widget_set_valign (dlg->priv->status, GTK_ALIGN_START);
-    gtk_box_pack_start (GTK_BOX (vbox), dlg->priv->status, FALSE, FALSE, 0);
-
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
-
-    grid = gtk_grid_new ();
-    gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
-    gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
-    gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
-
-    create_titled_label (GTK_GRID (grid), 0,
-                         &label,
-                         &dlg->priv->from);
-    gtk_label_set_text (GTK_LABEL (label), _("From:"));
-    create_titled_label (GTK_GRID (grid), 1,
-                         &label,
-                         &dlg->priv->to);
-    gtk_label_set_text (GTK_LABEL (label), _("To:"));
-
-    gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (grid), FALSE, FALSE, 0);
-
-    progress_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-    gtk_box_set_homogeneous (GTK_BOX (progress_vbox), TRUE);
-    gtk_box_pack_start (GTK_BOX (vbox), progress_vbox, FALSE, FALSE, 0);
-
-    dlg->priv->progress = gtk_progress_bar_new ();
-    gtk_box_pack_start (GTK_BOX (progress_vbox),
-                        dlg->priv->progress, FALSE, FALSE, 0);
-
-    dlg->priv->current = gtk_label_new ("");
-    gtk_box_pack_start (GTK_BOX (progress_vbox),
-                        dlg->priv->current, FALSE, FALSE, 0);
-    gtk_widget_set_halign (dlg->priv->current, GTK_ALIGN_START);
-
-    gtk_dialog_add_button (GTK_DIALOG (dlg),
-                           _("_Cancel"), GTK_RESPONSE_CANCEL);
-
-    gtk_window_set_title (GTK_WINDOW (dlg),
-                          _("Copying themes"));
-    gtk_container_set_border_width (GTK_CONTAINER (dlg), 6);
-
-    gtk_widget_show_all (dialog_vbox);
-}
-
-static void
-add_file_to_dialog (gpointer data,
-                    gpointer user_data) {
-    CopyThemeDialogPrivate *priv;
-    GFile                  *file;
-    gchar                  *basename = NULL, *raw_basename;
-
-    priv = COPY_THEME_DIALOG (user_data)->priv;
-    file = G_FILE (data);
-
-    raw_basename = g_file_get_basename (file);
-    if (g_str_has_suffix (raw_basename, ".desktop")) {
-        /* FIXME: validate key file? */
-        basename = g_strndup (raw_basename,
-                              /* 8 = strlen (".desktop") */
-                              strlen (raw_basename) - 8);
-    }
-    g_free (raw_basename);
-
-    if (basename) {
-        g_object_ref (file);
-        priv->all_files = g_slist_append (priv->all_files, file);
-        priv->all_basenames = g_slist_append (priv->all_basenames, basename);
-        priv->total_files++;
-    } else {
-        GtkWidget *dialog;
-        gchar     *uri;
-
-        dialog = gtk_message_dialog_new (GTK_WINDOW (user_data),
-                                         GTK_DIALOG_MODAL,
-                                         GTK_MESSAGE_ERROR,
-                                         GTK_BUTTONS_OK,
-                                         _("Invalid screensaver theme"));
-        uri = g_file_get_uri (file);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                  _("%s does not appear to be a valid screensaver theme."),
-                                                  uri);
-        g_free (uri);
-        gtk_window_set_title (GTK_WINDOW (dialog), "");
-        gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-desktop-screensaver");
-
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-    }
-}
-
-static void
-single_copy_complete (GObject      *source_object,
-                      GAsyncResult *res,
-                      gpointer      user_data) {
-    GError          *error = NULL;
-    gboolean         should_continue = FALSE;
-    CopyThemeDialog *dialog = COPY_THEME_DIALOG (user_data);
-
-    if (g_file_copy_finish (G_FILE (source_object), res, &error)) {
-        should_continue = TRUE;
-    } else {
-        /* If the file already exists, generate a new random name
-         * and try again.
-        **/
-        if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
-            GFile *file, *destination;
-            gchar *basename, *full_basename;
-            g_error_free (error);
-
-            file = G_FILE (dialog->priv->file->data);
-            basename = (gchar *) (dialog->priv->basename->data);
-
-            g_return_if_fail (file != NULL);
-            g_return_if_fail (basename != NULL);
-
-            full_basename = g_strdup_printf ("%s-%u.desktop",
-                                             basename,
-                                             g_random_int ());
-            destination = g_file_get_child (dialog->priv->theme_dir,
-                                            full_basename);
-            g_free (full_basename);
-
-            g_file_copy_async (file, destination, G_FILE_COPY_NONE,
-                               G_PRIORITY_DEFAULT,
-                               dialog->priv->cancellable,
-                               NULL, NULL,
-                               single_copy_complete, dialog);
-        } else {
-            if (g_error_matches (error, G_IO_ERROR,
-                                 G_IO_ERROR_CANCELLED)) {
-                /* User has cancelled the theme copy */
-                g_signal_emit (G_OBJECT (dialog),
-                               signals[CANCELLED],
-                               0, NULL);
-            } else {
-                /* Some other error occurred, ignore and
-                 * try to copy remaining files
-                **/
-                should_continue = TRUE;
-            }
-
-            g_error_free (error);
-        }
-    }
-
-    /* Update informational widgets and, if needed, signal
-     * copy completion.
-    **/
-    if (should_continue) {
-        dialog->priv->index++;
-        dialog->priv->file = dialog->priv->file->next;
-        dialog->priv->basename = dialog->priv->basename->next;
-        copy_theme_dialog_update_num_files (dialog);
-        copy_theme_dialog_copy_next (dialog);
-    }
-}
-
-/* Try to copy the theme file to the user's screensaver directory.
- * If a file with the given name already exists, the error will be
- * caught later and the copy re-attempted with a random value
- * appended to the filename.
-**/
-static void
-copy_theme_dialog_copy_next (CopyThemeDialog *dialog) {
-    GFile *file, *destination;
-    gchar *basename, *full_basename;
-
-    if (copy_finished (dialog)) {
-        g_signal_emit (G_OBJECT (dialog), signals[COMPLETE],
-                       0, NULL);
-        return;
-    }
-
-    file = G_FILE (dialog->priv->file->data);
-    basename = (gchar *) (dialog->priv->basename->data);
-
-    g_return_if_fail (file != NULL);
-    g_return_if_fail (basename != NULL);
-
-    full_basename = g_strdup_printf ("%s.desktop", basename);
-    destination = g_file_get_child (dialog->priv->theme_dir, full_basename);
-    g_free (full_basename);
-
-    g_file_copy_async (file, destination, G_FILE_COPY_NONE,
-                       G_PRIORITY_DEFAULT, dialog->priv->cancellable,
-                       NULL, NULL, single_copy_complete, dialog);
-}
-
-static gboolean
-timeout_display_dialog (gpointer data) {
-    if (IS_COPY_THEME_DIALOG (data)) {
-        CopyThemeDialog *dialog = COPY_THEME_DIALOG (data);
-        if (!copy_finished (dialog)) {
-            gtk_widget_show (GTK_WIDGET (dialog));
-
-            g_signal_connect (dialog, "response",
-                              G_CALLBACK (copy_theme_dialog_response),
-                              dialog);
-        }
-    }
-    return FALSE;
-}
-
-void
-copy_theme_dialog_begin (CopyThemeDialog *dialog) {
-    gtk_widget_hide (GTK_WIDGET (dialog));
-
-    /* If the copy operation takes more than half a second to
-     * complete, display the dialog.
-    **/
-    g_timeout_add (500, timeout_display_dialog, dialog);
-
-    copy_theme_dialog_copy_next (dialog);
-}
-
-static void
-copy_theme_dialog_cancel (CopyThemeDialog *dialog) {
-    g_cancellable_cancel (dialog->priv->cancellable);
-}
-
-static void
-copy_theme_dialog_finalize (GObject *obj) {
-    CopyThemeDialog *dlg = COPY_THEME_DIALOG (obj);
-
-    g_object_unref (dlg->priv->theme_dir);
-    g_slist_foreach (dlg->priv->all_files, (GFunc) (g_object_unref), NULL);
-    g_slist_free (dlg->priv->all_files);
-    g_slist_foreach (dlg->priv->all_basenames, (GFunc) (g_free), NULL);
-    g_slist_free (dlg->priv->all_basenames);
-    g_object_unref (dlg->priv->cancellable);
-
-    if (parent_class->finalize)
-        parent_class->finalize (G_OBJECT (dlg));
-}
-
-static void
-copy_theme_dialog_update_num_files (CopyThemeDialog *dlg) {
-    gchar *str = g_strdup_printf (_("Copying file: %u of %u"),
-                                  dlg->priv->index, dlg->priv->total_files);
-    gtk_progress_bar_set_text (GTK_PROGRESS_BAR (dlg->priv->progress), str);
-    g_free (str);
-}
-
-static void
-copy_theme_dialog_response (GtkDialog *dialog, gint response_id) {
-    g_cancellable_cancel (COPY_THEME_DIALOG (dialog)->priv->cancellable);
-}
-
-/**
- * eel_gtk_label_make_bold.
- *
- * Switches the font of label to a bold equivalent.
- * @label: The label.
- **/
-static void
-eel_gtk_label_make_bold (GtkLabel *label) {
-    PangoFontDescription *font_desc;
-    PangoAttrList        *attrlist;
-    PangoAttribute       *attr;
-
-    font_desc = pango_font_description_new ();
-    attrlist = pango_attr_list_new();
-
-    pango_font_description_set_weight (font_desc,
-                                       PANGO_WEIGHT_BOLD);
-    attr = pango_attr_font_desc_new(font_desc);
-    pango_font_description_free (font_desc);
-    pango_attr_list_insert (attrlist, attr);
-
-    /* This will only affect the weight of the font, the rest is
-     * from the current state of the widget, which comes from the
-     * theme or user prefs, since the font desc only has the
-     * weight flag turned on.
-     */
-    gtk_label_set_attributes (label, attrlist);
-    pango_attr_list_unref (attrlist);
-}
-
-/* from caja */
-static void
-create_titled_label (GtkGrid    *grid,
-                     int         row,
-                     GtkWidget **title_widget,
-                     GtkWidget **label_text_widget) {
-    *title_widget = gtk_label_new ("");
-    eel_gtk_label_make_bold (GTK_LABEL (*title_widget));
-    gtk_widget_set_halign (*title_widget, GTK_ALIGN_END);
-    gtk_widget_set_valign (*title_widget, GTK_ALIGN_START);
-
-    gtk_grid_attach (grid, *title_widget,
-                     0, row, 1, 1);
-    gtk_widget_show (*title_widget);
-
-    *label_text_widget = gtk_label_new ("");
-    gtk_label_set_ellipsize (GTK_LABEL (*label_text_widget), PANGO_ELLIPSIZE_END);
-    gtk_widget_set_hexpand (*label_text_widget, TRUE);
-    gtk_grid_attach (grid, *label_text_widget,
-                     1, row, 1, 1);
-    gtk_widget_show (*label_text_widget);
-    gtk_widget_set_halign (*label_text_widget, GTK_ALIGN_START);
-    gtk_widget_set_valign (*label_text_widget, GTK_ALIGN_START);
-}
diff --git a/src/copy-theme-dialog.h b/src/copy-theme-dialog.h
deleted file mode 100644
index f867e62..0000000
--- a/src/copy-theme-dialog.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* copy-theme-dialog.h
- * Copyright (C) 2008 John Millikin <jmillikin at gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301, USA.
-**/
-
-#ifndef SRC_COPY_THEME_DIALOG_H_
-#define SRC_COPY_THEME_DIALOG_H_
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define COPY_THEME_DIALOG_TYPE          copy_theme_dialog_get_type ()
-#define COPY_THEME_DIALOG(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, COPY_THEME_DIALOG_TYPE, CopyThemeDialog)
-#define COPY_THEME_DIALOG_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, COPY_THEME_DIALOG_TYPE, CopyThemeDialogClass)
-#define IS_COPY_THEME_DIALOG(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, COPY_THEME_DIALOG_TYPE)
-
-typedef struct _CopyThemeDialog         CopyThemeDialog;
-typedef struct _CopyThemeDialogClass    CopyThemeDialogClass;
-typedef struct _CopyThemeDialogPrivate  CopyThemeDialogPrivate;
-
-struct _CopyThemeDialog
-{
-    GtkDialog               dialog;
-    CopyThemeDialogPrivate *priv;
-};
-
-struct _CopyThemeDialogClass
-{
-    GtkDialogClass parent_class;
-
-    void (*cancelled) (CopyThemeDialog *dialog);
-    void (*complete)  (CopyThemeDialog *dialog);
-};
-
-GType       copy_theme_dialog_get_type (void);
-GtkWidget  *copy_theme_dialog_new      (GList *files);
-void        copy_theme_dialog_begin    (CopyThemeDialog *dialog);
-
-G_END_DECLS
-
-#endif /* SRC_COPY_THEME_DIALOG_H_ */
diff --git a/src/xfce4-screensaver-preferences.c b/src/xfce4-screensaver-preferences.c
index 08b3361..7d4aabb 100644
--- a/src/xfce4-screensaver-preferences.c
+++ b/src/xfce4-screensaver-preferences.c
@@ -39,7 +39,6 @@
 #include <libxfce4ui/libxfce4ui.h>
 #include <xfconf/xfconf.h>
 
-#include "copy-theme-dialog.h"
 #include "gs-debug.h"
 #include "gs-job.h"
 #include "gs-prefs.h" /* for GS_MODE enum */
@@ -61,11 +60,6 @@ enum {
     TARGET_NS_URL
 };
 
-static GtkTargetEntry drop_types[] = {
-    { "text/uri-list", 0, TARGET_URI_LIST },
-    { "_NETSCAPE_URL", 0, TARGET_NS_URL }
-};
-
 static GtkBuilder     *builder = NULL;
 static GSThemeManager *theme_manager = NULL;
 static GSJob          *job = NULL;
@@ -990,147 +984,6 @@ setup_treeview_selection (GtkWidget *tree) {
 }
 
 static void
-reload_themes (void) {
-    GtkWidget    *treeview;
-    GtkTreeModel *model;
-
-    treeview = GTK_WIDGET (gtk_builder_get_object (builder, "saver_themes_treeview"));
-    model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
-    gtk_tree_store_clear (GTK_TREE_STORE (model));
-    populate_model (GTK_TREE_STORE (model));
-
-    gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
-                             GTK_TREE_MODEL (model));
-}
-
-static void
-theme_copy_complete_cb (GtkWidget *dialog,
-                        gpointer   user_data) {
-    reload_themes ();
-    gtk_widget_destroy (dialog);
-}
-
-static void
-theme_installer_run (GtkWidget *prefs_dialog,
-                     GList     *files) {
-    GtkWidget *copy_dialog;
-
-    copy_dialog = copy_theme_dialog_new (files);
-    g_list_foreach (files, (GFunc) (g_object_unref), NULL);
-    g_list_free (files);
-
-    gtk_window_set_transient_for (GTK_WINDOW (copy_dialog),
-                                  GTK_WINDOW (prefs_dialog));
-    gtk_window_set_icon_name (GTK_WINDOW (copy_dialog),
-                              "preferences-desktop-screensaver");
-
-    g_signal_connect (copy_dialog, "complete",
-                      G_CALLBACK (theme_copy_complete_cb), NULL);
-
-    copy_theme_dialog_begin (COPY_THEME_DIALOG (copy_dialog));
-}
-
-/* Callback issued during drag movements */
-static gboolean
-drag_motion_cb (GtkWidget      *widget,
-                GdkDragContext *context,
-                int             x,
-                int             y,
-                guint           time,
-                gpointer        data) {
-    return FALSE;
-}
-
-/* Callback issued during drag leaves */
-static void
-drag_leave_cb (GtkWidget      *widget,
-               GdkDragContext *context,
-               guint           time,
-               gpointer        data) {
-    gtk_widget_queue_draw (widget);
-}
-
-/* GIO has no version of xfce_vfs_uri_list_parse(), so copy from XfceVFS
- * and re-work to create GFiles.
-**/
-static GList *
-uri_list_parse (const gchar *uri_list) {
-    const gchar *p, *q;
-    gchar       *retval;
-    GFile       *file;
-    GList       *result = NULL;
-
-    g_return_val_if_fail (uri_list != NULL, NULL);
-
-    p = uri_list;
-
-    /* We don't actually try to validate the URI according to RFC
-     * 2396, or even check for allowed characters - we just ignore
-     * comments and trim whitespace off the ends.  We also
-     * allow LF delimination as well as the specified CRLF.
-     */
-    while (p != NULL) {
-        if (*p != '#') {
-            while (g_ascii_isspace (*p))
-                p++;
-
-            q = p;
-            while ((*q != '\0')
-                    && (*q != '\n')
-                    && (*q != '\r'))
-                q++;
-
-            if (q > p) {
-                q--;
-                while (q > p
-                        && g_ascii_isspace (*q))
-                    q--;
-
-                retval = g_malloc (q - p + 2);
-                strncpy (retval, p, q - p + 1);
-                retval[q - p + 1] = '\0';
-
-                file = g_file_new_for_uri (retval);
-
-                g_free (retval);
-
-                if (file != NULL)
-                    result = g_list_prepend (result, file);
-            }
-        }
-        p = strchr (p, '\n');
-        if (p != NULL)
-            p++;
-    }
-
-    return g_list_reverse (result);
-}
-
-/* Callback issued on actual drops. Attempts to load the file dropped. */
-static void
-drag_data_received_cb (GtkWidget        *widget,
-                       GdkDragContext   *context,
-                       int               x,
-                       int               y,
-                       GtkSelectionData *selection_data,
-                       guint             info,
-                       guint             time,
-                       gpointer          data) {
-    GList     *files;
-
-    if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL))
-        return;
-
-    files = uri_list_parse ((char *) gtk_selection_data_get_data (selection_data));
-    if (files != NULL) {
-        GtkWidget *prefs_dialog;
-
-        prefs_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "prefs_dialog"));
-        theme_installer_run (prefs_dialog, files);
-    }
-}
-
-static void
 saver_toggled_cb (GtkSwitch *widget, gpointer user_data) {
     gboolean writable;
 
@@ -1876,7 +1729,6 @@ set_widget_writable (GtkWidget *widget,
 static void
 configure_capplet (void) {
     GtkWidget *dialog;
-    GtkWidget *plug_child;
     GtkWidget *preview;
     GtkWidget *treeview;
     GtkWidget *list_scroller;
@@ -1922,7 +1774,6 @@ configure_capplet (void) {
 
     preview                     = GTK_WIDGET (gtk_builder_get_object (builder, "saver_themes_preview_area"));
     dialog                      = GTK_WIDGET (gtk_builder_get_object (builder, "prefs_dialog"));
-    plug_child                  = GTK_WIDGET (gtk_builder_get_object (builder, "plug-child"));
     treeview                    = GTK_WIDGET (gtk_builder_get_object (builder, "saver_themes_treeview"));
     list_scroller               = GTK_WIDGET (gtk_builder_get_object (builder, "saver_themes_scrolled_window"));
     root_warning_infobar        = GTK_WIDGET (gtk_builder_get_object (builder, "root_warning_infobar"));
@@ -2085,17 +1936,6 @@ configure_capplet (void) {
                       "draw", G_CALLBACK (preview_on_draw),
                       NULL);
 
-    gtk_drag_dest_set (plug_child, GTK_DEST_DEFAULT_ALL,
-                       drop_types, G_N_ELEMENTS (drop_types),
-                       GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE);
-
-    g_signal_connect (plug_child, "drag-motion",
-                      G_CALLBACK (drag_motion_cb), NULL);
-    g_signal_connect (plug_child, "drag-leave",
-                      G_CALLBACK (drag_leave_cb), NULL);
-    g_signal_connect (plug_child, "drag-data-received",
-                      G_CALLBACK (drag_data_received_cb), NULL);
-
     /* Update list of themes if using random screensaver */
     mode = xfconf_channel_get_int (screensaver_channel, KEY_MODE, DEFAULT_KEY_MODE);
     if (mode == GS_MODE_RANDOM) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list