}
else if (m->subtype == KMSG_KCDB_IDENT &&
m->uparam == KCDB_OP_NEW_DEFAULT) {
+ wchar_t idname[KCDB_IDENT_MAXCCH_NAME];
+ khm_size cb;
+ khm_handle defid = NULL;
cw_update_outline(tbl);
cw_update_extents(tbl, TRUE);
InvalidateRect(hwnd, NULL, FALSE);
+ if (KHM_SUCCEEDED(kcdb_identity_get_default(&defid)) &&
+ defid != NULL &&
+ KHM_SUCCEEDED(kcdb_identity_get_name(defid, idname, &cb)) &&
+ idname[0] != L'\0') {
+
+ khm_notify_icon_tooltip(idname);
+
+ } else {
+
+ LoadString(khm_hInstance, IDS_NOTIFY_READY,
+ idname, ARRAYLENGTH(idname));
+ khm_notify_icon_tooltip(idname);
+ }
+
+ if (defid)
+ kcdb_identity_release(defid);
}
else if (m->subtype == KMSG_KCDB_ATTRIB &&
(m->uparam == KCDB_OP_INSERT ||
/* Notification icon for when there are no alerts to be displayed */
int iid_normal = IDI_NOTIFY_NONE;
+/* Tooltip to use when there are no alerts to be displayed */
+wchar_t tip_normal[128] = L"";
+
+/* Current notifier severity level */
+khm_int32 notifier_severity = KHERR_NONE;
+
/* The alert currently being displayed in a balloon */
khui_alert * balloon_alert = NULL;
ni.hIcon = LoadIcon(khm_hInstance, MAKEINTRESOURCE(iid_normal));
ni.uCallbackMessage = KHUI_WM_NOTIFIER;
LoadString(khm_hInstance, IDS_NOTIFY_PREFIX, buf, ARRAYLENGTH(buf));
- StringCbCopy(ni.szTip, sizeof(ni.szTip), buf);
+ StringCbCopy(tip_normal, sizeof(tip_normal), buf);
LoadString(khm_hInstance, IDS_NOTIFY_READY, buf, ARRAYLENGTH(buf));
- StringCbCat(ni.szTip, sizeof(ni.szTip), buf);
+ StringCbCat(tip_normal, sizeof(tip_normal), buf);
+
+ StringCbCopy(ni.szTip, sizeof(ni.szTip), tip_normal);
Shell_NotifyIcon(NIM_ADD, &ni);
ni.uID = KHUI_NOTIFY_ICON_ID;
ni.uFlags = NIF_ICON | NIF_TIP;
ni.hIcon = LoadIcon(khm_hInstance, MAKEINTRESOURCE(iid));
- LoadString(khm_hInstance, IDS_NOTIFY_PREFIX, buf, ARRAYLENGTH(buf));
- StringCbCopy(ni.szTip, sizeof(ni.szTip), buf);
- if(severity == KHERR_NONE)
- LoadString(khm_hInstance, IDS_NOTIFY_READY, buf, ARRAYLENGTH(buf));
- else
+
+ if (severity == KHERR_NONE) {
+ StringCbCopy(ni.szTip, sizeof(ni.szTip), tip_normal);
+ } else {
+ LoadString(khm_hInstance, IDS_NOTIFY_PREFIX, buf, ARRAYLENGTH(buf));
+ StringCbCopy(ni.szTip, sizeof(ni.szTip), buf);
LoadString(khm_hInstance, IDS_NOTIFY_ATTENTION, buf, ARRAYLENGTH(buf));
- StringCbCat(ni.szTip, sizeof(ni.szTip), buf);
+ StringCbCat(ni.szTip, sizeof(ni.szTip), buf);
+ }
Shell_NotifyIcon(NIM_MODIFY, &ni);
DestroyIcon(ni.hIcon);
+
+ notifier_severity = severity;
+}
+
+void khm_notify_icon_tooltip(wchar_t * s) {
+ wchar_t buf[256];
+
+ LoadString(khm_hInstance, IDS_NOTIFY_PREFIX, buf, ARRAYLENGTH(buf));
+ StringCbCat(buf, sizeof(buf), s);
+
+ StringCbCopy(tip_normal, sizeof(tip_normal), buf);
+
+ if (notifier_severity == KHERR_NONE) {
+ NOTIFYICONDATA ni;
+
+ ZeroMemory(&ni, sizeof(ni));
+
+ ni.cbSize = sizeof(ni);
+ ni.hWnd = hwnd_notifier;
+ ni.uID = KHUI_NOTIFY_ICON_ID;
+ ni.uFlags = NIF_TIP;
+
+ StringCbCopy(ni.szTip, sizeof(ni.szTip), tip_normal);
+
+ Shell_NotifyIcon(NIM_MODIFY, &ni);
+ }
}
void khm_notify_icon_remove(void) {
notifier_ready = FALSE;
}
-/***** testing *****/
-
-void
-create_test_alerts(void) {
-
- khui_alert * a;
- int i;
-
- for (i=0; i < 50; i++) {
- wchar_t buf[128];
-
- StringCbPrintf(buf, sizeof(buf), L"Foo bar baz. This is alert number %d", i);
- khui_alert_create_simple(L"Title", buf, KHERR_INFO, &a);
- khui_alert_set_type(a, KHUI_ALERTTYPE_PLUGIN);
- khui_alert_set_suggestion(a, L"This is a suggestion. It is kinda long to see if the word wrapping actually works as we expect it to. Just in case, here's a line feed.\n\nDoes this show up on a different line? Cool!");
-
- khui_alert_add_command(a, KHUI_ACTION_NEW_CRED);
- khui_alert_add_command(a, KHUI_ACTION_CLOSE_APP);
- khui_alert_add_command(a, KHUI_ACTION_PROPERTIES);
- khui_alert_add_command(a, KHUI_ACTION_OPEN_APP);
- khui_alert_add_command(a, KHUI_ACTION_VIEW_REFRESH);
-
- khui_alert_show(a);
- khui_alert_release(a);
- }
-}