#include "config.h"#include "give_statusbar_plugin.h"#include "give_drag_and_drop.h"#include <locale.h>#include <libintl.h>#include <dbus/dbus-glib.h>#include <gconf/gconf-client.h>#include <hildon/hildon-banner.h>

Go to the source code of this file.
Classes | |
| struct | _GiveStatusbarPluginPrivate |
| Struct of private members of GiveStatusbarPlugin. More... | |
Defines | |
| #define | _(String) gettext(String) |
| #define | GIVE_STATUSBAR_PLUGIN_GET_PRIVATE(obj) |
| #define | BT_DIR "/system/osso/connectivity/BT" |
| #define | BT_KEY "/system/osso/connectivity/BT/enabled" |
| #define | LOG_FILE "/tmp/give_log.txt" |
Typedefs | |
| typedef struct _GiveStatusbarPluginPrivate | GiveStatusbarPluginPrivate |
Enumerations | |
| enum | bt_state { BT_IS_OFF, BT_IS_ON, BT_PAND_IS_ACTIVE } |
| The states of the plugin. More... | |
| enum | menu_items { NOTE_ITEM, FILE_ITEM, APPOINTMENT_ITEM, CONTACT_ITEM, EMAIL_ITEM, ABOUT_ITEM } |
| Enumeration of the menu of Give, except the Net access. More... | |
Functions | |
| HD_DEFINE_PLUGIN (GiveStatusbarPlugin, give_statusbar_plugin, STATUSBAR_TYPE_ITEM) | |
Private functions | |
| static void | give_statusbar_plugin_class_init (GiveStatusbarPluginClass *klass) |
| Overrites the class finalize function and adds the private structure. | |
| static void | give_statusbar_plugin_init (GiveStatusbarPlugin *self) |
| Initialize the plugin. | |
| static void | give_statusbar_plugin_finalize (GObject *self) |
| Unreferences the private members. | |
| static void | give_statusbar_plugin_popup_place (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) |
| Calculates the popup place of the Give menu. | |
| static void | give_statusbar_plugin_update_status (GiveStatusbarPlugin *self) |
| Update the icon of plugin according to the Bluetooth status. | |
| static void | give_statusbar_plugin_clicked (GtkButton *button, GiveStatusbarPlugin *self) |
| Builds up the popup menu of Give and show it. | |
| static void | give_statusbar_plugin_item_clicked (GtkWidget *menu_item, guint item) |
| Handles the clicks in the popup menu. | |
| static void | give_statusbar_plugin_about_dialog (void) |
| Shows the about dialog about Give. | |
| static void | give_statusbar_plugin_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) |
| Give's own log handler. | |
| static void | give_statusbar_plugin_bt_changed (GConfClient *gc_client, guint cnxn_id, GConfEntry *entry, gpointer data) |
| Gets the Bluetooth adapter's state from GConf and sets the private _GiveStatusbarPluginPrivate::state due to this. | |
| static void | give_statusbar_plugin_pand_dialog (GtkMenuItem *menuitem, GiveStatusbarPlugin *self) |
| Creates and shows the stop/start pand dialog. | |
| static void | give_statusbar_plugin_start_pand (GtkMenuItem *menuitem, GiveStatusbarPlugin *self) |
| Starts the pand daemon. | |
| static void | give_statusbar_plugin_stop_pand (GiveStatusbarPlugin *self) |
| Kills the pand daemon. | |
Definition in file give_statusbar_plugin.c.
| #define _ | ( | String | ) | gettext(String) |
Definition at line 34 of file give_statusbar_plugin.c.
| #define BT_DIR "/system/osso/connectivity/BT" |
Definition at line 48 of file give_statusbar_plugin.c.
Referenced by give_statusbar_plugin_finalize(), and give_statusbar_plugin_init().
| #define BT_KEY "/system/osso/connectivity/BT/enabled" |
boolean, TRUE if the Bluetooth adapter is on, FALSE otherwise.
Definition at line 50 of file give_statusbar_plugin.c.
Referenced by give_statusbar_plugin_bt_changed(), and give_statusbar_plugin_init().
| #define GIVE_STATUSBAR_PLUGIN_GET_PRIVATE | ( | obj | ) |
Value:
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
GIVE_TYPE_STATUSBAR_PLUGIN, \
GiveStatusbarPluginPrivate));
Definition at line 42 of file give_statusbar_plugin.c.
Referenced by give_statusbar_plugin_bt_changed(), give_statusbar_plugin_clicked(), give_statusbar_plugin_finalize(), give_statusbar_plugin_init(), give_statusbar_plugin_pand_dialog(), give_statusbar_plugin_start_pand(), give_statusbar_plugin_stop_pand(), and give_statusbar_plugin_update_status().
| #define LOG_FILE "/tmp/give_log.txt" |
Logfile used if compiled with --enable-ltf=yes.
Definition at line 53 of file give_statusbar_plugin.c.
Referenced by give_statusbar_plugin_log_handler().
| typedef struct _GiveStatusbarPluginPrivate GiveStatusbarPluginPrivate |
Definition at line 40 of file give_statusbar_plugin.c.
| enum bt_state |
| enum menu_items |
Enumeration of the menu of Give, except the Net access.
Definition at line 88 of file give_statusbar_plugin.c.
| static void give_statusbar_plugin_about_dialog | ( | void | ) | [static] |
Shows the about dialog about Give.
Definition at line 564 of file give_statusbar_plugin.c.
References _.
Referenced by give_statusbar_plugin_item_clicked().

