Initial step for refactoring of the DnD API for ShellComponents.
svn path=/trunk/; revision=8820
This commit is contained in:
@ -1,4 +1,21 @@
|
||||
2001-03-15 Pablo Saratxaga <pablo<6C>mandrakesoft.com>
|
||||
2001-03-19 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* e-storage-set-view.c (table_drag_data_get): Don't get the
|
||||
selection through
|
||||
`evolution_shell_component_client_get_dnd_selection()'.
|
||||
|
||||
* evolution-shell-component.c
|
||||
(impl_ShellComponent_getDndSelection): Removed.
|
||||
(class_init): Don't install.
|
||||
|
||||
* evolution-shell-component-client.c
|
||||
(evolution_shell_component_client_get_dnd_selection): Removed.
|
||||
|
||||
* Evolution-ShellComponentDnd.idl: New file with the DnD stuff.
|
||||
|
||||
* Evolution-ShellComponent.idl: Removed the dnd stuff.
|
||||
|
||||
2001-03-15 Pablo Saratxaga <pablo@mandrakesoft.com>
|
||||
|
||||
* main.c: fixed a no-c-format tag
|
||||
|
||||
|
@ -69,14 +69,6 @@ module Evolution {
|
||||
void populateFolderContextMenu (in Bonobo::UIContainer uih,
|
||||
in string physical_uri,
|
||||
in string type);
|
||||
|
||||
typedef sequence<octet> Selection;
|
||||
exception NoSelection {};
|
||||
|
||||
void getDndSelection (in string physical_uri, in short type,
|
||||
out short format,
|
||||
out Selection selection)
|
||||
raises (NoSelection);
|
||||
};
|
||||
|
||||
interface ShellComponentListener {
|
||||
|
92
shell/Evolution-ShellComponentDnd.idl
Normal file
92
shell/Evolution-ShellComponentDnd.idl
Normal file
@ -0,0 +1,92 @@
|
||||
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Interface for the Evolution components.
|
||||
*
|
||||
* Authors:
|
||||
* Ettore Perazzoli <ettore@helixcode.com>
|
||||
*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*/
|
||||
|
||||
#include <Bonobo.h>
|
||||
|
||||
module GNOME {
|
||||
module Evolution {
|
||||
module ShellComponentDnd {
|
||||
typedef short Action;
|
||||
const Action ACTION_DEFAULT = 0;
|
||||
const Action ACTION_COPY = 1 << 1;
|
||||
const Action ACTION_MOVE = 1 << 2;
|
||||
const Action ACTION_LINK = 1 << 3;
|
||||
const Action ACTION_ASK = 1 << 4;
|
||||
const Action ACTION_ANY = ACTION_COPY | ACTION_MOVE | ACTION_LINK | ACTION_ASK;
|
||||
|
||||
typedef Action ActionSet; // For readability.
|
||||
|
||||
struct Data {
|
||||
short format;
|
||||
short info;
|
||||
sequence <octet> bytes;
|
||||
};
|
||||
|
||||
exception NoData {};
|
||||
|
||||
interface SourceFolder {
|
||||
struct Context {
|
||||
string physical_uri;
|
||||
string folder_type;
|
||||
ActionSet possible_actions;
|
||||
Action suggested_action;
|
||||
};
|
||||
|
||||
/* The user started a drag from this object. If the component
|
||||
receives this while still in the middle of an existing drag
|
||||
operation, it should stop the existing drag operation and
|
||||
start a new one. */
|
||||
void beginDrag (in string physical_uri,
|
||||
in string folder_type,
|
||||
out ActionSet possible_actions,
|
||||
out Action suggested_action);
|
||||
|
||||
/* User released the mouse button and dropped the object
|
||||
somewhere, so we now want to get the data for the current
|
||||
context. */
|
||||
void getData (in Context source_context,
|
||||
in Action action,
|
||||
in string dnd_type,
|
||||
out Data data)
|
||||
raises (NoData);
|
||||
|
||||
/* The target has finished processing the data, so we can
|
||||
delete it. */
|
||||
void deleteData (in Context source_context);
|
||||
|
||||
/* The drag is over. */
|
||||
void endDrag (in Context source_context);
|
||||
};
|
||||
|
||||
interface DestinationFolder {
|
||||
struct Context {
|
||||
string dnd_type;
|
||||
ActionSet possible_actions;
|
||||
Action suggested_action;
|
||||
};
|
||||
|
||||
/* The user is moving a dragged object over our folder. This
|
||||
will return %FALSE if the specified object cannot be
|
||||
dropped; otherwise, it will return %TRUE and then set the
|
||||
@action we want to be performed when the drop happens. */
|
||||
boolean handleMotion (in Context destination_context,
|
||||
out Action default_action,
|
||||
out Action non_default_action);
|
||||
|
||||
/* Data is dropped. We are given the data for the dropped
|
||||
object, and we are supposed to perform the operation
|
||||
requested. */
|
||||
boolean handleDrop (in Context destination_context,
|
||||
in Action action,
|
||||
in Data data);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <Evolution-Session.idl>
|
||||
#include <Evolution-ShellComponent.idl>
|
||||
#include <Evolution-ShellComponentDnd.idl>
|
||||
#include <Evolution-ShellView.idl>
|
||||
#include <Evolution-Storage.idl>
|
||||
#include <Evolution-StorageSetView.idl>
|
||||
|
@ -22,6 +22,7 @@ IDLS = \
|
||||
Evolution-Session.idl \
|
||||
Evolution-Shell.idl \
|
||||
Evolution-ShellComponent.idl \
|
||||
Evolution-ShellComponentDnd.idl \
|
||||
Evolution-ShellView.idl \
|
||||
Evolution-Storage.idl \
|
||||
Evolution-StorageSetView.idl \
|
||||
|
@ -699,12 +699,14 @@ table_drag_data_get (ETable *etable,
|
||||
e_folder_get_type_string (folder));
|
||||
g_assert (component_client != NULL);
|
||||
|
||||
#if 0
|
||||
evolution_shell_component_client_get_dnd_selection (component_client,
|
||||
e_folder_get_physical_uri (folder),
|
||||
info,
|
||||
&format, &selection, &selection_length);
|
||||
if (selection == NULL)
|
||||
return;
|
||||
#endif
|
||||
|
||||
gtk_selection_data_set (selection_data, selection_data->target,
|
||||
format, selection, selection_length);
|
||||
|
@ -532,56 +532,6 @@ evolution_shell_component_client_populate_folder_context_menu (EvolutionShellCom
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
evolution_shell_component_client_get_dnd_selection (EvolutionShellComponentClient *shell_component_client,
|
||||
const char *physical_uri,
|
||||
int type,
|
||||
int *format_return,
|
||||
char **selection_return,
|
||||
int *selection_length_return)
|
||||
{
|
||||
EvolutionShellComponentClientPrivate *priv;
|
||||
GNOME_Evolution_ShellComponent corba_shell_component;
|
||||
CORBA_Environment ev;
|
||||
GNOME_Evolution_ShellComponent_Selection *corba_selection;
|
||||
CORBA_short format;
|
||||
|
||||
g_return_if_fail (shell_component_client != NULL);
|
||||
g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
|
||||
g_return_if_fail (physical_uri != NULL);
|
||||
|
||||
priv = shell_component_client->priv;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client));
|
||||
|
||||
GNOME_Evolution_ShellComponent_getDndSelection (corba_shell_component,
|
||||
physical_uri, type,
|
||||
&format, &corba_selection,
|
||||
&ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
*format_return = 0;
|
||||
*selection_return = NULL;
|
||||
*selection_length_return = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
*format_return = format;
|
||||
|
||||
/* We have to re-allocate the CORBA data using GLib because we cannot
|
||||
mix g_ memory management with CORBA_ memory management. Yes, this
|
||||
does suck. */
|
||||
*selection_return = g_malloc (corba_selection->_length);
|
||||
memcpy (*selection_return, corba_selection->_buffer, corba_selection->_length);
|
||||
*selection_length_return = corba_selection->_length;
|
||||
|
||||
CORBA_free (corba_selection);
|
||||
}
|
||||
|
||||
|
||||
E_MAKE_TYPE (evolution_shell_component_client, "EvolutionShellComponentClient",
|
||||
EvolutionShellComponentClient, class_init, init, PARENT_TYPE)
|
||||
|
@ -94,14 +94,6 @@ void evolution_shell_component_client_populate_folder_context_menu (EvolutionS
|
||||
const char *physical_uri,
|
||||
const char *type);
|
||||
|
||||
/* DND stuff. */
|
||||
void evolution_shell_component_client_get_dnd_selection (EvolutionShellComponentClient *shell_component_client,
|
||||
const char *physical_uri,
|
||||
int type,
|
||||
int *format_return,
|
||||
char **selection_return,
|
||||
int *selection_length_return);
|
||||
|
||||
#ifdef cplusplus
|
||||
}
|
||||
#endif /* cplusplus */
|
||||
|
@ -367,53 +367,6 @@ impl_ShellComponent_populate_folder_context_menu (PortableServer_Servant servant
|
||||
bonobo_object_unref (BONOBO_OBJECT (uic));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_ShellComponent_getDndSelection (PortableServer_Servant servant,
|
||||
const CORBA_char *physical_uri,
|
||||
const CORBA_short type,
|
||||
CORBA_short *format_return,
|
||||
GNOME_Evolution_ShellComponent_Selection **selection_return,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
BonoboObject *bonobo_object;
|
||||
EvolutionShellComponent *shell_component;
|
||||
EvolutionShellComponentPrivate *priv;
|
||||
const char *selection;
|
||||
int selection_length;
|
||||
int format;
|
||||
|
||||
bonobo_object = bonobo_object_from_servant (servant);
|
||||
shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
|
||||
priv = shell_component->priv;
|
||||
|
||||
if (priv->get_dnd_selection_fn == NULL) {
|
||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||
ex_GNOME_Evolution_ShellComponent_NoSelection, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
(* priv->get_dnd_selection_fn) (shell_component, physical_uri, type,
|
||||
&format, &selection, &selection_length,
|
||||
priv->closure);
|
||||
|
||||
if (selection == NULL) {
|
||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||
ex_GNOME_Evolution_ShellComponent_NoSelection, NULL);
|
||||
} else {
|
||||
*format_return = format;
|
||||
|
||||
*selection_return = GNOME_Evolution_ShellComponent_Selection__alloc ();
|
||||
|
||||
(* selection_return)->_buffer = CORBA_octet_allocbuf (selection_length);
|
||||
memcpy ((* selection_return)->_buffer, selection, selection_length);
|
||||
|
||||
(* selection_return)->_length = selection_length;
|
||||
(* selection_return)->_maximum = selection_length;
|
||||
|
||||
CORBA_sequence_set_release (*selection_return, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* GtkObject methods. */
|
||||
|
||||
@ -495,7 +448,6 @@ class_init (EvolutionShellComponentClass *klass)
|
||||
epv->createFolderAsync = impl_ShellComponent_async_create_folder;
|
||||
epv->removeFolderAsync = impl_ShellComponent_async_remove_folder;
|
||||
epv->populateFolderContextMenu = impl_ShellComponent_populate_folder_context_menu;
|
||||
epv->getDndSelection = impl_ShellComponent_getDndSelection;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user