#include "give_drag_and_drop.h"#include "give_bluetooth.h"#include "give_ebook.h"#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <dbus/dbus-glib.h>#include <locale.h>#include <libintl.h>

Go to the source code of this file.
Classes | |
| struct | _give_drag_and_drop_private |
| Struct of private members of give_bluetooth. More... | |
Defines | |
| #define | _(String) gettext(String) |
| #define | GIVE_DRAG_AND_DROP_GET_PRIVATE(obj) |
| #define | TEMP_DIR "/tmp" |
Bluez | |
| #define | BLUEZ_DBUS_SERVICE "org.bluez" |
| #define | BLUEZ_DBUS_PATH "/org/bluez/hci0" |
| #define | BLUEZ_DBUS_INTERFACE "org.bluez.Adapter" |
| #define | BLUEZ_DBUS_SET_MODE "SetMode" |
| #define | BLUEZ_DBUS_MESSAGE "connectable" |
Accepted d&d types | |
| #define | PLAIN_TEXT_TYPE "text/plain" |
| #define | URI_LIST_TYPE "text/uri-list" |
| #define | CALENDAR_EVENT_TYPE "application/x-e-calendar-event" |
| #define | CONTACT_LIST_TYPE "x-osso-contact-list" |
| #define | TREE_ROW_TYPE "GTK_TREE_MODEL_ROW" |
| #define | TREE_AS_STRING_TYPE "text/tree-path-as-string-list" |
| #define | MODEST_EMAIL_TYPE "text/modest-email" |
Typedefs | |
| typedef struct _give_drag_and_drop_private | give_drag_and_drop_private |
Enumerations | |
| enum | { PLAIN_TEXT, URI_LIST, CALENDAR_EVENT, CONTACT_LIST, TREE_ROW, TREE_AS_STRING, MODEST_EMAIL } |
Functions | |
Private functions | |
| GType | give_drag_and_drop_get_type (void) |
| Registers the give_drag_and_drop type statically. | |
| static void | give_drag_and_drop_class_init (give_drag_and_dropClass *klass) |
| Overrites the class finalize function and adds the private structure. | |
| static void | give_drag_and_drop_init (give_drag_and_drop *self) |
| Connects to DBus and instantiates give_bluetooth and give_ebook. | |
| static void | give_drag_and_drop_finalize (GObject *self) |
| Unsets the widget as d&d destination, unrefs objects. | |
| give_drag_and_drop * | give_drag_and_drop_new (GtkWidget *widget) |
| Creates a new instance of give_drag_and_drop. | |
| static void | give_drag_and_drop_set_dest (give_drag_and_drop *self, GtkWidget *widget) |
| Sets the parameter widget a d&d destination. | |
| void | give_drag_and_drop_have_bt (give_drag_and_drop *self, gboolean setting) |
| Sets _give_drag_and_drop_private::bt_is_on. | |
| gboolean | give_drag_and_drop_turn_bt_on_dialog (give_drag_and_drop *self) |
| Confirmation dialog whether to turn on the Bluetooth adapter or not. | |
Public functions | |
| static GtkWidget * | give_drag_and_drop_create_dialog (give_drag_and_drop *self, const guint info, const gchar *text, guint *file_count, GtkWidget **entry) |
| Creates a confirmation dialog with whether to send the data or not. | |
| static int | give_drag_and_drop_run_dialog (give_drag_and_drop *self, GtkWidget *dialog, const guint info, const gchar *text, const guint file_count, gchar ***files, const GtkWidget *entry) |
| Runs the dialog created by give_drag_and_drop_create_dialog. | |
| static void | give_drag_and_drop_send (give_drag_and_drop *self, const guint info, const gchar *text) |
| Creates a confirmation dialog and send the files. | |
| static void | give_drag_and_drop_drag_recieved (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint32 time, gpointer user_data) |
| Handles the "drag_data_received" signal. | |
Variables | |
| const GtkTargetEntry | drop_types [] |
| Accepted d&d types. | |
Definition in file give_drag_and_drop.c.
| #define _ | ( | String | ) | gettext(String) |
Definition at line 43 of file give_drag_and_drop.c.
Referenced by give_drag_and_drop_create_dialog(), give_drag_and_drop_turn_bt_on_dialog(), give_statusbar_plugin_about_dialog(), give_statusbar_plugin_clicked(), give_statusbar_plugin_item_clicked(), give_statusbar_plugin_pand_dialog(), give_statusbar_plugin_start_pand(), and give_statusbar_plugin_stop_pand().
| #define BLUEZ_DBUS_INTERFACE "org.bluez.Adapter" |
| #define BLUEZ_DBUS_MESSAGE "connectable" |
Definition at line 78 of file give_drag_and_drop.c.
Referenced by give_drag_and_drop_turn_bt_on_dialog().
| #define BLUEZ_DBUS_PATH "/org/bluez/hci0" |
| #define BLUEZ_DBUS_SERVICE "org.bluez" |
| #define BLUEZ_DBUS_SET_MODE "SetMode" |
Definition at line 77 of file give_drag_and_drop.c.
Referenced by give_drag_and_drop_turn_bt_on_dialog().
| #define CALENDAR_EVENT_TYPE "application/x-e-calendar-event" |
Definition at line 88 of file give_drag_and_drop.c.
| #define CONTACT_LIST_TYPE "x-osso-contact-list" |
Definition at line 89 of file give_drag_and_drop.c.
| #define GIVE_DRAG_AND_DROP_GET_PRIVATE | ( | obj | ) |
Value:
(G_TYPE_INSTANCE_GET_PRIVATE ((obj),\
GIVE_DRAG_AND_DROP_TYPE, \
give_drag_and_drop_private));
Definition at line 47 of file give_drag_and_drop.c.
Referenced by give_drag_and_drop_create_dialog(), give_drag_and_drop_drag_recieved(), give_drag_and_drop_finalize(), give_drag_and_drop_have_bt(), give_drag_and_drop_init(), give_drag_and_drop_run_dialog(), give_drag_and_drop_send(), give_drag_and_drop_set_dest(), and give_drag_and_drop_turn_bt_on_dialog().
| #define MODEST_EMAIL_TYPE "text/modest-email" |
Definition at line 93 of file give_drag_and_drop.c.
| #define PLAIN_TEXT_TYPE "text/plain" |
Definition at line 86 of file give_drag_and_drop.c.
| #define TEMP_DIR "/tmp" |
| #define TREE_AS_STRING_TYPE "text/tree-path-as-string-list" |
Definition at line 92 of file give_drag_and_drop.c.
| #define TREE_ROW_TYPE "GTK_TREE_MODEL_ROW" |
Definition at line 91 of file give_drag_and_drop.c.
| #define URI_LIST_TYPE "text/uri-list" |
Definition at line 87 of file give_drag_and_drop.c.
| typedef struct _give_drag_and_drop_private give_drag_and_drop_private |
Definition at line 45 of file give_drag_and_drop.c.
| anonymous enum |
Definition at line 99 of file give_drag_and_drop.c.
| static void give_drag_and_drop_class_init | ( | give_drag_and_dropClass * | klass | ) | [static] |
Overrites the class finalize function and adds the private structure.
Sets give_drag_and_drop_finalize as the class' finalize function.
Registers the give_drag_and_drop_private structure as private member.
| klass | a give_drag_and_dropClass. |
Definition at line 214 of file give_drag_and_drop.c.
References give_drag_and_drop_finalize().
Referenced by give_drag_and_drop_get_type().


