[Pidgin] #7582: some codes need add support for gtk+-2.4

Pidgin trac at pidgin.im
Tue Nov 18 21:28:46 EST 2008


#7582: some codes need add support for gtk+-2.4
--------------------+-------------------------------------------------------
Reporter:  rfan.cn  |        Type:  patch                                 
  Status:  new      |   Component:  pidgin (gtk)                          
 Version:  2.5.2    |    Keywords:  gtkutils gtk_combo_box_get_active_text
--------------------+-------------------------------------------------------
 In file gtkutils.c,
 function "combo_box_changed" need to be enhanced to add support for
 gtk+2.4.

 {{{

 static void
 combo_box_changed_cb(GtkComboBox *combo_box, GtkEntry *entry)
 {
         char *text = gtk_combo_box_get_active_text(combo_box);
         gtk_entry_set_text(entry, text ? text : "");
         g_free(text);
 }

 }}}

 From the glib document, gtk_combo_box_get_active_text only available since
 gtk+-2.6, if we compile it in RHEL4(which shipped with gtk-2.4)
 environment, it will report error as no reference of this function.

 it should be changed as following:

 {{{
 static void
 combo_box_changed_cb(GtkComboBox *combo_box, GtkEntry *entry)
 {

 #if GTK_CHECK_VERSION(2, 6, 0)
         char *text = gtk_combo_box_get_active_text(combo_box);
 #else
         GtkWidget *widget = gtk_bin_get_child(GTK_BIN(combo_box));
         char *text = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
 #endif
         gtk_entry_set_text(entry, text ? text : "");
         g_free(text);
 }

 }}}

-- 
Ticket URL: <http://developer.pidgin.im/ticket/7582>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list