Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
0183746e
Commit
0183746e
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #10736: calltree: refactor drop_into code into its own function
parent
37e38588
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gnome/src/contacts/calltree.c
+66
-59
66 additions, 59 deletions
gnome/src/contacts/calltree.c
with
66 additions
and
59 deletions
gnome/src/contacts/calltree.c
+
66
−
59
View file @
0183746e
...
@@ -1167,66 +1167,37 @@ static void cleanup_popup_data(PopupData **data)
...
@@ -1167,66 +1167,37 @@ static void cleanup_popup_data(PopupData **data)
}
}
static
gboolean
try_detach
(
const
gchar
*
source_ID
,
GtkTreeModel
*
model
,
GtkTreeIter
*
dest_iter
)
static
gboolean
try_detach
(
GtkTreeModel
*
model
,
GtkTreeIter
*
source_iter
,
GtkTreeIter
*
dest_iter
)
{
{
GValue
source_val
=
G_VALUE_INIT
;
gtk_tree_model_get_value
(
model
,
source_iter
,
COLUMN_ID
,
&
source_val
);
const
gchar
*
source_ID
=
g_value_get_string
(
&
source_val
);
callable_obj_t
*
source_call
=
calllist_get_call
(
current_calls_tab
,
source_ID
);
callable_obj_t
*
source_call
=
calllist_get_call
(
current_calls_tab
,
source_ID
);
gboolean
result
=
FALSE
;
GtkTreeIter
iter_parent
;
GtkTreeIter
iter_parent
;
if
(
source_call
&&
source_call
->
_confID
&&
if
(
source_call
&&
source_call
->
_confID
&&
!
gtk_tree_model_iter_parent
(
model
,
&
iter_parent
,
dest_iter
))
{
!
gtk_tree_model_iter_parent
(
model
,
&
iter_parent
,
dest_iter
))
{
sflphone_detach_participant
(
source_ID
);
sflphone_detach_participant
(
source_ID
);
return
TRUE
;
result
=
TRUE
;
}
else
{
return
FALSE
;
}
}
g_value_unset
(
&
source_val
);
return
result
;
}
}
static
gboolean
static
gboolean
render_drop
(
GtkTreeModel
*
model
,
GtkTreePath
*
dest_path
,
GtkTreeViewDropPosition
dest_pos
,
handle_drop_into
(
GtkTreeModel
*
model
,
GtkTreeIter
*
source_iter
,
GtkTreeIter
*
dest_iter
)
GtkTreeIter
*
source_iter
)
{
{
GtkTreeIter
dest_iter
;
if
(
!
gtk_tree_model_get_iter
(
model
,
&
dest_iter
,
dest_path
))
{
ERROR
(
"Could not set dest iter"
);
return
FALSE
;
}
GtkTreePath
*
source_path
=
gtk_tree_model_get_path
(
model
,
source_iter
);
if
(
!
gtk_tree_path_compare
(
source_path
,
dest_path
))
{
ERROR
(
"invalid drop: source and dest are same"
);
gtk_tree_path_free
(
source_path
);
return
FALSE
;
}
else
if
(
gtk_tree_path_is_ancestor
(
source_path
,
dest_path
))
{
ERROR
(
"invalid drop: source is ancestor of dest"
);
gtk_tree_path_free
(
source_path
);
return
FALSE
;
}
else
if
(
gtk_tree_path_is_descendant
(
source_path
,
dest_path
))
{
ERROR
(
"invalid drop: source is descendant of dest"
);
gtk_tree_path_free
(
source_path
);
return
FALSE
;
}
gtk_tree_path_free
(
source_path
);
GValue
dest_val
=
G_VALUE_INIT
;
gtk_tree_model_get_value
(
model
,
&
dest_iter
,
COLUMN_ID
,
&
dest_val
);
const
gchar
*
dest_ID
=
g_value_get_string
(
&
dest_val
);
GValue
source_val
=
G_VALUE_INIT
;
GValue
source_val
=
G_VALUE_INIT
;
gtk_tree_model_get_value
(
model
,
source_iter
,
COLUMN_ID
,
&
source_val
);
gtk_tree_model_get_value
(
model
,
source_iter
,
COLUMN_ID
,
&
source_val
);
const
gchar
*
source_ID
=
g_value_get_string
(
&
source_val
);
const
gchar
*
source_ID
=
g_value_get_string
(
&
source_val
);
gboolean
result
;
GValue
dest_val
=
G_VALUE_INIT
;
switch
(
dest_pos
)
{
gtk_tree_model_get_value
(
model
,
dest_iter
,
COLUMN_ID
,
&
dest_val
);
case
GTK_TREE_VIEW_DROP_BEFORE
:
const
gchar
*
dest_ID
=
g_value_get_string
(
&
dest_val
);
DEBUG
(
"DROP_BEFORE, detaching if appropriate"
);
result
=
try_detach
(
source_ID
,
model
,
&
dest_iter
);
break
;
case
GTK_TREE_VIEW_DROP_INTO_OR_BEFORE
:
/* fallthrough */
case
GTK_TREE_VIEW_DROP_INTO_OR_AFTER
:
{
DEBUG
(
"DROP_INTO"
);
GtkTreeIter
iter_parent
;
GtkTreeIter
iter_parent
;
if
(
!
gtk_tree_model_iter_parent
(
model
,
&
iter_parent
,
&
dest_iter
))
{
gboolean
result
=
FALSE
;
if
(
is_conference
(
model
,
&
dest_iter
))
{
if
(
!
gtk_tree_model_iter_parent
(
model
,
&
iter_parent
,
dest_iter
))
{
if
(
is_conference
(
model
,
dest_iter
))
{
if
(
is_conference
(
model
,
source_iter
))
{
if
(
is_conference
(
model
,
source_iter
))
{
DEBUG
(
"dropped conference on conference, merging conferences"
);
DEBUG
(
"dropped conference on conference, merging conferences"
);
dbus_join_conference
(
source_ID
,
dest_ID
);
dbus_join_conference
(
source_ID
,
dest_ID
);
...
@@ -1260,22 +1231,58 @@ render_drop(GtkTreeModel *model, GtkTreePath *dest_path, GtkTreeViewDropPosition
...
@@ -1260,22 +1231,58 @@ render_drop(GtkTreeModel *model, GtkTreePath *dest_path, GtkTreeViewDropPosition
result
=
TRUE
;
result
=
TRUE
;
}
}
}
}
result
=
FALSE
;
g_value_unset
(
&
source_val
);
break
;
g_value_unset
(
&
dest_val
);
return
result
;
}
}
case
GTK_TREE_VIEW_DROP_AFTER
:
static
gboolean
render_drop
(
GtkTreeModel
*
model
,
GtkTreePath
*
dest_path
,
GtkTreeViewDropPosition
dest_pos
,
GtkTreeIter
*
source_iter
)
{
{
GtkTreeIter
dest_iter
;
if
(
!
gtk_tree_model_get_iter
(
model
,
&
dest_iter
,
dest_path
))
{
ERROR
(
"Could not set dest iter"
);
return
FALSE
;
}
GtkTreePath
*
source_path
=
gtk_tree_model_get_path
(
model
,
source_iter
);
if
(
!
gtk_tree_path_compare
(
source_path
,
dest_path
))
{
ERROR
(
"invalid drop: source and dest are same"
);
gtk_tree_path_free
(
source_path
);
return
FALSE
;
}
else
if
(
gtk_tree_path_is_ancestor
(
source_path
,
dest_path
))
{
ERROR
(
"invalid drop: source is ancestor of dest"
);
gtk_tree_path_free
(
source_path
);
return
FALSE
;
}
else
if
(
gtk_tree_path_is_descendant
(
source_path
,
dest_path
))
{
ERROR
(
"invalid drop: source is descendant of dest"
);
gtk_tree_path_free
(
source_path
);
return
FALSE
;
}
gtk_tree_path_free
(
source_path
);
gboolean
result
;
switch
(
dest_pos
)
{
case
GTK_TREE_VIEW_DROP_BEFORE
:
DEBUG
(
"DROP_BEFORE, detaching if appropriate"
);
result
=
try_detach
(
model
,
source_iter
,
&
dest_iter
);
break
;
case
GTK_TREE_VIEW_DROP_INTO_OR_BEFORE
:
/* fallthrough */
case
GTK_TREE_VIEW_DROP_INTO_OR_AFTER
:
DEBUG
(
"DROP_INTO"
);
result
=
handle_drop_into
(
model
,
source_iter
,
&
dest_iter
);
break
;
case
GTK_TREE_VIEW_DROP_AFTER
:
DEBUG
(
"DROP_AFTER, detaching if appropriate"
);
DEBUG
(
"DROP_AFTER, detaching if appropriate"
);
result
=
try_detach
(
source_ID
,
model
,
&
dest_iter
);
result
=
try_detach
(
model
,
source_iter
,
&
dest_iter
);
break
;
break
;
}
default:
default:
ERROR
(
"Unexpected position"
);
ERROR
(
"Unexpected position"
);
result
=
FALSE
;
result
=
FALSE
;
break
;
break
;
}
}
g_value_unset
(
&
dest_val
);
g_value_unset
(
&
source_val
);
return
result
;
return
result
;
}
}
...
...
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