| static void give_statusbar_plugin_bt_changed | ( | GConfClient * | gc_client, | |
| guint | cnxn_id, | |||
| GConfEntry * | entry, | |||
| gpointer | data | |||
| ) | [static] |
Gets the Bluetooth adapter's state from GConf and sets the private _GiveStatusbarPluginPrivate::state due to this.
| gc_client | The GConfClient notifying us. | |
| cnxn_id | Connection ID from gconf_client_notify_add(). Not used. | |
| entry | A GConfEntry. Not used. | |
| data | User data from gconf_client_notify_add(). It's a GiveStatusbarPlugin object. |
Definition at line 675 of file give_statusbar_plugin.c.
References BT_IS_OFF, BT_IS_ON, BT_KEY, GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, give_statusbar_plugin_stop_pand(), give_statusbar_plugin_update_status(), _GiveStatusbarPluginPrivate::pand_pid, and _GiveStatusbarPluginPrivate::state.
Referenced by give_statusbar_plugin_init().


| static void give_statusbar_plugin_class_init | ( | GiveStatusbarPluginClass * | klass | ) | [static] |
Overrites the class finalize function and adds the private structure.
Sets give_statusbar_plugin_finalize as the class' finalize function.
Registers the GiveStatusbarPluginPrivate structure as private member.
| klass | a GiveStatusbarPluginClass class. |
Definition at line 138 of file give_statusbar_plugin.c.
References give_statusbar_plugin_finalize().

| static void give_statusbar_plugin_clicked | ( | GtkButton * | button, | |
| GiveStatusbarPlugin * | self | |||
| ) | [static] |
Builds up the popup menu of Give and show it.
| button | The button of the plugin. | |
| self | A GiveStatusbarPlugin object. |
Definition at line 361 of file give_statusbar_plugin.c.
References _, ABOUT_ITEM, APPOINTMENT_ITEM, BT_PAND_IS_ACTIVE, CONTACT_ITEM, EMAIL_ITEM, FILE_ITEM, GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, give_statusbar_plugin_item_clicked(), give_statusbar_plugin_pand_dialog(), give_statusbar_plugin_popup_place(), NOTE_ITEM, and _GiveStatusbarPluginPrivate::state.
Referenced by give_statusbar_plugin_init().


| static void give_statusbar_plugin_finalize | ( | GObject * | self | ) | [static] |
Unreferences the private members.
| self | a GObject. |
Definition at line 240 of file give_statusbar_plugin.c.
References BT_DIR, _GiveStatusbarPluginPrivate::dnd, _GiveStatusbarPluginPrivate::gc_client, GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, and _GiveStatusbarPluginPrivate::notify_uid.
Referenced by give_statusbar_plugin_class_init().

| static void give_statusbar_plugin_init | ( | GiveStatusbarPlugin * | self | ) | [static] |
Initialize the plugin.
| self | A GiveStatusbarPlugin object. |
Definition at line 161 of file give_statusbar_plugin.c.
References BT_DIR, BT_IS_OFF, BT_KEY, _GiveStatusbarPluginPrivate::button, _GiveStatusbarPluginPrivate::dnd, _GiveStatusbarPluginPrivate::gc_client, give_drag_and_drop_new(), GIVE_IS_STATUSBAR_PLUGIN, give_statusbar_plugin_bt_changed(), give_statusbar_plugin_clicked(), GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, give_statusbar_plugin_log_handler(), _GiveStatusbarPluginPrivate::image, _GiveStatusbarPluginPrivate::notify_uid, _GiveStatusbarPluginPrivate::pand_pid, and _GiveStatusbarPluginPrivate::state.

| static void give_statusbar_plugin_item_clicked | ( | GtkWidget * | menu_item, | |
| guint | item | |||
| ) | [static] |
Handles the clicks in the popup menu.
Invokes the programs for:
| menu_item | Menuitem recieved the "activate" signal. | |
| item | Which menuitem got selected. Enumeraded with menu_items. |
Definition at line 496 of file give_statusbar_plugin.c.
References _, ABOUT_ITEM, APPOINTMENT_ITEM, CONTACT_ITEM, EMAIL_ITEM, FILE_ITEM, give_statusbar_plugin_about_dialog(), and NOTE_ITEM.
Referenced by give_statusbar_plugin_clicked().


