00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00034 #ifndef APPLICATION_SWITCHER_H
00035 #define APPLICATION_SWITCHER_H
00036
00037 #include <gtk/gtkbutton.h>
00038 #include <libosso.h>
00039 #include <gtk/gtkmenu.h>
00040
00041 #include "hn-wm-types.h"
00042
00043
00044 #define ITEM_1_LIST_POS 2
00045 #define ITEM_2_LIST_POS 3
00046 #define ITEM_3_LIST_POS 4
00047 #define ITEM_4_LIST_POS 5
00048
00049
00050 #define STRING_HOME _("tana_fi_home")
00051
00052
00053 #define WORKAREA_ATOM "_NET_WORKAREA"
00054
00055
00056 #define AS_SWITCHER_BUTTON_ICON "qgn_list_tasknavigator_appswitcher"
00057
00058
00059 #define MENU_ITEM_DEFAULT_APP_ICON "qgn_list_gene_default_app"
00060
00061
00062
00063 #define HOME_MENU_ITEM_ICON "qgn_list_home"
00064
00065
00066 #define SMALL_BUTTON1_NORMAL "hildon-navigator-small-button1"
00067 #define SMALL_BUTTON2_NORMAL "hildon-navigator-small-button2"
00068 #define SMALL_BUTTON3_NORMAL "hildon-navigator-small-button3"
00069 #define SMALL_BUTTON4_NORMAL "hildon-navigator-small-button4"
00070
00071 #define SMALL_BUTTON1_PRESSED "hildon-navigator-small-button1-pressed"
00072 #define SMALL_BUTTON2_PRESSED "hildon-navigator-small-button2-pressed"
00073 #define SMALL_BUTTON3_PRESSED "hildon-navigator-small-button3-pressed"
00074 #define SMALL_BUTTON4_PRESSED "hildon-navigator-small-button4-pressed"
00075
00076 #define NAME_SMALL_MENU_BUTTON_ITEM "hildon-navigator-small-button5"
00077
00078 #define NAME_UPPER_SEPARATOR "hildon-navigator-upper-separator"
00079 #define NAME_LOWER_SEPARATOR "hildon-navigator-lower-separator"
00080
00081
00082
00083 #define AS_MENUITEM_SAME_POSITION 0
00084 #define AS_MENUITEM_TO_FIRST_POSITION 1
00085 #define AS_MENUITEM_TO_LAST_POSITION 2
00086
00087
00088 #define BUTTON_BORDER_WIDTH 0
00089 #define MENU_BORDER_WIDTH 20
00090 #define BIG_BUTTON_HEIGHT 90
00091 #define SMALL_BUTTON_HEIGHT 38
00092 #define ROW_HEIGHT 30
00093 #define ICON_SIZE 26
00094 #define MAX_AREA_WIDTH 360
00095 #define SEPARATOR_HEIGHT 10
00096 #define BUTTON_1_Y_POS (BIG_BUTTON_HEIGHT * 3 + SEPARATOR_HEIGHT)
00097 #define BUTTON_2_Y_POS (BUTTON_1_Y_POS + SMALL_BUTTON_HEIGHT)
00098 #define BUTTON_3_Y_POS (BUTTON_2_Y_POS + SMALL_BUTTON_HEIGHT)
00099 #define BUTTON_4_Y_POS (BUTTON_3_Y_POS + SMALL_BUTTON_HEIGHT)
00100
00101
00102
00103 #define MCE_SERVICE "com.nokia.mce"
00104 #define MCE_SIGNAL_INTERFACE "com.nokia.mce.signal"
00105 #define MCE_SIGNAL_PATH "/com/nokia/mce/signal"
00106
00107 #define HOME_LONG_PRESS "sig_home_key_pressed_long_ind"
00108 #define HOME_PRESS "sig_home_key_pressed_ind"
00109 #define SHUTDOWN_IND "shutdown_ind"
00110
00111 #define LOWMEM_ON_SIGNAL_INTERFACE "com.nokia.ke_recv.lowmem_on"
00112 #define LOWMEM_ON_SIGNAL_PATH "/com/nokia/ke_recv/lowmem_on"
00113 #define LOWMEM_ON_SIGNAL_NAME "lowmem_on"
00114
00115 #define LOWMEM_OFF_SIGNAL_INTERFACE "com.nokia.ke_recv.lowmem_off"
00116 #define LOWMEM_OFF_SIGNAL_PATH "/com/nokia/ke_recv/lowmem_off"
00117 #define LOWMEM_OFF_SIGNAL_NAME "lowmem_off"
00118
00119 #define BGKILL_ON_SIGNAL_INTERFACE "com.nokia.ke_recv.bgkill_on"
00120 #define BGKILL_ON_SIGNAL_PATH "/com/nokia/ke_recv/bgkill_on"
00121 #define BGKILL_ON_SIGNAL_NAME "bgkill_on"
00122
00123 #define BGKILL_OFF_SIGNAL_INTERFACE "com.nokia.ke_recv.bgkill_off"
00124 #define BGKILL_OFF_SIGNAL_PATH "/com/nokia/ke_recv/bgkill_off"
00125 #define BGKILL_OFF_SIGNAL_NAME "bgkill_off"
00126
00127 #define HILDON_NAVIGATOR_WINDOW_OPEN_SOUND DATADIR"/sounds/ui-window_open.wav"
00128 #define HILDON_NAVIGATOR_WINDOW_CLOSE_SOUND DATADIR"/sounds/ui-window_close.wav"
00129
00130 #define LAST_AS_BUTTON 4
00131
00132 #define TIMEOUT_HALF_SECOND 500
00133 #define TIMEOUT_ONE_AND_HALF_SECOND 1500
00134 #define TEMP_LABEL_BUFFER_SIZE 80
00135
00136 typedef struct ApplicationSwitcher ApplicationSwitcher_t;
00137
00138 typedef void (_shutdown_callback)(void);
00139 typedef void (_lowmem_callback)(gboolean is_on);
00140 typedef void (_bgkill_callback)(gboolean is_on);
00141
00142
00143 struct ApplicationSwitcher {
00144
00145 GtkMenu *menu;
00146
00147
00148 GtkWidget *home_menu_item;
00149
00150
00151 GtkWidget *tooltip_menu;
00152
00153
00154 GtkWidget *tooltip_menu_item;
00155
00156
00157 GtkWidget *vbox;
00158
00159
00160 GtkWidget *toggle_button1;
00161 GtkWidget *toggle_button2;
00162 GtkWidget *toggle_button3;
00163 GtkWidget *toggle_button4;
00164
00165
00166 GtkWidget *toggle_button_as;
00167
00168
00169 GtkWidget *as_button_icon;
00170 gboolean menu_icon_is_blinking;
00171
00172
00173 gint toggled_button_id;
00174
00175
00176 gboolean in_area;
00177 gboolean is_list;
00178 gboolean on_border;
00179 gboolean on_button;
00180
00181 gint hide_tooltip_timeout_id;
00182 gint show_tooltip_timeout_id;
00183 gboolean tooltip_visible;
00184
00185 gboolean switched_to_desktop;
00186
00187 gint start_y_position;
00188
00189 GArray *items;
00190
00191 osso_context_t *osso;
00192 void *dnotify_handler;
00193 _shutdown_callback *shutdown_handler;
00194 _lowmem_callback *lowmem_handler;
00195 _bgkill_callback *bgkill_handler;
00196
00197 gboolean prev_sig_was_long_press;
00198 gboolean system_inactivity;
00199
00200
00201 gint esd_socket;
00202 gint start_sample;
00203 gint end_sample;
00204 };
00205
00206
00207 typedef struct container {
00208 GtkWidget *item;
00209 gchar *item_text;
00210 gchar *app_name;
00211 gchar *icon_name;
00212 gboolean killable_item;
00213 gboolean killed_item;
00214 gchar *dialog_name;
00215 GtkWidget *icon;
00216 gboolean is_blinking;
00217 gboolean ignore_blinking;
00218 } container;
00219
00220
00221 enum{
00222 AS_BUTTON_1 = 0,
00223 AS_BUTTON_2,
00224 AS_BUTTON_3,
00225 AS_BUTTON_4,
00226 AS_BUTTON_SWITCHER
00227 };
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237 ApplicationSwitcher_t *application_switcher_init( void );
00238
00239
00240
00241
00242
00243
00244
00245 GtkWidget *application_switcher_get_button(ApplicationSwitcher_t *as);
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 void application_switcher_initialize_menu(ApplicationSwitcher_t *as);
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268 GtkWidget *application_switcher_get_killable_item(
00269 ApplicationSwitcher_t *as);
00270
00271
00272
00273
00274
00275
00276
00277 void application_switcher_deinit(ApplicationSwitcher_t *as);
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287 GList *application_switcher_get_menuitems(ApplicationSwitcher_t *as);
00288
00289
00290 void *application_switcher_get_dnotify_handler(ApplicationSwitcher_t *as);
00291
00292 void application_switcher_set_dnotify_handler(ApplicationSwitcher_t *as,
00293 gpointer update_cb_ptr);
00294
00295 void application_switcher_set_shutdown_handler(ApplicationSwitcher_t *as,
00296 gpointer shutdown_cb_ptr);
00297
00298 void application_switcher_set_lowmem_handler(ApplicationSwitcher_t *as,
00299 gpointer lowmem_cb_ptr);
00300
00301 void application_switcher_set_bgkill_handler(ApplicationSwitcher_t *as,
00302 gpointer bgkill_on_cb_ptr);
00303
00304 void application_switcher_add_menubutton(ApplicationSwitcher_t *as);
00305
00306 void application_switcher_update_lowmem_situation(ApplicationSwitcher_t *as,
00307 gboolean lowmem);
00308
00309
00310
00311 GtkWidget*
00312 app_switcher_add_new_item (ApplicationSwitcher_t *as,
00313 HNWMWatchedWindow *window,
00314 HNWMWatchedWindowView *view);
00315
00316 void
00317 app_switcher_remove_item (ApplicationSwitcher_t *as,
00318 GtkWidget *menuitem);
00319
00320 void
00321 app_switcher_update_item (ApplicationSwitcher_t *as,
00322 HNWMWatchedWindow *window,
00323 HNWMWatchedWindowView *view,
00324 guint position_change);
00325 void
00326 app_switcher_top_desktop_item (ApplicationSwitcher_t *as);
00327
00328 void
00329 app_switcher_item_icon_sync (ApplicationSwitcher_t *as,
00330 HNWMWatchedWindow *window);
00331
00332 void
00333 app_switcher_system_inactivity_change(ApplicationSwitcher_t *as);
00334
00335 #endif