| static GtkWidget * give_drag_and_drop_create_dialog | ( | give_drag_and_drop * | self, | |
| const guint | info, | |||
| const gchar * | text, | |||
| guint * | file_count, | |||
| GtkWidget ** | entry | |||
| ) | [static] |
Creates a confirmation dialog with whether to send the data or not.
The created dialog will be run by give_drag_and_drop_run_dialog.
The dialog contains the filenames.
| self | A give_drag_and_drop object. | |
| info | The type of the dragged data. | |
| text | The dragged data. | |
| file_count | Number of files or contacs processed. Used later for memory allocation. | |
| entry | Pointer to the file name entry in the text and calendar ceses. Used by give_drag_and_drop_run_dialog to get the value. |
Definition at line 405 of file give_drag_and_drop.c.
References _, CALENDAR_EVENT, CONTACT_LIST, GIVE_DRAG_AND_DROP_GET_PRIVATE, GIVE_DRAG_AND_DROP_IS_OBJECT, give_ebook_get_contact_name(), _give_drag_and_drop_private::give_ebook_object, PLAIN_TEXT, and URI_LIST.
Referenced by give_drag_and_drop_send().


| static void give_drag_and_drop_drag_recieved | ( | GtkWidget * | widget, | |
| GdkDragContext * | context, | |||
| gint | x, | |||
| gint | y, | |||
| GtkSelectionData * | selection_data, | |||
| guint | info, | |||
| guint32 | time, | |||
| gpointer | user_data | |||
| ) | [static] |
Handles the "drag_data_received" signal.
| widget | The widget which got the data. It's the button of the plugin. | |
| context | ??? | |
| x | ??? | |
| y | ??? | |
| selection_data | The dragged data. | |
| info | The type of the dragged data. | |
| time | ??? | |
| user_data | ??? |
Definition at line 857 of file give_drag_and_drop.c.
References _give_drag_and_drop_private::bt_is_on, GIVE_DRAG_AND_DROP_GET_PRIVATE, GIVE_DRAG_AND_DROP_IS_OBJECT, give_drag_and_drop_send(), give_drag_and_drop_turn_bt_on_dialog(), MODEST_EMAIL, TREE_AS_STRING, and TREE_ROW.
Referenced by give_drag_and_drop_set_dest().