| static void give_statusbar_plugin_log_handler | ( | const gchar * | log_domain, | |
| GLogLevelFlags | log_level, | |||
| const gchar * | message, | |||
| gpointer | user_data | |||
| ) | [static] |
Give's own log handler.
| log_domain | Not used. | |
| log_level | The nature of the log message.. | |
| message | The log message. | |
| user_data | No used. |
Definition at line 595 of file give_statusbar_plugin.c.
References LOG_FILE.
Referenced by give_statusbar_plugin_init().

| static void give_statusbar_plugin_pand_dialog | ( | GtkMenuItem * | menuitem, | |
| GiveStatusbarPlugin * | self | |||
| ) | [static] |
Creates and shows the stop/start pand dialog.
According to _GiveStatusbarPluginPrivate::state it stops pand if it's running and starts if it's not.
Invokes the _GiveStatusbarPluginPrivate::dnd object's give_drag_and_drop_turn_bt_on_dialog if the Bluetooth is off.
| menuitem | The menuitem recieved the "activate" signal. | |
| self | A GiveStatusbarPlugin object. |
Definition at line 746 of file give_statusbar_plugin.c.
References _, BT_IS_OFF, BT_PAND_IS_ACTIVE, _GiveStatusbarPluginPrivate::dnd, give_drag_and_drop_turn_bt_on_dialog(), GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, give_statusbar_plugin_start_pand(), give_statusbar_plugin_stop_pand(), and _GiveStatusbarPluginPrivate::state.
Referenced by give_statusbar_plugin_clicked().


| static void give_statusbar_plugin_popup_place | ( | GtkMenu * | menu, | |
| gint * | x, | |||
| gint * | y, | |||
| gboolean * | push_in, | |||
| gpointer | user_data | |||
| ) | [static] |
Calculates the popup place of the Give menu.
| menu | A GtkMenu. | |
| x | A address of the gint representing the horizontal position where the menu shall be drawn. This is an output parameter. | |
| y | A address of the gint representing the vertical position where the menu shall be drawn. This is an output parameter. | |
| push_in | This parameter controls how menus placed outside the monitor are handled. Not used. | |
| user_data | The data supplied by the user in the gtk_menu_popup() data parameter. |
Definition at line 282 of file give_statusbar_plugin.c.
Referenced by give_statusbar_plugin_clicked().

| static void give_statusbar_plugin_start_pand | ( | GtkMenuItem * | menuitem, | |
| GiveStatusbarPlugin * | self | |||
| ) | [static] |
Starts the pand daemon.
Stores the PID in _GiveStatusbarPluginPrivate::pand_pid so it can be killed later with give_statusbar_plugin_stop_pand.
| menuitem | The menuitem recieved the "activate" signal. | |
| self | A GiveStatusbarPlugin object. |
Definition at line 818 of file give_statusbar_plugin.c.
References _, BT_PAND_IS_ACTIVE, GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, give_statusbar_plugin_update_status(), _GiveStatusbarPluginPrivate::pand_pid, and _GiveStatusbarPluginPrivate::state.
Referenced by give_statusbar_plugin_pand_dialog().


| static void give_statusbar_plugin_stop_pand | ( | GiveStatusbarPlugin * | self | ) | [static] |
Kills the pand daemon.
The PID of the process is stored in _GiveStatusbarPluginPrivate::notify_uid.
| self | GiveStatusbarPlugin. |
Definition at line 863 of file give_statusbar_plugin.c.
References _, BT_IS_ON, GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, give_statusbar_plugin_update_status(), _GiveStatusbarPluginPrivate::pand_pid, and _GiveStatusbarPluginPrivate::state.
Referenced by give_statusbar_plugin_bt_changed(), and give_statusbar_plugin_pand_dialog().


| static void give_statusbar_plugin_update_status | ( | GiveStatusbarPlugin * | self | ) | [static] |
Update the icon of plugin according to the Bluetooth status.
| self | A GiveStatusbarPlugin object. |
Definition at line 316 of file give_statusbar_plugin.c.
References BT_IS_OFF, BT_IS_ON, BT_PAND_IS_ACTIVE, _GiveStatusbarPluginPrivate::dnd, give_drag_and_drop_have_bt(), GIVE_IS_STATUSBAR_PLUGIN, GIVE_STATUSBAR_PLUGIN_GET_PRIVATE, _GiveStatusbarPluginPrivate::image, and _GiveStatusbarPluginPrivate::state.
Referenced by give_statusbar_plugin_bt_changed(), give_statusbar_plugin_start_pand(), and give_statusbar_plugin_stop_pand().


| HD_DEFINE_PLUGIN | ( | GiveStatusbarPlugin | , | |
| give_statusbar_plugin | , | |||
| STATUSBAR_TYPE_ITEM | ||||
| ) |
1.5.3