[gnome-panel/wip/muktupavels/remove-drag-source: 1/4] launcher: remove x-panel-icon-internal drag & drop target
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/muktupavels/remove-drag-source: 1/4] launcher: remove x-panel-icon-internal drag & drop target
- Date: Sun, 12 Apr 2020 20:21:41 +0000 (UTC)
commit 23c20268652b0b71caed66e75b0c8053369052d5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Apr 12 21:51:07 2020 +0300
launcher: remove x-panel-icon-internal drag & drop target
Drag & drop to create launcher copy does not seem very useful
feature. Moving makes more sense, but... Launcher is not really
moved, new one is created and old one deleted. And it does not
allow to reorder lauchers and/or applets.
As bonus, launcher that will be deleted is found only by looking at
location setting. Multiple launchers can have same location meaning
that wrong launcher can be removed.
gnome-panel/launcher.c | 71 +-------------------------------------------------
gnome-panel/launcher.h | 7 -----
gnome-panel/panel.c | 49 +---------------------------------
3 files changed, 2 insertions(+), 125 deletions(-)
---
diff --git a/gnome-panel/launcher.c b/gnome-panel/launcher.c
index ed6378e35..2afba97d4 100644
--- a/gnome-panel/launcher.c
+++ b/gnome-panel/launcher.c
@@ -569,11 +569,9 @@ drag_drop_cb (GtkWidget *widget,
}
enum {
- TARGET_ICON_INTERNAL,
TARGET_URI_LIST
};
-
static void
drag_data_get_cb (GtkWidget *widget,
GdkDragContext *context,
@@ -597,12 +595,7 @@ drag_data_get_cb (GtkWidget *widget,
gtk_selection_data_set_uris (selection_data, uri);
g_free (uri[0]);
- } else if (info == TARGET_ICON_INTERNAL)
- gtk_selection_data_set (selection_data,
- gtk_selection_data_get_target (selection_data), 8,
- (unsigned char *) location,
- strlen (location));
-
+ }
}
static Launcher *
@@ -1227,65 +1220,6 @@ panel_launcher_create (PanelToplevel *toplevel,
location);
}
-gboolean
-panel_launcher_create_copy (PanelToplevel *toplevel,
- PanelObjectPackType pack_type,
- int pack_index,
- const char *location)
-{
- char *new_location;
- GFile *source;
- GFile *dest;
- gboolean copied;
- const char *filename;
-
- new_location = panel_make_unique_desktop_uri (NULL, location);
-
- source = panel_launcher_get_gfile (location);
- dest = g_file_new_for_uri (new_location);
-
- copied = g_file_copy (source, dest, G_FILE_COPY_OVERWRITE,
- NULL, NULL, NULL, NULL);
-
- if (!copied) {
- g_free (new_location);
- return FALSE;
- }
-
- filename = panel_launcher_get_filename (new_location);
- panel_launcher_create (toplevel, pack_type, pack_index, filename);
- g_free (new_location);
-
- return TRUE;
-}
-
-Launcher *
-find_launcher (const char *path)
-{
- GSList *l;
-
- g_return_val_if_fail (path != NULL, NULL);
-
- for (l = panel_applet_list_applets (); l; l = l->next) {
- AppletInfo *info = l->data;
- Launcher *launcher;
-
- if (info->type != PANEL_OBJECT_LAUNCHER)
- continue;
-
- launcher = info->data;
-
- if (launcher->key_file == NULL)
- continue;
-
- if (launcher->location != NULL &&
- strcmp (launcher->location, path) == 0)
- return launcher;
- }
-
- return NULL;
-}
-
void
panel_launcher_set_dnd_enabled (Launcher *launcher,
gboolean dnd_enabled)
@@ -1294,7 +1228,6 @@ panel_launcher_set_dnd_enabled (Launcher *launcher,
if (dnd_enabled) {
static GtkTargetEntry dnd_targets[] = {
- { (gchar *) "application/x-panel-icon-internal", 0, TARGET_ICON_INTERNAL },
{ (gchar *) "text/uri-list", 0, TARGET_URI_LIST }
};
@@ -1311,8 +1244,6 @@ panel_launcher_set_dnd_enabled (Launcher *launcher,
g_object_unref (pixbuf);
}
gtk_widget_set_has_window (launcher->button, FALSE);
-
-
} else
gtk_drag_source_unset (launcher->button);
}
diff --git a/gnome-panel/launcher.h b/gnome-panel/launcher.h
index 350b7bd8a..41e94a01c 100644
--- a/gnome-panel/launcher.h
+++ b/gnome-panel/launcher.h
@@ -33,10 +33,6 @@ void panel_launcher_create (PanelToplevel *toplevel,
PanelObjectPackType pack_type,
int pack_index,
const char *location);
-gboolean panel_launcher_create_copy (PanelToplevel *toplevel,
- PanelObjectPackType pack_type,
- int pack_index,
- const char *location);
void panel_launcher_create_from_info (PanelToplevel *toplevel,
PanelObjectPackType pack_type,
int pack_index,
@@ -61,14 +57,11 @@ void ask_about_launcher (const char *file,
PanelWidget *panel,
PanelObjectPackType pack_type);
-Launcher * find_launcher (const char *path);
-
void launcher_properties_destroy (Launcher *launcher);
void panel_launcher_set_dnd_enabled (Launcher *launcher,
gboolean dnd_enabled);
-
G_END_DECLS
#endif
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index 2016fb563..2d04b3906 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -54,7 +54,6 @@ enum {
TARGET_COLOR,
TARGET_APPLET,
TARGET_APPLET_INTERNAL,
- TARGET_ICON_INTERNAL,
TARGET_BGIMAGE,
TARGET_BACKGROUND_RESET
};
@@ -684,44 +683,6 @@ drop_urilist (PanelWidget *panel,
return success;
}
-static gboolean
-drop_internal_icon (PanelWidget *panel,
- PanelObjectPackType pack_type,
- int pack_index,
- const char *icon_name,
- int action)
-{
- Launcher *old_launcher = NULL;
-
- if (!icon_name)
- return FALSE;
-
- if (!panel_layout_is_writable ())
- return FALSE;
-
- if (action == GDK_ACTION_MOVE)
- old_launcher = find_launcher (icon_name);
-
- if (!panel_launcher_create_copy (panel->toplevel, pack_type, pack_index,
- icon_name))
- return FALSE;
-
- if (old_launcher && old_launcher->button) {
- const char *object_id;
-
- if (old_launcher->prop_dialog) {
- g_signal_handler_disconnect (old_launcher->button,
- old_launcher->destroy_handler);
- launcher_properties_destroy (old_launcher);
- }
-
- object_id = panel_applet_get_id (old_launcher->info);
- panel_layout_delete_object (object_id);
- }
-
- return TRUE;
-}
-
static gboolean
drop_internal_applet (PanelWidget *panel,
PanelObjectPackType pack_type,
@@ -784,7 +745,6 @@ get_target_list (void)
{ (gchar *) "application/x-panel-directory", 0, TARGET_DIRECTORY },
{ (gchar *) "application/x-panel-applet-iid", 0, TARGET_APPLET },
{ (gchar *) "application/x-panel-applet-internal", 0, TARGET_APPLET_INTERNAL },
- { (gchar *) "application/x-panel-icon-internal", 0, TARGET_ICON_INTERNAL },
{ (gchar *) "application/x-color", 0, TARGET_COLOR },
{ (gchar *) "property/bgimage", 0, TARGET_BGIMAGE },
{ (gchar *) "x-special/gnome-reset-background", 0, TARGET_BACKGROUND_RESET },
@@ -874,8 +834,7 @@ panel_check_drop_forbidden (PanelWidget *panel,
if (panel_lockdown_get_panels_locked_down_s ())
return FALSE;
- if (info == TARGET_ICON_INTERNAL ||
- info == TARGET_APPLET_INTERNAL) {
+ if (info == TARGET_APPLET_INTERNAL) {
if (gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE)
gdk_drag_status (context, GDK_ACTION_MOVE, time_);
else
@@ -891,7 +850,6 @@ panel_check_drop_forbidden (PanelWidget *panel,
time_);
return TRUE;
-
}
static gboolean
@@ -1103,11 +1061,6 @@ panel_receive_dnd_data (PanelWidget *panel,
(char *)data,
gdk_drag_context_get_selected_action (context));
break;
- case TARGET_ICON_INTERNAL:
- success = drop_internal_icon (panel, pack_type, pack_index,
- (char *)data,
- gdk_drag_context_get_selected_action (context));
- break;
default:
gtk_drag_finish (context, FALSE, FALSE, time_);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]