| static void give_drag_and_drop_finalize | ( | GObject * | self | ) | [static] |
Unsets the widget as d&d destination, unrefs objects.
Definition at line 283 of file give_drag_and_drop.c.
References _give_drag_and_drop_private::dbus_proxy, _give_drag_and_drop_private::destination, _give_drag_and_drop_private::give_bt_object, GIVE_DRAG_AND_DROP_GET_PRIVATE, GIVE_DRAG_AND_DROP_IS_OBJECT, _give_drag_and_drop_private::give_ebook_object, and _give_drag_and_drop_private::handler_id.
Referenced by give_drag_and_drop_class_init().

| GType give_drag_and_drop_get_type | ( | void | ) |
Registers the give_drag_and_drop type statically.
Sets class init, and instance init functions.
The class finalize function has been set in the class init function.
Definition at line 177 of file give_drag_and_drop.c.
References give_drag_and_drop_class_init(), and give_drag_and_drop_init().

| void give_drag_and_drop_have_bt | ( | give_drag_and_drop * | self, | |
| gboolean | setting | |||
| ) |
Sets _give_drag_and_drop_private::bt_is_on.
| self | A give_drag_and_drop object. | |
| setting | Sets the private member _give_drag_and_drop_private::bt_is_on according to setting. |
Definition at line 371 of file give_drag_and_drop.c.
References _give_drag_and_drop_private::bt_is_on, GIVE_DRAG_AND_DROP_GET_PRIVATE, and GIVE_DRAG_AND_DROP_IS_OBJECT.
Referenced by give_drag_and_drop_init(), and give_statusbar_plugin_update_status().

| static void give_drag_and_drop_init | ( | give_drag_and_drop * | self | ) | [static] |
Connects to DBus and instantiates give_bluetooth and give_ebook.
| self | a give_drag_and_drop object. |
Definition at line 234 of file give_drag_and_drop.c.
References BLUEZ_DBUS_INTERFACE, BLUEZ_DBUS_PATH, BLUEZ_DBUS_SERVICE, _give_drag_and_drop_private::dbus_proxy, give_bluetooth_new(), _give_drag_and_drop_private::give_bt_object, GIVE_DRAG_AND_DROP_GET_PRIVATE, give_drag_and_drop_have_bt(), GIVE_DRAG_AND_DROP_IS_OBJECT, give_ebook_new(), and _give_drag_and_drop_private::give_ebook_object.
Referenced by give_drag_and_drop_get_type().


| give_drag_and_drop * give_drag_and_drop_new | ( | GtkWidget * | widget | ) |
Creates a new instance of give_drag_and_drop.
Sets the widget parameter as a d&d destination with give_drag_and_drop_set_dest.
| widget | A widget, it's the button of the plugin. |
Definition at line 314 of file give_drag_and_drop.c.
References give_drag_and_drop_set_dest(), and GIVE_DRAG_AND_DROP_TYPE.
Referenced by give_statusbar_plugin_init().


