Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xfce4-panel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xfce
xfce4-panel
Commits
4d23e9c8
Commit
4d23e9c8
authored
15 years ago
by
Nick Schermer
Browse files
Options
Downloads
Patches
Plain Diff
Add drags from the add dialog.
parent
fd90637d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/launcher/launcher-dialog.c
+57
-2
57 additions, 2 deletions
plugins/launcher/launcher-dialog.c
with
57 additions
and
2 deletions
plugins/launcher/launcher-dialog.c
+
57
−
2
View file @
4d23e9c8
...
...
@@ -76,7 +76,7 @@ static void launcher_dialog_items_load (LauncherPluginDialog *dialog);
/* dnd for items in and from the treeviews */
static
const
GtkTargetEntry
d
rop
_targets
[]
=
static
const
GtkTargetEntry
d
nd
_targets
[]
=
{
{
"text/uri-list"
,
0
,
0
,
},
};
...
...
@@ -229,6 +229,51 @@ launcher_dialog_add_populate_model (LauncherPluginDialog *dialog)
static
void
launcher_dialog_add_drag_data_get
(
GtkWidget
*
treeview
,
GdkDragContext
*
drag_context
,
GtkSelectionData
*
data
,
guint
info
,
guint
timestamp
,
LauncherPluginDialog
*
dialog
)
{
GtkTreeSelection
*
selection
;
GList
*
rows
,
*
li
;
GtkTreeModel
*
model
;
gchar
**
uris
;
GarconMenuItem
*
item
;
guint
i
;
GtkTreeIter
iter
;
panel_return_if_fail
(
GTK_IS_BUILDER
(
dialog
->
builder
));
panel_return_if_fail
(
GTK_IS_TREE_VIEW
(
treeview
));
selection
=
gtk_tree_view_get_selection
(
GTK_TREE_VIEW
(
treeview
));
rows
=
gtk_tree_selection_get_selected_rows
(
selection
,
&
model
);
if
(
G_UNLIKELY
(
rows
==
NULL
))
return
;
uris
=
g_new0
(
gchar
*
,
g_list_length
(
rows
)
+
1
);
for
(
li
=
rows
,
i
=
0
;
li
!=
NULL
;
li
=
li
->
next
)
{
if
(
!
gtk_tree_model_get_iter
(
model
,
&
iter
,
li
->
data
))
continue
;
gtk_tree_model_get
(
model
,
&
iter
,
COL_ITEM
,
&
item
,
-
1
);
if
(
G_UNLIKELY
(
item
==
NULL
))
continue
;
uris
[
i
++
]
=
garcon_menu_item_get_uri
(
item
);
g_object_unref
(
G_OBJECT
(
item
));
}
gtk_selection_data_set_uris
(
data
,
uris
);
g_list_free
(
rows
);
g_strfreev
(
uris
);
}
static
void
launcher_dialog_add_selection_changed
(
GtkTreeSelection
*
selection
,
LauncherPluginDialog
*
dialog
)
...
...
@@ -657,6 +702,8 @@ launcher_dialog_response (GtkWidget *widget,
gint
response_id
,
LauncherPluginDialog
*
dialog
)
{
GObject
*
add_dialog
;
panel_return_if_fail
(
GTK_IS_DIALOG
(
widget
));
panel_return_if_fail
(
XFCE_IS_LAUNCHER_PLUGIN
(
dialog
->
plugin
));
panel_return_if_fail
(
GTK_IS_BUILDER
(
dialog
->
builder
));
...
...
@@ -678,6 +725,10 @@ launcher_dialog_response (GtkWidget *widget,
/* disconnect from the menu items */
launcher_dialog_items_unload
(
dialog
);
/* also destroy the add dialog */
add_dialog
=
gtk_builder_get_object
(
dialog
->
builder
,
"dialog-add"
);
gtk_widget_destroy
(
GTK_WIDGET
(
add_dialog
));
/* destroy the dialog */
gtk_widget_destroy
(
widget
);
...
...
@@ -874,7 +925,7 @@ launcher_dialog_show (LauncherPlugin *plugin)
object
=
gtk_builder_get_object
(
builder
,
"item-treeview"
);
selection
=
gtk_tree_view_get_selection
(
GTK_TREE_VIEW
(
object
));
gtk_tree_view_enable_model_drag_dest
(
GTK_TREE_VIEW
(
object
),
d
rop
_targets
,
G_N_ELEMENTS
(
d
rop
_targets
),
GDK_ACTION_COPY
);
d
nd
_targets
,
G_N_ELEMENTS
(
d
nd
_targets
),
GDK_ACTION_COPY
);
gtk_tree_selection_set_mode
(
selection
,
GTK_SELECTION_BROWSE
);
g_signal_connect
(
G_OBJECT
(
object
),
"drag-data-received"
,
G_CALLBACK
(
launcher_dialog_tree_drag_data_received
),
dialog
);
...
...
@@ -905,6 +956,10 @@ launcher_dialog_show (LauncherPlugin *plugin)
/* allow selecting multiple items in the add dialog */
object
=
gtk_builder_get_object
(
builder
,
"add-treeview"
);
gtk_drag_source_set
(
GTK_WIDGET
(
object
),
GDK_BUTTON1_MASK
,
dnd_targets
,
G_N_ELEMENTS
(
dnd_targets
),
GDK_ACTION_COPY
);
g_signal_connect
(
G_OBJECT
(
object
),
"drag-data-get"
,
G_CALLBACK
(
launcher_dialog_add_drag_data_get
),
dialog
);
selection
=
gtk_tree_view_get_selection
(
GTK_TREE_VIEW
(
object
));
gtk_tree_selection_set_mode
(
selection
,
GTK_SELECTION_MULTIPLE
);
g_signal_connect
(
G_OBJECT
(
selection
),
"changed"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment