Compilation fixes for Gtk+ 3.0

This commit is contained in:
Pierre Pronchery 2012-03-23 04:49:17 +00:00
parent bff1c2d391
commit ef1b66f74d
4 changed files with 46 additions and 4 deletions

View File

@ -153,12 +153,26 @@ static int _debug_init(ModemPlugin * modem)
gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
gtk_size_group_add_widget(group, widget);
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 0);
#if GTK_CHECK_VERSION(3, 0, 0)
debug->folder = gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->folder), NULL,
"Unknown");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->folder), NULL,
"Inbox");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->folder), NULL,
"Sent");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->folder), NULL,
"Drafts");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->folder), NULL,
"Trash");
#else
debug->folder = gtk_combo_box_new_text();
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->folder), "Unknown");
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->folder), "Inbox");
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->folder), "Sent");
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->folder), "Drafts");
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->folder), "Trash");
#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(debug->folder), 1);
gtk_box_pack_start(GTK_BOX(hbox), debug->folder, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);

View File

@ -186,12 +186,14 @@ static Debug * _debug_init(PhonePluginHelper * helper)
/* modem requests */
hbox = gtk_hbox_new(FALSE, 4);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 4);
debug->requests = gtk_combo_box_new_text();
for(i = 0; _debug_modem_requests[i].name != NULL; i++)
#if GTK_CHECK_VERSION(3, 0, 0)
debug->requests = gtk_combo_box_text_new();
for(i = 0; _debug_modem_requests[i].name != NULL; i++)
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->requests),
NULL, _debug_modem_requests[i].name);
#else
debug->requests = gtk_combo_box_new_text();
for(i = 0; _debug_modem_requests[i].name != NULL; i++)
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->requests),
_debug_modem_requests[i].name);
#endif
@ -206,12 +208,14 @@ static Debug * _debug_init(PhonePluginHelper * helper)
/* modem triggers */
hbox = gtk_hbox_new(FALSE, 4);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 4);
debug->triggers = gtk_combo_box_new_text();
for(i = 0; _debug_modem_triggers[i].name != NULL; i++)
#if GTK_CHECK_VERSION(3, 0, 0)
debug->triggers = gtk_combo_box_text_new();
for(i = 0; _debug_modem_triggers[i].name != NULL; i++)
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(debug->triggers),
NULL, _debug_modem_triggers[i].name);
#else
debug->triggers = gtk_combo_box_new_text();
for(i = 0; _debug_modem_triggers[i].name != NULL; i++)
gtk_combo_box_append_text(GTK_COMBO_BOX(debug->triggers),
_debug_modem_triggers[i].name);
#endif

View File

@ -322,10 +322,18 @@ static void _profiles_settings(Profiles * profiles)
G_CALLBACK(_on_settings_closex), profiles);
vbox = gtk_vbox_new(FALSE, 0);
/* combo */
#if GTK_CHECK_VERSION(3, 0, 0)
profiles->pr_combo = gtk_combo_box_text_new();
for(i = 0; i < profiles->profiles_cnt; i++)
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(
profiles->pr_combo), NULL,
profiles->profiles[i].name);
#else
profiles->pr_combo = gtk_combo_box_new_text();
for(i = 0; i < profiles->profiles_cnt; i++)
gtk_combo_box_append_text(GTK_COMBO_BOX(profiles->pr_combo),
profiles->profiles[i].name);
#endif
g_signal_connect_swapped(profiles->pr_combo, "changed", G_CALLBACK(
_on_settings_changed), profiles);
gtk_box_pack_start(GTK_BOX(vbox), profiles->pr_combo, FALSE, TRUE, 0);

View File

@ -194,10 +194,17 @@ static void _settings_window(USSD * ussd)
gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
gtk_size_group_add_widget(group, widget);
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 0);
#if GTK_CHECK_VERSION(3, 0, 0)
ussd->operators = gtk_combo_box_text_new();
for(i = 0; _ussd_operators[i].name != NULL; i++)
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(ussd->operators),
NULL, _ussd_operators[i].name);
#else
ussd->operators = gtk_combo_box_new_text();
for(i = 0; _ussd_operators[i].name != NULL; i++)
gtk_combo_box_append_text(GTK_COMBO_BOX(ussd->operators),
_ussd_operators[i].name);
#endif
g_signal_connect_swapped(ussd->operators, "changed", G_CALLBACK(
_ussd_on_operators_changed), ussd);
gtk_box_pack_start(GTK_BOX(hbox), ussd->operators, TRUE, TRUE, 0);
@ -208,7 +215,11 @@ static void _settings_window(USSD * ussd)
gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
gtk_size_group_add_widget(group, widget);
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 0);
#if GTK_CHECK_VERSION(3, 0, 0)
ussd->codes = gtk_combo_box_text_new();
#else
ussd->codes = gtk_combo_box_new_text();
#endif
gtk_box_pack_start(GTK_BOX(hbox), ussd->codes, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
/* send */
@ -253,8 +264,13 @@ static void _ussd_on_operators_changed(gpointer data)
i = gtk_combo_box_get_active(GTK_COMBO_BOX(ussd->operators));
codes = _ussd_operators[i].codes;
for(i = 0; codes[i].name != NULL; i++)
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(ussd->codes),
NULL, codes[i].name);
#else
gtk_combo_box_append_text(GTK_COMBO_BOX(ussd->codes),
codes[i].name);
#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(ussd->codes), 0);
}