| static gint give_drag_and_drop_run_dialog | ( | give_drag_and_drop * | self, | |
| GtkWidget * | dialog, | |||
| const guint | info, | |||
| const gchar * | text, | |||
| const guint | file_count, | |||
| gchar *** | files, | |||
| const GtkWidget * | entry | |||
| ) | [static] |
Runs the dialog created by give_drag_and_drop_create_dialog.
Allocates a stringlist containing the list of filenames to be send. The filenames are absolute since the Bluetooth sending call needs it.
The temporary files at the text, calendar event and contact cases are stored under TEMP_DIR. They are created by printing the formatted data into the appropriate files.
| self | A give_drag_and_drop object. | |
| dialog | The dialog, created by give_drag_and_drop_create_dialog. | |
| info | The type of the dragged data. | |
| text | The dragged data. | |
| file_count | Number of files or contacs processed. Used for memory allocation. | |
| files | Returned filenames, with absolute paths. | |
| entry | Pointer to the file name entry in the text and calendar ceses. Used by give_drag_and_drop_run_dialog to get the value. |
Definition at line 591 of file give_drag_and_drop.c.
References CALENDAR_EVENT, CONTACT_LIST, GIVE_DRAG_AND_DROP_GET_PRIVATE, GIVE_DRAG_AND_DROP_IS_OBJECT, give_ebook_get_contact_name(), give_ebook_get_contact_vcard(), _give_drag_and_drop_private::give_ebook_object, PLAIN_TEXT, TEMP_DIR, and URI_LIST.
Referenced by give_drag_and_drop_send().


| static void give_drag_and_drop_send | ( | give_drag_and_drop * | self, | |
| const guint | info, | |||
| const gchar * | text | |||
| ) | [static] |
Creates a confirmation dialog and send the files.
Creates and runs a confirmation dialog with give_drag_and_drop_create_dialog and give_drag_and_drop_run_dialog.
Send the files with the give_bluetooth_send_file method of the give_bluetooth object.
| self | A give_drag_and_drop object. | |
| info | The type of the dragged data. | |
| text | The dragged data. |
Definition at line 741 of file give_drag_and_drop.c.
References give_bluetooth_send_file(), _give_drag_and_drop_private::give_bt_object, give_drag_and_drop_create_dialog(), GIVE_DRAG_AND_DROP_GET_PRIVATE, GIVE_DRAG_AND_DROP_IS_OBJECT, and give_drag_and_drop_run_dialog().
Referenced by give_drag_and_drop_drag_recieved().


| static void give_drag_and_drop_set_dest | ( | give_drag_and_drop * | self, | |
| GtkWidget * | widget | |||
| ) | [static] |
Sets the parameter widget a d&d destination.
Definition at line 338 of file give_drag_and_drop.c.
References _give_drag_and_drop_private::destination, drop_types, give_drag_and_drop_drag_recieved(), GIVE_DRAG_AND_DROP_GET_PRIVATE, GIVE_DRAG_AND_DROP_IS_OBJECT, and _give_drag_and_drop_private::handler_id.
Referenced by give_drag_and_drop_new().


| gboolean give_drag_and_drop_turn_bt_on_dialog | ( | give_drag_and_drop * | self | ) |
Confirmation dialog whether to turn on the Bluetooth adapter or not.
| self | A give_drag_and_drop object. |
Definition at line 778 of file give_drag_and_drop.c.
References _, BLUEZ_DBUS_MESSAGE, BLUEZ_DBUS_SET_MODE, _give_drag_and_drop_private::dbus_proxy, GIVE_DRAG_AND_DROP_GET_PRIVATE, and GIVE_DRAG_AND_DROP_IS_OBJECT.
Referenced by give_drag_and_drop_drag_recieved(), and give_statusbar_plugin_pand_dialog().

| const GtkTargetEntry drop_types[] |
Initial value:
{
{ PLAIN_TEXT_TYPE, 0, PLAIN_TEXT },
{ URI_LIST_TYPE, 0, URI_LIST },
{ CALENDAR_EVENT_TYPE, 0, CALENDAR_EVENT },
{ CONTACT_LIST_TYPE, 0, CONTACT_LIST },
{ TREE_ROW_TYPE, 0, TREE_ROW },
{ TREE_AS_STRING_TYPE, 0, TREE_AS_STRING },
{ MODEST_EMAIL_TYPE, 0, MODEST_EMAIL }
}
Definition at line 118 of file give_drag_and_drop.c.
Referenced by give_drag_and_drop_set_dest().
1.5.3