Revision: 516 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=516&view=rev Author: frlan Date: 2009-02-28 13:23:12 +0000 (Sat, 28 Feb 2009)
Log Message: ----------- GeanyLaTeX: Moved some of the insert environment related code to latexenvironments.[c|h]
Modified Paths: -------------- trunk/geanylatex/src/geanylatex.c trunk/geanylatex/src/latexenvironments.c trunk/geanylatex/src/latexenvironments.h
Modified: trunk/geanylatex/src/geanylatex.c =================================================================== --- trunk/geanylatex/src/geanylatex.c 2009-02-28 12:04:19 UTC (rev 515) +++ trunk/geanylatex/src/geanylatex.c 2009-02-28 13:23:12 UTC (rev 516) @@ -300,77 +300,6 @@ }
-static void -glatex_environment_insert_activated (G_GNUC_UNUSED GtkMenuItem * menuitem, - G_GNUC_UNUSED gpointer gdata) -{ - gint env = GPOINTER_TO_INT(gdata); - glatex_insert_environment(glatex_environment_array[env].latex); -} - - -static void -glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem * menuitem, - G_GNUC_UNUSED gpointer gdata) -{ - GtkWidget *dialog = NULL; - GtkWidget *vbox = NULL; - GtkWidget *label_env = NULL; - GtkWidget *textbox_env = NULL; - GtkWidget *table = NULL; - gint i, max; - - dialog = gtk_dialog_new_with_buttons(_("Insert Environment"), - GTK_WINDOW(geany->main_widgets->window), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, - NULL); - - vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog)); - gtk_widget_set_name(dialog, "GeanyDialog"); - gtk_box_set_spacing(GTK_BOX(vbox), 10); - - table = gtk_table_new(1, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE(table), 6); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - - label_env = gtk_label_new(_("Environment:")); - textbox_env = gtk_combo_box_entry_new_text(); - - max = glatex_count_menu_entries(glatex_environment_array, - ENVIRONMENT_CAT_DUMMY); - for (i = 0; i < max; i++) - { - gtk_combo_box_append_text(GTK_COMBO_BOX(textbox_env), - glatex_environment_array[i].label); - } - - gtk_misc_set_alignment(GTK_MISC(label_env), 0, 0.5); - - gtk_table_attach_defaults(GTK_TABLE(table), label_env, 0, 1, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), textbox_env, 1, 2, 0, 1); - gtk_container_add(GTK_CONTAINER(vbox), table); - - gtk_widget_show_all(vbox); - - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) - { - gchar *env_string = NULL; - - env_string = g_strdup(gtk_combo_box_get_active_text( - GTK_COMBO_BOX(textbox_env))); - - if (env_string != NULL) - { - glatex_insert_environment(env_string); - g_free(env_string); - } - } - - gtk_widget_destroy(dialog); -} - - static void character_create_menu_item(GtkWidget *menu, const gchar *label, gint letter, SubMenuCallback callback) {
Modified: trunk/geanylatex/src/latexenvironments.c =================================================================== --- trunk/geanylatex/src/latexenvironments.c 2009-02-28 12:04:19 UTC (rev 515) +++ trunk/geanylatex/src/latexenvironments.c 2009-02-28 13:23:12 UTC (rev 516) @@ -56,3 +56,75 @@ g_free(tmp); } } + + +void +glatex_environment_insert_activated (G_GNUC_UNUSED GtkMenuItem *menuitem, + G_GNUC_UNUSED gpointer gdata) +{ + gint env = GPOINTER_TO_INT(gdata); + glatex_insert_environment(glatex_environment_array[env].latex); +} + + +void +glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem *menuitem, + G_GNUC_UNUSED gpointer gdata) +{ + GtkWidget *dialog = NULL; + GtkWidget *vbox = NULL; + GtkWidget *label_env = NULL; + GtkWidget *textbox_env = NULL; + GtkWidget *table = NULL; + gint i, max; + + dialog = gtk_dialog_new_with_buttons(_("Insert Environment"), + GTK_WINDOW(geany->main_widgets->window), + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + NULL); + + vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog)); + gtk_widget_set_name(dialog, "GeanyDialog"); + gtk_box_set_spacing(GTK_BOX(vbox), 10); + + table = gtk_table_new(1, 2, FALSE); + gtk_table_set_col_spacings(GTK_TABLE(table), 6); + gtk_table_set_row_spacings(GTK_TABLE(table), 6); + + label_env = gtk_label_new(_("Environment:")); + textbox_env = gtk_combo_box_entry_new_text(); + + max = glatex_count_menu_entries(glatex_environment_array, + ENVIRONMENT_CAT_DUMMY); + for (i = 0; i < max; i++) + { + gtk_combo_box_append_text(GTK_COMBO_BOX(textbox_env), + glatex_environment_array[i].label); + } + + gtk_misc_set_alignment(GTK_MISC(label_env), 0, 0.5); + + gtk_table_attach_defaults(GTK_TABLE(table), label_env, 0, 1, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), textbox_env, 1, 2, 0, 1); + gtk_container_add(GTK_CONTAINER(vbox), table); + + gtk_widget_show_all(vbox); + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { + gchar *env_string = NULL; + + env_string = g_strdup(gtk_combo_box_get_active_text( + GTK_COMBO_BOX(textbox_env))); + + if (env_string != NULL) + { + glatex_insert_environment(env_string); + g_free(env_string); + } + } + + gtk_widget_destroy(dialog); +} +
Modified: trunk/geanylatex/src/latexenvironments.h =================================================================== --- trunk/geanylatex/src/latexenvironments.h 2009-02-28 12:04:19 UTC (rev 515) +++ trunk/geanylatex/src/latexenvironments.h 2009-02-28 13:23:12 UTC (rev 516) @@ -35,4 +35,12 @@
void glatex_insert_environment(gchar *environment);
+void +glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem *menuitem, + G_GNUC_UNUSED gpointer gdata); + +void +glatex_environment_insert_activated (G_GNUC_UNUSED GtkMenuItem *menuitem, + G_GNUC_UNUSED gpointer gdata); + #endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org