void set_auto_sync_cb (void *result, void *data, GError *error) { SetAutoSyncData *sdata = data; gboolean disable = sdata->disable; if (error) { applet_warning ("failed to %s sync: %s\n", disable ? "disable" : "enable", error->message); MessageBox(NULL, disable ? _("Failed to disable auto sync") : _("Failed to enable auto sync"), "Seafile", MB_OK); } else { HINSTANCE hInstance = applet->hInstance; HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_STARTINTRAY)); if (disable) { /* auto sync is disabled */ EnableMenuItem (hMenu, IDM_ENABLE_AUTO_SYNC, MF_ENABLED); EnableMenuItem (hMenu, IDM_DISABLE_AUTO_SYNC, MF_GRAYED); } else { /* auto sync is enabled */ EnableMenuItem (hMenu, IDM_DISABLE_AUTO_SYNC, MF_ENABLED); EnableMenuItem (hMenu, IDM_ENABLE_AUTO_SYNC, MF_GRAYED); } applet->auto_sync_disabled = disable; reset_trayicon_and_tip(); } g_free (sdata); }
static void CALLBACK do_rotate (HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime) { if (rotate_counter >= 8 || !trayicon_is_rotating || applet->auto_sync_disabled) { trayicon_is_rotating = FALSE; KillTimer(hwnd, iTimerID); reset_trayicon_and_tip(); return; } trayicon_set_icon_by_id (applet->icon, IDI_STATUS_TRANSFER_1 + (nth_trayicon % 4)); nth_trayicon++; rotate_counter++; }
static gboolean do_rotate () { SeafileTrayIcon *icon = applet->icon; if (rotate_counter >= 8 || !trayicon_is_rotating || applet->auto_sync_disabled ) { trayicon_is_rotating = FALSE; reset_trayicon_and_tip (icon); return FALSE; } static char *names[] = { SEAFILE_TRANFER_1, SEAFILE_TRANFER_2, SEAFILE_TRANFER_3, SEAFILE_TRANFER_4 }; int index = nth_trayicon % G_N_ELEMENTS(names); char *name = names[index]; seafile_trayicon_set_icon (icon, name); nth_trayicon++; rotate_counter++; return TRUE; }