soc.2009.vulture: 68356325: Set title when necessary.
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Thu Jun 25 16:35:34 EDT 2009
-----------------------------------------------------------------
Revision: 683563250dd038a8184e51dbf1e1da58a51841d3
Ancestor: 9f6308dd9a9810a34d68090fb7e02c43cd30c59c
Author: gdick at soc.pidgin.im
Date: 2009-06-25T20:29:12
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/683563250dd038a8184e51dbf1e1da58a51841d3
Modified files:
vulture/purpleconv.c vulture/purpleconv.h
vulture/purplemain.c vulture/purplemain.h
vulture/vultureblist.c vulture/vultureconv.c
vulture/vultureconv.h
ChangeLog:
Set title when necessary.
-------------- next part --------------
============================================================
--- vulture/purpleconv.c 4e56c5e9d7ef2e506dc537d4fd7fa2211e7138fe
+++ vulture/purpleconv.c d5d5442d347a80a1f1c1f817bc9efc9446eaea84
@@ -145,3 +145,42 @@ void PurpleConversationSend(VULTURE_CONV
g_free(szMessage);
}
+
+
+/**
+ * Called in response to the conversation-updated signal.
+ *
+ * @param lpconv Conversation.
+ * @param pcut Type of change.
+ */
+void PurpleConvChanged(PurpleConversation *lpconv, PurpleConvUpdateType pcut)
+{
+ VULTURE_CONVERSATION *lpvconv = lpconv->ui_data;
+
+ if(!lpvconv)
+ return;
+
+ EnterCriticalSection(&lpvconv->sync.cs);
+ {
+ switch(pcut)
+ {
+ case PURPLE_CONV_UPDATE_TITLE:
+ {
+ VULTURE_CONV_CHANGED *lpvcchanged = g_new(VULTURE_CONV_CHANGED, 1);
+
+ lpvcchanged->lpvconv = lpvconv;
+ lpvcchanged->pcut = pcut;
+
+ g_free(lpvconv->sync.szTitle);
+ lpvconv->sync.szTitle = VultureUTF8ToTCHAR(purple_conversation_get_title(lpconv));
+ VulturePostUIMessage(g_hwndMain, VUIMSG_CONVCHANGED, lpvcchanged);
+ }
+
+ break;
+
+ default:
+ break;
+ }
+ }
+ LeaveCriticalSection(&lpvconv->sync.cs);
+}
============================================================
--- vulture/purpleconv.h 15c00fd98e50f6dd029e6fa225c198bbd958fae6
+++ vulture/purpleconv.h 26ae44acd70bc7dd1051eaa4621a3c54ce118d04
@@ -33,6 +33,7 @@ void PurpleConversationSend(VULTURE_CONV
void PurpleWriteConversation(PurpleConversation *lpconv, const char *szName, const char *szAlias, const char *szMessage, PurpleMessageFlags pmflags, time_t timeMsg);
void VultureFreeConvWrite(VULTURE_CONV_WRITE *lpvcwrite);
void PurpleConversationSend(VULTURE_CONV_SEND *lpvcsend);
+void PurpleConvChanged(PurpleConversation *lpconv, PurpleConvUpdateType pcut);
#endif
============================================================
--- vulture/purplemain.c 631773457ce7af95135c82e5ce9f2bc7d4ae77a0
+++ vulture/purplemain.c d6de3d72dcb08c440369a68d85e50624048945f7
@@ -208,6 +208,7 @@ static void InitUI(void)
purple_conversations_set_ui_ops(&s_convuiops);
purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", GINT_TO_POINTER(VSH_STATUS), PURPLE_CALLBACK(PurpleStatusChanged), NULL);
+ purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", GINT_TO_POINTER(VSH_CONV), PURPLE_CALLBACK(PurpleConvChanged), NULL);
/* Create and load libpurple's buddy-list. */
purple_set_blist(purple_blist_new());
============================================================
--- vulture/purplemain.h 1df62eb9305114399b2bca8f12ea682c8dc9acb9
+++ vulture/purplemain.h a063f6b257d9786f690110e36a27ed53f05c0db8
@@ -56,12 +56,16 @@ enum ENUM_VULTURE_UI_MESSAGES
/* (VULTURE_BLIST_NODE*) Node to remove. */
VUIMSG_REMOVEBLISTNODE,
+
+ /* (VULTURE_CONV_CHANGED*) */
+ VUIMSG_CONVCHANGED,
};
/* HandlEs for reigistering signal handlERs. */
enum ENUM_VULTURE_SIGNAL_HANDLES
{
VSH_STATUS = 1,
+ VSH_CONV,
};
void VultureInitLibpurple(HANDLE *lphthread);
============================================================
--- vulture/vultureblist.c 8e4cf470aa3ac52f9deffd32b806b339f2c8c326
+++ vulture/vultureblist.c ce01eedb1741802397587d515eba3aaee76fce11
@@ -312,6 +312,10 @@ static LRESULT CALLBACK MainWndProc(HWND
VultureFreeStatus((VULTURE_SAVED_STATUS*)lParam);
break;
+ case VUIMSG_CONVCHANGED:
+ hwndForward = ((VULTURE_CONV_CHANGED*)lParam)->lpvconv->hwndContainer;
+ break;
+
case VUIMSG_QUIT:
DestroyWindow(hwnd);
break;
============================================================
--- vulture/vultureconv.c 27e07705ec7564e6c22844bf80ee6d5778fa2b10
+++ vulture/vultureconv.c 3f3f93ab3aee6f755c8d150126ccc5319ee65054
@@ -59,6 +59,7 @@ static void EnableAppropriateConvWindow(
static void RepositionConvControls(HWND hwndConvDlg);
static LRESULT CALLBACK InputBoxSubclassProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
static void EnableAppropriateConvWindow(CONVCONTAINERDATA *lpccd);
+static void SetConvTitle(VULTURE_CONVERSATION *lpvconv, HWND hwndTabs);
/**
@@ -157,13 +158,10 @@ static LRESULT CALLBACK ConvContainerWnd
lpvconv->hwndContainer = hwnd;
/* Create a new tab. */
- tcitem.mask = TCIF_TEXT | TCIF_PARAM;
+ tcitem.mask = TCIF_PARAM;
tcitem.lParam = lParam;
- EnterCriticalSection(&lpvconv->sync.cs);
- tcitem.pszText = lpvconv->sync.szTitle;
- lpvconv->iTabIndex = TabCtrl_InsertItem(hwndTabs, TabCtrl_GetItemCount(hwndTabs), &tcitem);
- LeaveCriticalSection(&lpvconv->sync.cs);
+ lpvconv->iTabIndex = TabCtrl_InsertItem(hwndTabs, TabCtrl_GetItemCount(hwndTabs), &tcitem);
/* Create conversation dialogue. It is
* initially disabled and hidden.
@@ -175,6 +173,11 @@ static LRESULT CALLBACK ConvContainerWnd
SetWindowPos(lpvconv->hwndConv, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOREPOSITION | SWP_NOSIZE);
+ /* Set the title, both of the tab and in the
+ * conversation window itself.
+ */
+ SetConvTitle(lpvconv, hwndTabs);
+
/* Only strictly necessary if we're the only
* tab.
*/
@@ -211,6 +214,26 @@ static LRESULT CALLBACK ConvContainerWnd
}
break;
+
+ case VUIMSG_CONVCHANGED:
+ {
+ VULTURE_CONV_CHANGED *lpvcchanged = (VULTURE_CONV_CHANGED*)lParam;
+ HWND hwndTabs = GetDlgItem(lpccd->hwndTabDlg, IDC_TAB_CONVERSATIONS);
+
+ switch(lpvcchanged->pcut)
+ {
+ case PURPLE_CONV_UPDATE_TITLE:
+ SetConvTitle(lpvcchanged->lpvconv, hwndTabs);
+ break;
+
+ default:
+ break;
+ }
+
+ g_free(lpvcchanged);
+ }
+
+ break;
}
return 0;
@@ -701,3 +724,23 @@ static void EnableAppropriateConvWindow(
SetFocus(GetDlgItem(hwndConv, IDC_RICHEDIT_INPUT));
}
+
+
+/**
+ * Sets the title of a conversation in the UI, both of the tab and of the
+ * conversation window itself.
+ *
+ * @param lpvconv Conversation.
+ * @param hwndTabs Tab control.
+ */
+static void SetConvTitle(VULTURE_CONVERSATION *lpvconv, HWND hwndTabs)
+{
+ TCITEM tcitem;
+
+ EnterCriticalSection(&lpvconv->sync.cs);
+ tcitem.mask = TCIF_TEXT;
+ tcitem.pszText = lpvconv->sync.szTitle;
+ TabCtrl_SetItem(hwndTabs, lpvconv->iTabIndex, &tcitem);
+ SetDlgItemText(lpvconv->hwndConv, IDC_STATIC_NAME, lpvconv->sync.szTitle);
+ LeaveCriticalSection(&lpvconv->sync.cs);
+}
============================================================
--- vulture/vultureconv.h a96bd80a732ea1aa2a26740f78295c2f2a6f2095
+++ vulture/vultureconv.h 91114c765e04be2345d238eb3fea303c8bbffb1e
@@ -61,7 +61,13 @@ typedef struct _VULTURE_CONV_SEND
LPTSTR szMessage;
} VULTURE_CONV_SEND;
+typedef struct _VULTURE_CONV_CHANGED
+{
+ VULTURE_CONVERSATION *lpvconv;
+ PurpleConvUpdateType pcut;
+} VULTURE_CONV_CHANGED;
+
int VultureRegisterConvContainerWindowClass(void);
HWND VultureCreateConvContainer(void);
void VultureWriteConversation(VULTURE_CONV_WRITE *lpvcwrite);
More information about the Commits
mailing list