pidgin/gtkutils.c

changeset 37422
07dcc28b6039
parent 37406
98ec68212b1f
child 37540
b59120d66fdd
equal deleted inserted replaced
37421:ee3bd4532a33 37422:07dcc28b6039
207 button = gtk_button_new(); 207 button = gtk_button_new();
208 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); 208 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
209 209
210 /* don't allow focus on the close button */ 210 /* don't allow focus on the close button */
211 gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE); 211 gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE);
212
213 /* set style to make it as small as possible */
214 #if !GTK_CHECK_VERSION(3,0,0)
215 gtk_widget_set_name(button, "pidgin-small-close-button");
216 #endif
217 212
218 gtk_widget_show(image); 213 gtk_widget_show(image);
219 214
220 gtk_container_add(GTK_CONTAINER(button), image); 215 gtk_container_add(GTK_CONTAINER(button), image);
221 216
2114 return; 2109 return;
2115 2110
2116 cursor = gdk_cursor_new(cursor_type); 2111 cursor = gdk_cursor_new(cursor_type);
2117 gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); 2112 gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
2118 2113
2119 #if GTK_CHECK_VERSION(3,0,0)
2120 g_object_unref(cursor); 2114 g_object_unref(cursor);
2121 #else
2122 gdk_cursor_unref(cursor);
2123 #endif
2124 2115
2125 gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget))); 2116 gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget)));
2126 } 2117 }
2127 2118
2128 void pidgin_clear_cursor(GtkWidget *widget) 2119 void pidgin_clear_cursor(GtkWidget *widget)
2803 pidgin_text_combo_box_entry_new(const char *default_item, GList *items) 2794 pidgin_text_combo_box_entry_new(const char *default_item, GList *items)
2804 { 2795 {
2805 GtkComboBoxText *ret = NULL; 2796 GtkComboBoxText *ret = NULL;
2806 GtkWidget *the_entry = NULL; 2797 GtkWidget *the_entry = NULL;
2807 2798
2808 #if GTK_CHECK_VERSION(2,24,0)
2809 ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new_with_entry()); 2799 ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new_with_entry());
2810 the_entry = gtk_bin_get_child(GTK_BIN(ret)); 2800 the_entry = gtk_bin_get_child(GTK_BIN(ret));
2811 #else
2812 ret = GTK_COMBO_BOX(gtk_combo_box_entry_new_text());
2813 the_entry = gtk_entry_new();
2814 gtk_container_add(GTK_CONTAINER(ret), the_entry);
2815 #endif
2816 2801
2817 if (default_item) 2802 if (default_item)
2818 gtk_entry_set_text(GTK_ENTRY(the_entry), default_item); 2803 gtk_entry_set_text(GTK_ENTRY(the_entry), default_item);
2819 2804
2820 for (; items != NULL ; items = items->next) { 2805 for (; items != NULL ; items = items->next) {
3552 gtk_widget_set_size_request(sw, width, height); 3537 gtk_widget_set_size_request(sw, width, height);
3553 if (child) { 3538 if (child) {
3554 #if GTK_CHECK_VERSION(3,8,0) 3539 #if GTK_CHECK_VERSION(3,8,0)
3555 gtk_container_add(GTK_CONTAINER(sw), child); 3540 gtk_container_add(GTK_CONTAINER(sw), child);
3556 #else 3541 #else
3557 #if GTK_CHECK_VERSION(3,0,0)
3558 if (GTK_IS_SCROLLABLE(child)) 3542 if (GTK_IS_SCROLLABLE(child))
3559 #else
3560 if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal)
3561 #endif /* GTK_CHECK_VERSION(3,0,0) */
3562 gtk_container_add(GTK_CONTAINER(sw), child); 3543 gtk_container_add(GTK_CONTAINER(sw), child);
3563 else 3544 else
3564 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child); 3545 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child);
3565 #endif /* GTK_CHECK_VERSION(3,8,0) */ 3546 #endif /* GTK_CHECK_VERSION(3,8,0) */
3566 } 3547 }
3581 pidgin_webview_class_register_protocol("file://", file_clicked_cb, file_context_menu); 3562 pidgin_webview_class_register_protocol("file://", file_clicked_cb, file_context_menu);
3582 pidgin_webview_class_register_protocol("audio://", audio_clicked_cb, audio_context_menu); 3563 pidgin_webview_class_register_protocol("audio://", audio_clicked_cb, audio_context_menu);
3583 3564
3584 /* Example custom URL handler. */ 3565 /* Example custom URL handler. */
3585 pidgin_webview_class_register_protocol("open://", open_dialog, dummy); 3566 pidgin_webview_class_register_protocol("open://", open_dialog, dummy);
3586
3587 /* Used to make small buttons */
3588 #if !GTK_CHECK_VERSION(3,0,0)
3589 gtk_rc_parse_string("style \"pidgin-small-close-button\"\n"
3590 "{\n"
3591 "GtkWidget::focus-padding = 0\n"
3592 "GtkWidget::focus-line-width = 0\n"
3593 "xthickness = 0\n"
3594 "ythickness = 0\n"
3595 "GtkContainer::border-width = 0\n"
3596 "GtkButton::inner-border = {0, 0, 0, 0}\n"
3597 "GtkButton::default-border = {0, 0, 0, 0}\n"
3598 "}\n"
3599 "widget \"*.pidgin-small-close-button\" style \"pidgin-small-close-button\"");
3600 #endif
3601 3567
3602 #ifdef _WIN32 3568 #ifdef _WIN32
3603 winpidgin_register_win32_url_handlers(); 3569 winpidgin_register_win32_url_handlers();
3604 #endif 3570 #endif
3605 3571

mercurial