comparison src/gtkconv.c @ 11508:c04d93398852

[gaim-migrate @ 13753] stop truncating the tabs at around 4 characters. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 11 Sep 2005 15:38:22 +0000
parents 9fc7d0153332
children 4fd0c3a663b8
comparison
equal deleted inserted replaced
11507:18c18cbc0967 11508:c04d93398852
255 255
256 static gint 256 static gint
257 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 257 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
258 { 258 {
259 GList *list = g_list_copy(gtkconv->convs), *l; 259 GList *list = g_list_copy(gtkconv->convs), *l;
260 260
261 l = list; 261 l = list;
262 while (l) { 262 while (l) {
263 GaimConversation *conv = l->data; 263 GaimConversation *conv = l->data;
264 gaim_conversation_destroy(conv); 264 gaim_conversation_destroy(conv);
265 l = l->next; 265 l = l->next;
266 } 266 }
267 267
268 g_list_free(list); 268 g_list_free(list);
269 269
270 return TRUE; 270 return TRUE;
271 } 271 }
272 272
273 static gboolean 273 static gboolean
274 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimGtkConversation *gtkconv) 274 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimGtkConversation *gtkconv)
275 { 275 {
276 GaimConversation *conv = gtkconv->active_conv; 276 GaimConversation *conv = gtkconv->active_conv;
277 277
278 if (!GTK_WIDGET_VISIBLE(w)) 278 if (!GTK_WIDGET_VISIBLE(w))
279 return FALSE; 279 return FALSE;
280 280
281 if (!GAIM_IS_GTK_CONVERSATION(conv)) 281 if (!GAIM_IS_GTK_CONVERSATION(conv))
282 return FALSE; 282 return FALSE;
317 317
318 static void 318 static void
319 default_formatize(GaimGtkConversation *c) 319 default_formatize(GaimGtkConversation *c)
320 { 320 {
321 GaimConversation *conv = c->active_conv; 321 GaimConversation *conv = c->active_conv;
322 322
323 if (conv->features & GAIM_CONNECTION_HTML) 323 if (conv->features & GAIM_CONNECTION_HTML)
324 { 324 {
325 char *color; 325 char *color;
326 GdkColor fg_color, bg_color; 326 GdkColor fg_color, bg_color;
327 327
1575 G_CALLBACK(menu_chat_im_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1575 G_CALLBACK(menu_chat_im_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
1576 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1576 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1577 1577
1578 if (prpl_info && prpl_info->send_file 1578 if (prpl_info && prpl_info->send_file
1579 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { 1579 && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) {
1580 button = gaim_new_item_from_stock(menu, _("Send File"), 1580 button = gaim_new_item_from_stock(menu, _("Send File"),
1581 GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(menu_chat_send_file_cb), 1581 GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(menu_chat_send_file_cb),
1582 GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1582 GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
1583 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1583 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1584 } 1584 }
1585 1585
2038 { 2038 {
2039 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; 2039 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data;
2040 GaimConversation *conv; 2040 GaimConversation *conv;
2041 2041
2042 g_return_if_fail(gtkconv != NULL); 2042 g_return_if_fail(gtkconv != NULL);
2043 2043
2044 conv = gtkconv->active_conv; 2044 conv = gtkconv->active_conv;
2045 2045
2046 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) 2046 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing"))
2047 return; 2047 return;
2048 2048
2057 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; 2057 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data;
2058 GaimConversation *conv; 2058 GaimConversation *conv;
2059 GaimConvIm *im; 2059 GaimConvIm *im;
2060 2060
2061 g_return_if_fail(gtkconv != NULL); 2061 g_return_if_fail(gtkconv != NULL);
2062 2062
2063 conv = gtkconv->active_conv; 2063 conv = gtkconv->active_conv;
2064 2064
2065 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) 2065 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing"))
2066 return; 2066 return;
2067 2067
2176 2176
2177 if ((gpointer)gtkwin == (gpointer)dest_gtkwin && gtkwin->drag_tab < page_num) { 2177 if ((gpointer)gtkwin == (gpointer)dest_gtkwin && gtkwin->drag_tab < page_num) {
2178 arrow1_x += tab->allocation.width; 2178 arrow1_x += tab->allocation.width;
2179 arrow2_x += tab->allocation.width; 2179 arrow2_x += tab->allocation.width;
2180 } 2180 }
2181 2181
2182 arrow1_y = nb_y + tab->allocation.y; 2182 arrow1_y = nb_y + tab->allocation.y;
2183 arrow2_y = nb_y + tab->allocation.y + 2183 arrow2_y = nb_y + tab->allocation.y +
2184 tab->allocation.height; 2184 tab->allocation.height;
2185 } 2185 }
2186 else { 2186 else {
2278 gtkwin->drag_max_y = 0; 2278 gtkwin->drag_max_y = 0;
2279 2279
2280 /* Find out which tab was dragged. */ 2280 /* Find out which tab was dragged. */
2281 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), tab_clicked); 2281 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), tab_clicked);
2282 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gtkwin->notebook), page); 2282 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gtkwin->notebook), page);
2283 2283
2284 gtkwin->drag_min_x = tab->allocation.x + nb_x; 2284 gtkwin->drag_min_x = tab->allocation.x + nb_x;
2285 gtkwin->drag_min_y = tab->allocation.y + nb_y; 2285 gtkwin->drag_min_y = tab->allocation.y + nb_y;
2286 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; 2286 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x;
2287 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; 2287 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y;
2288 2288
3066 update_typing_icon(GaimGtkConversation *gtkconv) 3066 update_typing_icon(GaimGtkConversation *gtkconv)
3067 { 3067 {
3068 GaimGtkWindow *gtkwin; 3068 GaimGtkWindow *gtkwin;
3069 GaimConvIm *im = NULL; 3069 GaimConvIm *im = NULL;
3070 GaimConversation *conv = gtkconv->active_conv; 3070 GaimConversation *conv = gtkconv->active_conv;
3071 3071
3072 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); 3072 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv));
3073 3073
3074 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) 3074 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
3075 im = GAIM_CONV_IM(conv); 3075 im = GAIM_CONV_IM(conv);
3076 3076
3446 GdkPixbuf *pixbuf; 3446 GdkPixbuf *pixbuf;
3447 GtkTreeIter iter; 3447 GtkTreeIter iter;
3448 gboolean is_me = FALSE; 3448 gboolean is_me = FALSE;
3449 gboolean is_buddy; 3449 gboolean is_buddy;
3450 GdkColor send_color; 3450 GdkColor send_color;
3451 3451
3452 gdk_color_parse(SEND_COLOR, &send_color); 3452 gdk_color_parse(SEND_COLOR, &send_color);
3453 3453
3454 chat = GAIM_CONV_CHAT(conv); 3454 chat = GAIM_CONV_CHAT(conv);
3455 gtkconv = GAIM_GTK_CONVERSATION(conv); 3455 gtkconv = GAIM_GTK_CONVERSATION(conv);
3456 gtkchat = gtkconv->u.chat; 3456 gtkchat = gtkconv->u.chat;
4682 GtkWidget *tabby, *menu_tabby; 4682 GtkWidget *tabby, *menu_tabby;
4683 GtkWidget *close_image; 4683 GtkWidget *close_image;
4684 gboolean new_ui; 4684 gboolean new_ui;
4685 GaimConversationType conv_type; 4685 GaimConversationType conv_type;
4686 const char *name; 4686 const char *name;
4687 const gchar *tmp_lab;
4687 gint close_button_width, close_button_height, focus_width, focus_pad; 4688 gint close_button_width, close_button_height, focus_width, focus_pad;
4688 4689
4689 name = gaim_conversation_get_name(conv); 4690 name = gaim_conversation_get_name(conv);
4690 conv_type = gaim_conversation_get_type(conv); 4691 conv_type = gaim_conversation_get_type(conv);
4691 gtkwin = GAIM_GTK_WINDOW(win); 4692 gtkwin = GAIM_GTK_WINDOW(win);
4824 gtkconv->icon = gtk_image_new(); 4825 gtkconv->icon = gtk_image_new();
4825 gtkconv->menu_icon = gtk_image_new(); 4826 gtkconv->menu_icon = gtk_image_new();
4826 update_tab_icon(conv); 4827 update_tab_icon(conv);
4827 4828
4828 /* Tab label. */ 4829 /* Tab label. */
4829 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); 4830 gtkconv->tab_label = gtk_label_new(tmp_lab = gaim_conversation_get_title(conv));
4830 #if GTK_CHECK_VERSION(2,6,0) 4831 #if GTK_CHECK_VERSION(2,6,0)
4831 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); 4832 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
4833 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6);
4832 #endif 4834 #endif
4833 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); 4835 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv));
4834 #if 0 4836 #if 0
4835 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); 4837 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5);
4836 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); 4838 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0);
4999 5001
5000 gtkconv->convs = g_list_remove(gtkconv->convs, conv); 5002 gtkconv->convs = g_list_remove(gtkconv->convs, conv);
5001 /* Don't destroy ourselves until all our convos are gone */ 5003 /* Don't destroy ourselves until all our convos are gone */
5002 if (gtkconv->convs) 5004 if (gtkconv->convs)
5003 return; 5005 return;
5004 5006
5005 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ 5007 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */
5006 gaim_request_close_with_handle(conv); 5008 gaim_request_close_with_handle(conv);
5007 5009
5008 gtk_widget_destroy(gtkconv->tab_cont); 5010 gtk_widget_destroy(gtkconv->tab_cont);
5009 g_object_unref(gtkconv->tab_cont); 5011 g_object_unref(gtkconv->tab_cont);
5350 } 5352 }
5351 } 5353 }
5352 5354
5353 if(alias_escaped) 5355 if(alias_escaped)
5354 g_free(alias_escaped); 5356 g_free(alias_escaped);
5355 5357
5356 /* Are we in a chat where we can tell which users are buddies? */ 5358 /* Are we in a chat where we can tell which users are buddies? */
5357 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && 5359 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
5358 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { 5360 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
5359 5361
5360 /* Bold buddies to make them stand out from non-buddies. */ 5362 /* Bold buddies to make them stand out from non-buddies. */