[Geany-Devel] [PATCH geany-plugins] GeanyLaTeX: Fix GTK+3 support

Quentin Glidic sardemff7+geany at xxxxx
Fri Apr 5 08:34:05 UTC 2013


From: Quentin Glidic <sardemff7+git at sardemff7.net>

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---

Sorry, I missed some warnings in the gtk_table deprecation ones
Here is the full patch

 build/geanylatex.m4                |  1 -
 geanylatex/src/bibtex.c            |  2 +-
 geanylatex/src/geanylatex.c        | 74 +++++++++++++++++++-------------------
 geanylatex/src/latexenvironments.c |  8 ++---
 geanylatex/src/reftex.c            |  2 +-
 geanylatex/src/templates.c         |  2 +-
 6 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/build/geanylatex.m4 b/build/geanylatex.m4
index 398a368..d110416 100644
--- a/build/geanylatex.m4
+++ b/build/geanylatex.m4
@@ -1,7 +1,6 @@
 AC_DEFUN([GP_CHECK_GEANYLATEX],
 [
     GP_ARG_DISABLE([GeanyLaTeX], [auto])
-    GP_CHECK_PLUGIN_GTK2_ONLY([GeanyLaTeX])
     GP_COMMIT_PLUGIN_STATUS([GeanyLaTeX])
     AC_CONFIG_FILES([
         geanylatex/Makefile
diff --git a/geanylatex/src/bibtex.c b/geanylatex/src/bibtex.c
index 03aa6a4..63b4e64 100644
--- a/geanylatex/src/bibtex.c
+++ b/geanylatex/src/bibtex.c
@@ -218,7 +218,7 @@ void glatex_parse_bib_file(const gchar* file, gpointer combobox)
 				{
 					tmp = glatex_parseLine_bib(bib_entries[i]);
 					tmp_label_name = g_strdup(tmp->label_name);
-					gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), tmp_label_name);
+					gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), tmp_label_name);
 					g_free(tmp);
 					g_free(tmp_label_name);
 				}
diff --git a/geanylatex/src/geanylatex.c b/geanylatex/src/geanylatex.c
index 4666d93..d18bf3e 100644
--- a/geanylatex/src/geanylatex.c
+++ b/geanylatex/src/geanylatex.c
@@ -305,10 +305,10 @@ plugin_configure(GtkDialog * dialog)
 	config_widgets.lower_selection_on_smallcaps = gtk_check_button_new_with_label(
 		_("Lower selection when formating smallcaps (\\textsc{})"));
 
-	config_widgets.glatex_autocompletion_active = gtk_combo_box_new_text();
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(config_widgets.glatex_autocompletion_active), 0,
+	config_widgets.glatex_autocompletion_active = gtk_combo_box_text_new();
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(config_widgets.glatex_autocompletion_active), 0,
 		_("Don't care about this inside plugin"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(config_widgets.glatex_autocompletion_active), 1,
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(config_widgets.glatex_autocompletion_active), 1,
 		_("Always perform autocompletion on LaTeX"));
 
 	/* Configuration for auto completion feature */
@@ -889,7 +889,7 @@ glatex_insert_ref_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 	gtk_table_set_row_spacings(GTK_TABLE(table), 6);
 
 	label_ref = gtk_label_new(_("Reference name:"));
