| 5196 |
5196 |
| 5197 /* Quick Find {{{ */ |
5197 /* Quick Find {{{ */ |
| 5198 static gboolean |
5198 static gboolean |
| 5199 pidgin_conv_end_quickfind(PidginConversation *gtkconv) |
5199 pidgin_conv_end_quickfind(PidginConversation *gtkconv) |
| 5200 { |
5200 { |
| 5201 #if GTK_CHECK_VERSION(3,0,0) |
|
| 5202 GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); |
5201 GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); |
| 5203 gtk_style_context_remove_class(context, "not-found"); |
5202 gtk_style_context_remove_class(context, "not-found"); |
| 5204 #else |
|
| 5205 gtk_widget_modify_base(gtkconv->quickfind_entry, GTK_STATE_NORMAL, NULL); |
|
| 5206 #endif |
|
| 5207 |
5203 |
| 5208 webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(gtkconv->webview)); |
5204 webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(gtkconv->webview)); |
| 5209 gtk_widget_hide(gtkconv->quickfind_container); |
5205 gtk_widget_hide(gtkconv->quickfind_container); |
| 5210 |
5206 |
| 5211 gtk_widget_grab_focus(gtkconv->entry); |
5207 gtk_widget_grab_focus(gtkconv->entry); |
| 5217 { |
5213 { |
| 5218 switch (event->keyval) { |
5214 switch (event->keyval) { |
| 5219 case GDK_KEY_Return: |
5215 case GDK_KEY_Return: |
| 5220 case GDK_KEY_KP_Enter: |
5216 case GDK_KEY_KP_Enter: |
| 5221 if (webkit_web_view_search_text(WEBKIT_WEB_VIEW(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)), FALSE, TRUE, TRUE)) { |
5217 if (webkit_web_view_search_text(WEBKIT_WEB_VIEW(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)), FALSE, TRUE, TRUE)) { |
| 5222 #if GTK_CHECK_VERSION(3,0,0) |
|
| 5223 GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); |
5218 GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); |
| 5224 gtk_style_context_remove_class(context, "not-found"); |
5219 gtk_style_context_remove_class(context, "not-found"); |
| 5225 #else |
|
| 5226 gtk_widget_modify_base(gtkconv->quickfind_entry, GTK_STATE_NORMAL, NULL); |
|
| 5227 #endif |
|
| 5228 } else { |
5220 } else { |
| 5229 #if GTK_CHECK_VERSION(3,0,0) |
|
| 5230 GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); |
5221 GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); |
| 5231 gtk_style_context_add_class(context, "not-found"); |
5222 gtk_style_context_add_class(context, "not-found"); |
| 5232 #else |
|
| 5233 GdkColor col; |
|
| 5234 col.red = 0xffff; |
|
| 5235 col.green = 0xafff; |
|
| 5236 col.blue = 0xafff; |
|
| 5237 gtk_widget_modify_base(gtkconv->quickfind_entry, GTK_STATE_NORMAL, &col); |
|
| 5238 #endif |
|
| 5239 } |
5223 } |
| 5240 break; |
5224 break; |
| 5241 case GDK_KEY_Escape: |
5225 case GDK_KEY_Escape: |
| 5242 pidgin_conv_end_quickfind(gtkconv); |
5226 pidgin_conv_end_quickfind(gtkconv); |
| 5243 break; |
5227 break; |
| 5250 static void |
5234 static void |
| 5251 pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) |
5235 pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) |
| 5252 { |
5236 { |
| 5253 GtkWidget *widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
5237 GtkWidget *widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
| 5254 GtkWidget *label, *entry, *close; |
5238 GtkWidget *label, *entry, *close; |
| 5255 #if GTK_CHECK_VERSION(3,0,0) |
|
| 5256 GtkStyleContext *context; |
5239 GtkStyleContext *context; |
| 5257 GtkCssProvider *filter_css; |
5240 GtkCssProvider *filter_css; |
| 5258 const gchar filter_style[] = |
5241 const gchar filter_style[] = |
| 5259 ".not-found {" |
5242 ".not-found {" |
| 5260 "color: @error_fg_color;" |
5243 "color: @error_fg_color;" |
| 5261 "text-shadow: 0 1px @error_text_shadow;" |
5244 "text-shadow: 0 1px @error_text_shadow;" |
| 5262 "background-image: none;" |
5245 "background-image: none;" |
| 5263 "background-color: @error_bg_color;" |
5246 "background-color: @error_bg_color;" |
| 5264 "}"; |
5247 "}"; |
| 5265 #endif |
|
| 5266 |
5248 |
| 5267 gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); |
5249 gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); |
| 5268 |
5250 |
| 5269 close = pidgin_create_small_button(gtk_label_new("×")); |
5251 close = pidgin_create_small_button(gtk_label_new("×")); |
| 5270 gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); |
5252 gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); |
| 5273 label = gtk_label_new(_("Find:")); |
5255 label = gtk_label_new(_("Find:")); |
| 5274 gtk_box_pack_start(GTK_BOX(widget), label, FALSE, FALSE, 10); |
5256 gtk_box_pack_start(GTK_BOX(widget), label, FALSE, FALSE, 10); |
| 5275 |
5257 |
| 5276 entry = gtk_entry_new(); |
5258 entry = gtk_entry_new(); |
| 5277 gtk_box_pack_start(GTK_BOX(widget), entry, TRUE, TRUE, 0); |
5259 gtk_box_pack_start(GTK_BOX(widget), entry, TRUE, TRUE, 0); |
| 5278 #if GTK_CHECK_VERSION(3,0,0) |
|
| 5279 filter_css = gtk_css_provider_new(); |
5260 filter_css = gtk_css_provider_new(); |
| 5280 gtk_css_provider_load_from_data(filter_css, filter_style, -1, NULL); |
5261 gtk_css_provider_load_from_data(filter_css, filter_style, -1, NULL); |
| 5281 context = gtk_widget_get_style_context(entry); |
5262 context = gtk_widget_get_style_context(entry); |
| 5282 gtk_style_context_add_provider(context, |
5263 gtk_style_context_add_provider(context, |
| 5283 GTK_STYLE_PROVIDER(filter_css), |
5264 GTK_STYLE_PROVIDER(filter_css), |
| 5284 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
5265 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
| 5285 #endif |
|
| 5286 |
5266 |
| 5287 gtkconv->quickfind_entry = entry; |
5267 gtkconv->quickfind_entry = entry; |
| 5288 gtkconv->quickfind_container = widget; |
5268 gtkconv->quickfind_container = widget; |
| 5289 |
5269 |
| 5290 /* Hook to signals and stuff */ |
5270 /* Hook to signals and stuff */ |
| 8916 theme_dir = g_build_filename(PURPLE_DATADIR, "pidgin", "theme", NULL); |
8896 theme_dir = g_build_filename(PURPLE_DATADIR, "pidgin", "theme", NULL); |
| 8917 #endif |
8897 #endif |
| 8918 default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation"); |
8898 default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation"); |
| 8919 g_free(theme_dir); |
8899 g_free(theme_dir); |
| 8920 |
8900 |
| 8921 #if !GTK_CHECK_VERSION(3,0,0) |
|
| 8922 { |
|
| 8923 /* Set default tab colors */ |
|
| 8924 GString *str = g_string_new(NULL); |
|
| 8925 GtkSettings *settings = gtk_settings_get_default(); |
|
| 8926 GtkStyle *parent = gtk_rc_get_style_by_paths(settings, "tab-container.tab-label*", NULL, G_TYPE_NONE), *now; |
|
| 8927 struct { |
|
| 8928 const char *stylename; |
|
| 8929 const char *labelname; |
|
| 8930 const char *color; |
|
| 8931 } styles[] = { |
|
| 8932 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"}, |
|
| 8933 {"pidgin_tab_label_typed_default", "tab-label-typed", "#c4a000"}, |
|
| 8934 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"}, |
|
| 8935 {"pidgin_tab_label_unreadchat_default", "tab-label-unreadchat", "#cc0000"}, |
|
| 8936 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"}, |
|
| 8937 {NULL, NULL, NULL} |
|
| 8938 }; |
|
| 8939 int iter; |
|
| 8940 for (iter = 0; styles[iter].stylename; iter++) { |
|
| 8941 now = gtk_rc_get_style_by_paths(settings, styles[iter].labelname, NULL, G_TYPE_NONE); |
|
| 8942 if (parent == now || |
|
| 8943 (parent && now && parent->rc_style == now->rc_style)) { |
|
| 8944 g_string_append_printf(str, "style \"%s\" {\n" |
|
| 8945 "fg[ACTIVE] = \"%s\"\n" |
|
| 8946 "}\n" |
|
| 8947 "widget \"*%s\" style \"%s\"\n", |
|
| 8948 styles[iter].stylename, |
|
| 8949 styles[iter].color, |
|
| 8950 styles[iter].labelname, styles[iter].stylename); |
|
| 8951 } |
|
| 8952 } |
|
| 8953 gtk_rc_parse_string(str->str); |
|
| 8954 g_string_free(str, TRUE); |
|
| 8955 gtk_rc_reset_styles(settings); |
|
| 8956 } |
|
| 8957 #endif |
|
| 8958 } |
8901 } |
| 8959 |
8902 |
| 8960 static void |
8903 static void |
| 8961 pidgin_conversations_pre_uninit(void) |
8904 pidgin_conversations_pre_uninit(void) |
| 8962 { |
8905 { |
| 9240 |
9183 |
| 9241 static void |
9184 static void |
| 9242 notebook_init_grab(PidginConvWindow *gtkwin, GtkWidget *widget, GdkEvent *event) |
9185 notebook_init_grab(PidginConvWindow *gtkwin, GtkWidget *widget, GdkEvent *event) |
| 9243 { |
9186 { |
| 9244 static GdkCursor *cursor = NULL; |
9187 static GdkCursor *cursor = NULL; |
| 9245 #if GTK_CHECK_VERSION(3,0,0) |
|
| 9246 GdkDevice *device; |
9188 GdkDevice *device; |
| 9247 #endif |
|
| 9248 |
9189 |
| 9249 gtkwin->in_drag = TRUE; |
9190 gtkwin->in_drag = TRUE; |
| 9250 |
9191 |
| 9251 if (gtkwin->drag_leave_signal) { |
9192 if (gtkwin->drag_leave_signal) { |
| 9252 g_signal_handler_disconnect(G_OBJECT(widget), |
9193 g_signal_handler_disconnect(G_OBJECT(widget), |
| 9257 if (cursor == NULL) |
9198 if (cursor == NULL) |
| 9258 cursor = gdk_cursor_new(GDK_FLEUR); |
9199 cursor = gdk_cursor_new(GDK_FLEUR); |
| 9259 |
9200 |
| 9260 /* Grab the pointer */ |
9201 /* Grab the pointer */ |
| 9261 gtk_grab_add(gtkwin->notebook); |
9202 gtk_grab_add(gtkwin->notebook); |
| 9262 #if GTK_CHECK_VERSION(3,0,0) |
|
| 9263 device = gdk_event_get_device(event); |
9203 device = gdk_event_get_device(event); |
| 9264 if (!gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) |
9204 if (!gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) |
| 9265 gdk_device_grab(device, gtk_widget_get_window(gtkwin->notebook), |
9205 gdk_device_grab(device, gtk_widget_get_window(gtkwin->notebook), |
| 9266 GDK_OWNERSHIP_WINDOW, FALSE, |
9206 GDK_OWNERSHIP_WINDOW, FALSE, |
| 9267 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
9207 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
| 9268 cursor, gdk_event_get_time(event)); |
9208 cursor, gdk_event_get_time(event)); |
| 9269 #else |
|
| 9270 #ifndef _WIN32 |
|
| 9271 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will |
|
| 9272 always be true after a button press. */ |
|
| 9273 if (!gdk_pointer_is_grabbed()) |
|
| 9274 #endif |
|
| 9275 gdk_pointer_grab(gtk_widget_get_window(gtkwin->notebook), FALSE, |
|
| 9276 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
|
| 9277 NULL, cursor, gdk_event_get_time(event)); |
|
| 9278 #endif |
|
| 9279 } |
9209 } |
| 9280 |
9210 |
| 9281 static gboolean |
9211 static gboolean |
| 9282 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win) |
9212 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win) |
| 9283 { |
9213 { |
| 9539 PidginConversation *active_gtkconv; |
9469 PidginConversation *active_gtkconv; |
| 9540 PidginConversation *gtkconv; |
9470 PidginConversation *gtkconv; |
| 9541 gint dest_page_num = 0; |
9471 gint dest_page_num = 0; |
| 9542 gboolean new_window = FALSE; |
9472 gboolean new_window = FALSE; |
| 9543 gboolean to_right = FALSE; |
9473 gboolean to_right = FALSE; |
| 9544 #if GTK_CHECK_VERSION(3,0,0) |
|
| 9545 GdkDevice *device; |
9474 GdkDevice *device; |
| 9546 #endif |
|
| 9547 |
9475 |
| 9548 /* |
9476 /* |
| 9549 * Don't check to make sure that the event's window matches the |
9477 * Don't check to make sure that the event's window matches the |
| 9550 * widget's, because we may be getting an event passed on from the |
9478 * widget's, because we may be getting an event passed on from the |
| 9551 * close button. |
9479 * close button. |
| 9552 */ |
9480 */ |
| 9553 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) |
9481 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) |
| 9554 return FALSE; |
9482 return FALSE; |
| 9555 |
9483 |
| 9556 #if GTK_CHECK_VERSION(3,0,0) |
|
| 9557 device = gdk_event_get_device((GdkEvent *)e); |
9484 device = gdk_event_get_device((GdkEvent *)e); |
| 9558 if (gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) { |
9485 if (gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) { |
| 9559 gdk_device_ungrab(device, gdk_event_get_time((GdkEvent *)e)); |
9486 gdk_device_ungrab(device, gdk_event_get_time((GdkEvent *)e)); |
| 9560 gtk_grab_remove(widget); |
9487 gtk_grab_remove(widget); |
| 9561 } |
9488 } |
| 9562 #else |
|
| 9563 if (gdk_pointer_is_grabbed()) { |
|
| 9564 gdk_pointer_ungrab(gdk_event_get_time((GdkEvent *)e)); |
|
| 9565 gtk_grab_remove(widget); |
|
| 9566 } |
|
| 9567 #endif |
|
| 9568 |
9489 |
| 9569 if (!win->in_predrag && !win->in_drag) |
9490 if (!win->in_predrag && !win->in_drag) |
| 9570 return FALSE; |
9491 return FALSE; |
| 9571 |
9492 |
| 9572 /* Disconnect the motion signal. */ |
9493 /* Disconnect the motion signal. */ |
| 10446 gtk_widget_show(gtkconv->icon); |
10365 gtk_widget_show(gtkconv->icon); |
| 10447 update_tab_icon(conv); |
10366 update_tab_icon(conv); |
| 10448 |
10367 |
| 10449 /* Tab label. */ |
10368 /* Tab label. */ |
| 10450 gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv)); |
10369 gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv)); |
| 10451 #if GTK_CHECK_VERSION(3,0,0) |
|
| 10452 set_default_tab_colors(gtkconv->tab_label); |
10370 set_default_tab_colors(gtkconv->tab_label); |
| 10453 #endif |
|
| 10454 gtk_widget_set_name(gtkconv->tab_label, "tab-label"); |
10371 gtk_widget_set_name(gtkconv->tab_label, "tab-label"); |
| 10455 |
10372 |
| 10456 gtkconv->menu_tabby = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
10373 gtkconv->menu_tabby = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
| 10457 gtkconv->menu_label = gtk_label_new(tmp_lab); |
10374 gtkconv->menu_label = gtk_label_new(tmp_lab); |
| 10458 gtk_box_pack_start(GTK_BOX(gtkconv->menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0); |
10375 gtk_box_pack_start(GTK_BOX(gtkconv->menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0); |
| 10669 PidginConvWindow *win; |
10586 PidginConvWindow *win; |
| 10670 GdkWindow *gdkwin; |
10587 GdkWindow *gdkwin; |
| 10671 GList *l; |
10588 GList *l; |
| 10672 int x, y; |
10589 int x, y; |
| 10673 |
10590 |
| 10674 #if GTK_CHECK_VERSION(3,0,0) |
|
| 10675 gdkwin = gdk_device_get_window_at_position(gdk_event_get_device(event), |
10591 gdkwin = gdk_device_get_window_at_position(gdk_event_get_device(event), |
| 10676 &x, &y); |
10592 &x, &y); |
| 10677 #else |
|
| 10678 gdkwin = gdk_window_at_pointer(&x, &y); |
|
| 10679 #endif |
|
| 10680 |
10593 |
| 10681 if (gdkwin) |
10594 if (gdkwin) |
| 10682 gdkwin = gdk_window_get_toplevel(gdkwin); |
10595 gdkwin = gdk_window_get_toplevel(gdkwin); |
| 10683 |
10596 |
| 10684 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { |
10597 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { |