]
トップ «前の日記(2012-07-13) 最新 次の日記(2012-08-06)» 編集

Yukiharu YABUKI の tDiary



このtDiaryを検索します。

2012-07-14 [長年日記]

_ gtk_combo_box_text_append

gtk2からgtk3に移行する手助けのドキュメントとして、Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and GtkComboBoxEntry(http://developer.gnome.org/gtk/2.24/gtk-migrating-GtkComboBox.html)を参考にした。このドキュメントの「存在」は、かなりありがたかったのですが、これを見ながら、patchを作ろうかと作業していました。

作業を進めていくと、

GtkWidget *combo_box;
combo_box = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "First Item");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Second Item");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Third Item");
の例でgtk_combo_box_text_append の関数を使う例があるわけですが、実際にコンパイルすると、
scim_prime_imengine_setup.cpp:848:78: error: too few arguments to function 'void gtk_combo_box_text_append(GtkComboBoxText*, const gchar*, const gchar*)'
In file included from /usr/include/gtk-3.0/gtk/gtk.h:84:0,
                 from scim_prime_imengine_setup.cpp:29:
/usr/include/gtk-3.0/gtk/gtkcomboboxtext.h:79:15: note: declared here
scim_prime_imengine_setup.cpp:849:68: error: too few arguments to function 'void gtk_combo_box_text_append(GtkComboBoxText*, const gchar*, const gchar*)'
In file included from /usr/include/gtk-3.0/gtk/gtk.h:84:0,
                 from scim_prime_imengine_setup.cpp:29:
/usr/include/gtk-3.0/gtk/gtkcomboboxtext.h:79:15: note: declared here
のようなエラーが出て、引数の数がちがうんじゃねーの?とか怒られてます。ということで、今となってはドキュメントをそのままパクってもダメなので、ちょっとヘッダーファイルを確認してから、実際の使い方を学ばねばなりません。