-	textbox_ref = gtk_combo_box_entry_new_text();
+	textbox_ref = gtk_combo_box_text_new_with_entry();
 
 	if (doc->real_path != NULL)
 	{
@@ -941,8 +941,8 @@ glatex_insert_ref_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 		gchar *ref_string = NULL;
 		GString *template_string = NULL;
 
-		ref_string = g_strdup(gtk_combo_box_get_active_text(
-			GTK_COMBO_BOX(textbox_ref)));
+		ref_string = g_strdup(gtk_combo_box_text_get_active_text(
+			GTK_COMBO_BOX_TEXT(textbox_ref)));
 
 		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio1)) == TRUE)
 		{
@@ -1254,7 +1254,7 @@ on_insert_bibtex_dialog_activate(G_GNUC_UNUSED GtkMenuItem *menuitem,
 	gtk_table_set_row_spacings(GTK_TABLE(table), 6);
 
 	label = gtk_label_new(_("BibTeX reference name:"));
-	textbox = gtk_combo_box_entry_new_text();
+	textbox = gtk_combo_box_text_new_with_entry();
 
 	if (doc->real_path != NULL)
 	{
@@ -1299,8 +1299,8 @@ on_insert_bibtex_dialog_activate(G_GNUC_UNUSED GtkMenuItem *menuitem,
 		gchar *ref_string = NULL;
 		GString *template_string = NULL;
 
-		ref_string = g_strdup(gtk_combo_box_get_active_text(
-			GTK_COMBO_BOX(textbox)));
+		ref_string = g_strdup(gtk_combo_box_text_get_active_text(
+			GTK_COMBO_BOX_TEXT(textbox)));
 
 		if (ref_string != NULL)
 		{
@@ -1364,8 +1364,8 @@ on_wizard_response(G_GNUC_UNUSED GtkDialog *dialog, gint response,
 			enc_latex_char = g_strconcat("\\usepackage[",
 				latex_encodings[encoding_int].latex,"]{inputenc}\n", NULL);
 		}
-		fontsize = gtk_combo_box_get_active_text(
-			GTK_COMBO_BOX(glatex_wizard.fontsize_combobox));
+		fontsize = gtk_combo_box_text_get_active_text(
+			GTK_COMBO_BOX_TEXT(glatex_wizard.fontsize_combobox));
 		author = g_strdup(gtk_entry_get_text(GTK_ENTRY(glatex_wizard.author_textbox)));
 		date = g_strdup(gtk_entry_get_text(GTK_ENTRY(glatex_wizard.date_textbox)));
 		title = g_strdup(gtk_entry_get_text(GTK_ENTRY(glatex_wizard.title_textbox)));
@@ -1730,7 +1730,7 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 	 *  adds default one */
 	label_template = gtk_label_new(_("Template:"));
 
-	glatex_wizard.template_combobox = gtk_combo_box_new_text();
+	glatex_wizard.template_combobox = gtk_combo_box_text_new();
 	ui_widget_set_tooltip_text(glatex_wizard.template_combobox,
 		_("Set the template which should be used for creating the new document"));
 	gtk_misc_set_alignment(GTK_MISC(label_template), 0, 0.5);
@@ -1740,7 +1740,7 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 
 	/*  Adding default/build in templates to pull down and set the generic
 	 * 	one as default */
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.template_combobox),
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.template_combobox),
 		LATEX_WIZARD_TEMPLATE_DEFAULT, _("Default"));
 	gtk_combo_box_set_active(GTK_COMBO_BOX(glatex_wizard.template_combobox),
 		LATEX_WIZARD_TEMPLATE_DEFAULT);
@@ -1753,18 +1753,18 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 
 	/*  Documentclass */
 	label_documentclass = gtk_label_new(_("Documentclass:"));
-	glatex_wizard.documentclass_combobox = gtk_combo_box_new_text();
+	glatex_wizard.documentclass_combobox = gtk_combo_box_text_new();
 	ui_widget_set_tooltip_text(glatex_wizard.documentclass_combobox,
 		_("Choose the kind of document you want to write"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.documentclass_combobox), 0,
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.documentclass_combobox), 0,
 		_("Book"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.documentclass_combobox), 1,
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.documentclass_combobox), 1,
 		_("Article"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.documentclass_combobox), 2,
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.documentclass_combobox), 2,
 		_("Report"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.documentclass_combobox), 3,
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.documentclass_combobox), 3,
 		_("Letter"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.documentclass_combobox), 4,
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.documentclass_combobox), 4,
 		_("Presentation"));
 
 	gtk_combo_box_set_active(GTK_COMBO_BOX(glatex_wizard.documentclass_combobox), 0);
@@ -1777,12 +1777,12 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 	/*  Encoding */
 	label_encoding = gtk_label_new(_("Encoding:"));
 
-	glatex_wizard.encoding_combobox = gtk_combo_box_new_text();
+	glatex_wizard.encoding_combobox = gtk_combo_box_text_new();
 	ui_widget_set_tooltip_text(glatex_wizard.encoding_combobox,
 		_("Set the encoding for your new document"));
 	for (i = 0; i < LATEX_ENCODINGS_MAX; i++)
 	{
-		gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.encoding_combobox), i,
+		gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.encoding_combobox), i,
 					  latex_encodings[i].name);
 	}
 
@@ -1796,10 +1796,10 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 
 	/*  fontsize */
 	label_fontsize = gtk_label_new(_("Font size"));
-	glatex_wizard.fontsize_combobox = gtk_combo_box_entry_new_text();
-	gtk_combo_box_append_text(GTK_COMBO_BOX(glatex_wizard.fontsize_combobox),"10pt");
-	gtk_combo_box_append_text(GTK_COMBO_BOX(glatex_wizard.fontsize_combobox),"11pt");
-	gtk_combo_box_append_text(GTK_COMBO_BOX(glatex_wizard.fontsize_combobox),"12pt");
+	glatex_wizard.fontsize_combobox = gtk_combo_box_text_new_with_entry();
+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(glatex_wizard.fontsize_combobox),"10pt");
+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(glatex_wizard.fontsize_combobox),"11pt");
+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(glatex_wizard.fontsize_combobox),"12pt");
 	ui_widget_set_tooltip_text(glatex_wizard.fontsize_combobox,
 		_("Set the default font size of your new document"));
 
@@ -1858,12 +1858,12 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 
 	/*  Papersize */
 	label_papersize = gtk_label_new(_("Paper size:"));
