00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00030 #include <glib.h>
00031 #include <gtk/gtk.h>
00032
00033 #include <liberipc/eripc.h>
00034 #include <liberipc/eripctoolbar.h>
00035 #include <liberipc/eripcbusyd.h>
00036 #include <liberipc/eripccontentlister.h>
00037 #include <libermanifest/ermanifest.h>
00038
00039 #include "contentListerLog.h"
00040 #include "erConnect.h"
00041 #include "system.h"
00042 #include "gtkPincodeScreen.h"
00043 #include "control.h"
00044 #include "displayUpdate.h"
00045 #include "toolbar.h"
00046
00047
00048 static erClientChannel_t toolbarChannel;
00049
00050 static gboolean g_trashcan_selected = FALSE;
00051 static gboolean g_locked_selected = FALSE;
00052 static gboolean g_tagging_selected = FALSE;
00053 static gboolean g_search_selected = FALSE;
00054 static gboolean g_sort_selected = FALSE;
00055 static gboolean g_share_selected = FALSE;
00056
00057 static gint g_lock_screen_state = iconState_normal;
00058 static gint g_connect_state = iconState_grey;
00059
00060
00061 static void toolbar_clear_internal(void);
00062
00063
00064
00065 void toolbar_init()
00066 {
00067 int returnValue;
00068
00069 CL_TBPRINTF("entry");
00070
00071
00072 returnValue = erIpcStartClient(ER_TOOLBAR_CHANNEL, &toolbarChannel);
00073
00074 if (returnValue != 0)
00075 {
00076 CL_WARNPRINTF("erIpcStartClient returned %d", returnValue);
00077 return;
00078 }
00079
00080 toolbar_restore();
00081 }
00082
00083 void toolbar_restore()
00084 {
00085 CL_TBPRINTF("entry");
00086
00087
00088 tbDisableUpdate(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00089
00090
00091 toolbar_clear_internal();
00092
00093
00094
00095
00096 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_search, ccClToolbarIcon);
00097 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_search, iconState_grey );
00098 g_search_selected = FALSE;
00099
00100 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_sort, ccClToolbarIcon);
00101 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_sort, iconState_grey );
00102 g_sort_selected = FALSE;
00103
00104
00105 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_share, ccClToolbarIcon);
00106 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_share, iconState_grey );
00107
00108
00109 tbEnableUpdate(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00110 }
00111
00112 static void toolbar_clear_internal()
00113 {
00114 CL_TBPRINTF("entry");
00115
00116
00117 tbSelectIconSet(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00118
00119
00120 tbClearIconSet(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00121
00122
00123
00124
00125 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_trashcan, ccClToolbarIcon);
00126 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_trashcan, iconState_grey );
00127 g_trashcan_selected = FALSE;
00128
00129
00130 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_connect, ccClToolbarIcon);
00131 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_connect, g_connect_state);
00132
00133
00134 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_lock_screen, ccClToolbarIcon);
00135 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_lock_screen, g_lock_screen_state);
00136
00137
00138 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_locked, ccClToolbarIcon);
00139 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_locked, g_locked_selected ? iconState_selected : iconState_normal);
00140
00141
00142 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_keyboard, ccClToolbarIcon);
00143 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_keyboard, iconState_grey );
00144
00145
00146 tbAppendPlatformIcon( toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_tagging, ccClToolbarIcon);
00147 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID_tagging, iconState_grey );
00148 g_tagging_selected = FALSE;
00149 }
00150
00151 void toolbar_clear()
00152 {
00153 CL_TBPRINTF("entry");
00154
00155
00156 tbDisableUpdate(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00157
00158
00159 toolbar_clear_internal();
00160
00161
00162 tbEnableUpdate(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00163 }
00164
00165
00166
00167 void toolbar_disableUpdate()
00168 {
00169 CL_TBPRINTF("entry");
00170
00171 tbDisableUpdate(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00172 }
00173
00174
00175 void toolbar_enableUpdate()
00176 {
00177 CL_TBPRINTF("entry");
00178
00179 tbEnableUpdate(toolbarChannel, ER_CONTENT_LISTER_UA_ID);
00180 }
00181
00182 void toolbar_setIconState(int iconID, int iconState)
00183 {
00184 CL_TBPRINTF("entry: iconID [%d] iconState [%d]", iconID, iconState);
00185
00186 tbSetStatePlatformIcon(toolbarChannel, ER_CONTENT_LISTER_UA_ID, iconID, iconState);
00187 switch (iconID)
00188 {
00189 case iconID_trashcan:
00190 g_trashcan_selected = (iconState == iconState_selected);
00191 break;
00192 case iconID_connect:
00193 g_connect_state = iconState;
00194 break;
00195 case iconID_lock_screen:
00196 g_lock_screen_state = iconState;
00197 break;
00198 case iconID_locked:
00199 g_locked_selected = (iconState == iconState_selected);
00200 break;
00201 case iconID_tagging:
00202 g_tagging_selected = (iconState == iconState_selected);
00203 break;
00204 case iconID_search:
00205 g_search_selected = (iconState == iconState_selected);
00206 break;
00207 case iconID_sort:
00208 g_sort_selected = (iconState == iconState_selected);
00209 break;
00210 case iconID_share:
00211 g_share_selected = (iconState == iconState_selected);
00212 break;
00213 default:
00214 ;
00215 }
00216 }
00217
00218 void toolbar_synchronise(void)
00219 {
00220 CL_TBPRINTF("entry");
00221
00222 tbSynchronise(toolbarChannel, ER_CONTENT_LISTER_UA_ID, ccClToolbarSynchronised);
00223 }
00224
00225 gboolean toolbar_is_trashcan_selected()
00226 {
00227 CL_TBPRINTF("return [%d]", g_trashcan_selected);
00228 return g_trashcan_selected;
00229 }
00230
00231 gboolean toolbar_is_locked_selected()
00232 {
00233 CL_TBPRINTF("return [%d]", g_locked_selected);
00234 return g_locked_selected;
00235 }
00236 gboolean toolbar_is_tagging_selected()
00237 {
00238 CL_TBPRINTF("return [%d]", g_tagging_selected);
00239 return g_tagging_selected;
00240 }
00241
00242 gboolean toolbar_is_search_selected()
00243 {
00244 CL_TBPRINTF("return [%d]", g_search_selected);
00245 return g_search_selected;
00246 }
00247
00248 gboolean toolbar_is_sort_selected()
00249 {
00250 CL_TBPRINTF("return [%d]", g_sort_selected);
00251 return g_sort_selected;
00252 }
00253
00254 gboolean toolbar_is_lock_screen_selected()
00255 {
00256 if (g_lock_screen_state == iconState_selected)
00257 return TRUE;
00258 else
00259 return FALSE;
00260 }
00261
00262 gboolean toolbar_is_share_selected()
00263 {
00264 CL_TBPRINTF("return [%d]", g_share_selected);
00265 return g_share_selected;
00266 }