[Commits] ldifimport_extension.c 1.3 1.4
miras at claws-mail.org
miras at claws-mail.org
Sat Dec 31 15:32:24 CET 2011
Update of /home/claws-mail/contacts/extensions/import
In directory claws-mail:/tmp/cvs-serv17716/extensions/import
Modified Files:
ldifimport_extension.c
Log Message:
2011-12-31 [mir] 0.6.0cvs63
* extensions/example/src/example-extension.c
* extensions/export/ldifexport_extension.c
* extensions/export/wizard.c
* extensions/export/wizard.h
* extensions/import/ldifimport_extension.c
* src/extension.h
Necessary changes to be able to support more
possibilities for making extensions.
Index: ldifimport_extension.c
===================================================================
RCS file: /home/claws-mail/contacts/extensions/import/ldifimport_extension.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ldifimport_extension.c 17 Dec 2011 15:52:58 -0000 1.3
+++ ldifimport_extension.c 31 Dec 2011 14:32:22 -0000 1.4
@@ -45,19 +45,18 @@
#include "gtk-utils.h"
#include "plugin.h"
#include "plugin-loader.h"
-#include "callbacks.h"
#include "ldifimport_parser.h"
-#define NAME "LDIF importer extension"
+#define NAME "LDIF Import extension"
static guint my_id;
-static gchar* ldif_file_chooser(MainWindow* Main) {
+static gchar* ldif_file_chooser(MenuItem* item) {
GtkWidget* dialog;
gchar* filename = NULL;
dialog = gtk_file_chooser_dialog_new(_("Open file"),
- GTK_WINDOW(Main->window),
+ GTK_WINDOW(item->mainwindow->window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
@@ -75,7 +74,7 @@
}
static void ldif_import(GtkWidget* widget, gpointer data) {
- MainWindow* Main = (MainWindow*) data;
+ MenuItem* item = (MenuItem *) data;
LdifParser* parser;
GtkTreeView* view;
AddressBook* abook;
@@ -88,10 +87,10 @@
gchar* value;
gchar* err;
- view = GTK_TREE_VIEW(Main->abook_list);
+ view = GTK_TREE_VIEW(item->mainwindow->abook_list);
abook = get_selected_address_book(view);
if (abook == NULL) {
- iter = set_selection_combobox(Main->window,
+ iter = set_selection_combobox(item->mainwindow->window,
_("[New Contact] Choose address book"),
gtk_tree_view_get_model(view),
BOOK_NAME_COLUMN);
@@ -104,7 +103,7 @@
}
plugin = get_selected_plugin(view);
- gchar* file = ldif_file_chooser(Main);
+ gchar* file = ldif_file_chooser(item);
if (!file)
return;
@@ -124,9 +123,9 @@
gslist_free(&attribs, attrib_def_free);
ldif_parser_parse(parser);
if (ldif_parser_get_errors(parser) > 0) {
- show_message(Main->window, GTK_UTIL_MESSAGE_WARNING, "%s:%d:%d [%d] %s",
- parser->input_name, parser->error_line, parser->error_place,
- parser->error_code, parser->error_msg);
+ show_message(item->mainwindow->window, GTK_UTIL_MESSAGE_WARNING,
+ "%s:%d:%d [%d] %s", parser->input_name, parser->error_line,
+ parser->error_place, parser->error_code, parser->error_msg);
}
head = cur = ldif_parser_get_records(parser);
while (cur) {
@@ -162,7 +161,7 @@
err = NULL;
plugin->set_contact(abook, contact, &err);
if (err) {
- show_message(Main->window, GTK_UTIL_MESSAGE_WARNING, "%s", err);
+ show_message(item->mainwindow->window, GTK_UTIL_MESSAGE_WARNING, "%s", err);
g_free(err);
err = NULL;
contact_free(contact);
@@ -170,7 +169,8 @@
else {
abook->contacts = g_list_prepend(abook->contacts, contact);
abook->dirty = TRUE;
- list_view_append_contact(GTK_TREE_VIEW(Main->contact_list), contact);
+ list_view_append_contact(
+ GTK_TREE_VIEW(item->mainwindow->contact_list), contact);
while (gtk_events_pending())
gtk_main_iteration();
}
@@ -186,24 +186,24 @@
MenuItem* menu_item;
menu = gtk_image_menu_item_new_with_mnemonic("_LDIF");
- gtk_widget_set_name(menu, "toolsmenu");
- g_signal_connect(menu, "activate",
- G_CALLBACK(ldif_import), (gpointer) mainwindow);
menu_item = menu_item_new();
menu_item->menu = CONTACTS_MAIN_MENU;
menu_item->parent = "tools";
menu_item->sublabel = "_Import";
menu_item->submenu = TRUE;
+ menu_item->mainwindow = mainwindow;
+ g_signal_connect(menu, "activate",
+ G_CALLBACK(ldif_import), (gpointer) menu_item);
add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
menu = gtk_image_menu_item_new_with_mnemonic("_LDIF");
- gtk_widget_set_name(menu, "contextmenu");
- g_signal_connect(menu, "activate",
- G_CALLBACK(ldif_import), (gpointer) mainwindow);
menu_item = menu_item_new();
menu_item->menu = CONTACTS_ADDRESSBOOK_MENU;
menu_item->sublabel = "_Import";
menu_item->submenu = TRUE;
+ menu_item->mainwindow = mainwindow;
+ g_signal_connect(menu, "activate",
+ G_CALLBACK(ldif_import), (gpointer) menu_item);
add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
}
More information about the Commits
mailing list