-	glatex_wizard.papersize_combobox = gtk_combo_box_new_text();
+	glatex_wizard.papersize_combobox = gtk_combo_box_text_new();
 	ui_widget_set_tooltip_text(glatex_wizard.papersize_combobox,
 		_("Choose the paper format for the newly created document"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.papersize_combobox), 0, "A4");
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.papersize_combobox), 1, "A5");
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.papersize_combobox), 2, "A6");
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.papersize_combobox), 0, "A4");
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.papersize_combobox), 1, "A5");
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.papersize_combobox), 2, "A6");
 
 	gtk_combo_box_set_active(GTK_COMBO_BOX(glatex_wizard.papersize_combobox), 0);
 
@@ -1874,12 +1874,12 @@ glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
 
 	/* Paper direction */
 	label_orientation = gtk_label_new(_("Paper Orientation:"));
-	glatex_wizard.orientation_combobox = gtk_combo_box_new_text();
+	glatex_wizard.orientation_combobox = gtk_combo_box_text_new();
 	ui_widget_set_tooltip_text(glatex_wizard.orientation_combobox,
 		_("Choose the paper orientation for the newly created document"));
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.orientation_combobox), 0, "Default");
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.orientation_combobox), 1, "Portrait");
-	gtk_combo_box_insert_text(GTK_COMBO_BOX(glatex_wizard.orientation_combobox), 2, "Landscape");
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.orientation_combobox), 0, "Default");
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.orientation_combobox), 1, "Portrait");
+	gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(glatex_wizard.orientation_combobox), 2, "Landscape");
 
 	gtk_combo_box_set_active(GTK_COMBO_BOX(glatex_wizard.orientation_combobox), 0);
 
@@ -2105,8 +2105,8 @@ add_menu_to_menubar(void)
 	{
 		/* Build up menu for menubar */
 		menu_latex = gtk_menu_item_new_with_mnemonic(_("_LaTeX"));
-		gtk_menu_shell_insert(
-			menubar, menu_latex, g_list_length(menubar->children)-1);
+		gtk_menu_shell_append(
+			menubar, menu_latex);
 
 		menu_latex_menu = gtk_menu_new();
 		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_latex), menu_latex_menu);
@@ -2255,8 +2255,8 @@ add_menu_to_menubar(void)
 	if (menu_bibtex == NULL)
 	{
 		menu_bibtex = gtk_menu_item_new_with_mnemonic(_("_BibTeX"));
-		gtk_menu_shell_insert(
-			menubar, menu_bibtex, g_list_length(menubar->children)-1);
+		gtk_menu_shell_append(
+			menubar, menu_bibtex);
 
 		menu_bibtex_menu = gtk_menu_new();
 		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_bibtex), menu_bibtex_menu);
diff --git a/geanylatex/src/latexenvironments.c b/geanylatex/src/latexenvironments.c
index 7a192d7..21b310c 100644
--- a/geanylatex/src/latexenvironments.c
+++ b/geanylatex/src/latexenvironments.c
@@ -206,12 +206,12 @@ glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem *menuitem,
 	gtk_table_set_row_spacings(GTK_TABLE(table), 6);
 
 	label_env = gtk_label_new(_("Environment:"));
-	textbox_env = gtk_combo_box_entry_new_text();
+	textbox_env = gtk_combo_box_text_new_with_entry();
 
 	max = glatex_count_menu_entries(glatex_environment_array, -1);
 	for (i = 0; i < max; i++)
 	{
-		gtk_combo_box_append_text(GTK_COMBO_BOX(textbox_env),
+		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(textbox_env),
 								  glatex_environment_array[i].label);
 	}
 
@@ -235,8 +235,8 @@ glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem *menuitem,
 	{
 		gchar *env_string = NULL;
 
-		env_string = g_strdup(gtk_combo_box_get_active_text(
-			GTK_COMBO_BOX(textbox_env)));
+		env_string = g_strdup(gtk_combo_box_text_get_active_text(
+			GTK_COMBO_BOX_TEXT(textbox_env)));
 
 		if (env_string != NULL)
 		{
diff --git a/geanylatex/src/reftex.c b/geanylatex/src/reftex.c
index c827cfd..fd7a528 100644
--- a/geanylatex/src/reftex.c
+++ b/geanylatex/src/reftex.c
@@ -46,7 +46,7 @@ void glatex_parse_aux_file(gchar *file, gpointer combobox)
 				{
 					tmp = glatex_parseLine(aux_entries[i]);
 					tmp_label_name = g_strdup(tmp->label_name);
-					gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), tmp_label_name);
+					gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), tmp_label_name);
 					g_free(tmp);
 					g_free(tmp_label_name);
 				}
diff --git a/geanylatex/src/templates.c b/geanylatex/src/templates.c
index f91be54..92a6f9c 100644
--- a/geanylatex/src/templates.c
+++ b/geanylatex/src/templates.c
@@ -100,7 +100,7 @@ void glatex_add_templates_to_combobox(GPtrArray *templates, GtkWidget *combobox)
 	for (i = 0; i < templates->len; i++)
 	{
 		tmp = g_ptr_array_index(templates,i);
-		gtk_combo_box_append_text(GTK_COMBO_BOX(combobox),
+		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox),
 			tmp->label);
 	}
 }
-- 
1.8.2



More information about the Devel mailing list