GtkWidget * org_gnome_exchange_show_folder_size_factory (EPlugin *epl, EConfigHookItemFactoryData *data) { EMConfigTargetFolder *target= (EMConfigTargetFolder *)data->config->target; CamelFolder *cml_folder = target->folder; CamelService *service; CamelProvider *provider; ExchangeAccount *account; GtkWidget *lbl_size, *lbl_size_val; GtkListStore *model; GtkVBox *vbx; GtkHBox *hbx_size; char *folder_name, *folder_size; int mode; service = CAMEL_SERVICE (camel_folder_get_parent_store (cml_folder)); if (!service) return NULL; provider = camel_service_get_provider (service); if (!provider) return NULL; if (g_ascii_strcasecmp (provider->protocol, "exchange")) return NULL; account = exchange_operations_get_exchange_account (); exchange_account_is_offline (account, &mode); if (mode == OFFLINE_MODE) return NULL; folder_name = (char*) camel_folder_get_name (cml_folder); if (!folder_name) folder_name = g_strdup ("name"); model = exchange_account_folder_size_get_model (account); if (model) folder_size = g_strdup_printf (_("%s KB"), exchange_folder_size_get_val (model, folder_name)); else folder_size = g_strdup (_("0 KB")); hbx_size = (GtkHBox*) gtk_hbox_new (FALSE, 0); vbx = (GtkVBox *)gtk_notebook_get_nth_page (GTK_NOTEBOOK (data->parent), 0); lbl_size = gtk_label_new_with_mnemonic (_("Size:")); lbl_size_val = gtk_label_new_with_mnemonic (_(folder_size)); gtk_widget_show (lbl_size); gtk_widget_show (lbl_size_val); gtk_misc_set_alignment (GTK_MISC (lbl_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (lbl_size_val), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (hbx_size), lbl_size, FALSE, TRUE, 12); gtk_box_pack_start (GTK_BOX (hbx_size), lbl_size_val, FALSE, TRUE, 10); gtk_widget_show_all (GTK_WIDGET (hbx_size)); gtk_box_pack_start (GTK_BOX (vbx), GTK_WIDGET (hbx_size), FALSE, FALSE, 0); g_free (folder_size); return GTK_WIDGET (hbx_size); }
void com_irontec_evosugar(void *ep, EMPopupTargetSelect *t) { CamelException ex = {0}; gchar *folder_name = camel_folder_get_name(t->folder); gboolean folder_is_sent = FALSE; BREAKPOINT; gui.gtkBuilder = gtk_builder_new(); gtk_builder_set_translation_domain(gui.gtkBuilder, GETTEXT_PACKAGE); gtk_builder_add_from_file(gui.gtkBuilder, g_build_filename(PLUGIN_INSTALL_DIR, UI_FILE, NULL), NULL); gui.entry_search = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "entrySearch")); gui.button_search = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "buttonSearch")); gui.radio_button_from = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "radiobuttonFrom")); gui.radio_button_to = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "radiobuttonTo")); gui.button_submit = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "buttonAddToSugarCRM")); gui.entry_subject_edit = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "entryEditSubject")); BREAKPOINT; g_signal_connect(gui.button_search, "clicked", G_CALLBACK(on_button_search_clicked), GTK_ENTRY(gui.entry_search)); g_signal_connect(gui.button_submit, "clicked", G_CALLBACK(on_button_AddToSugarCRM_clicked), NULL); scrm_session.id = scrm_login(gconf_get_username(), gconf_get_password(), gconf_get_server()); if ((g_strcmp0(folder_name, "Sent") == 0) || (g_strcmp0(folder_name, _("Sent")) == 0) ) { folder_is_sent = TRUE; } if (scrm_session.id == NULL || g_strcmp0(scrm_session.id, "-1") == 0) { gui_show_message(_("SugarCRM"), _("Unable to connect: check your connection and settings please.")); } else { BREAKPOINT; msg = camel_folder_get_message(t->folder, t->uids->pdata[0], &ex); util_get_msg_body(msg, &msg_body); if (msg == NULL) { camel_exception_clear(&ex); return; } BREAKPOINT; subject = camel_mime_message_get_subject(msg); gtk_entry_set_text(gui.entry_subject_edit, subject); gui.body_text_view = gtk_builder_get_object(gui.gtkBuilder, "bodyTextView"); model.body_text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gui.body_text_view)); gtk_text_buffer_set_text(model.body_text_buffer, msg_body, -1); from = camel_mime_message_get_from(msg); to = camel_mime_message_get_recipients(msg, CAMEL_RECIPIENT_TYPE_TO); BREAKPOINT; msg_date = camel_mime_message_get_date(msg, NULL); camel_internet_address_get(from, 0, &from_name, &from_addr); camel_internet_address_get(to, 0, &to_name, &to_addr); g_signal_connect(gui.radio_button_from, "pressed", G_CALLBACK(on_radio_group_search_changed), from_addr); gchar *to_search = to_addr; g_signal_connect(gui.radio_button_to, "pressed", G_CALLBACK(on_radio_group_search_changed), to_search); if (folder_is_sent) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui.radio_button_to),TRUE); } BREAKPOINT; GtkWidget *content_box = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "vboxContents")); GtkWidget *frame_attach = GTK_WIDGET(gtk_builder_get_object(gui.gtkBuilder, "frameAttach")); if (folder_is_sent) { gtk_entry_set_text(gui.entry_search, to_addr); } else { gtk_entry_set_text(gui.entry_search, from_addr); } GtkScrolledWindow *scrolledwindow = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL)); gtk_scrolled_window_set_policy(scrolledwindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GtkScrolledWindow *scrolledwindow2 = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL)); gtk_scrolled_window_set_policy(scrolledwindow2, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); BREAKPOINT; gtk_container_add(GTK_CONTAINER(content_box), scrolledwindow); gtk_container_add(GTK_CONTAINER(frame_attach), scrolledwindow2); BREAKPOINT; gui.treeview_search = gtk_tree_view_new(); gui.treeview_attach = gtk_tree_view_new(); add_columns_search(GTK_TREE_VIEW(gui.treeview_search)); add_columns_attachment(GTK_TREE_VIEW(gui.treeview_attach)); model.model_attach = util_get_msg_attachments(msg); //gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), model_search); BREAKPOINT; //g_object_unref (G_OBJECT (model_search)); gtk_builder_connect_signals(gui.gtkBuilder, NULL); gtk_tree_view_set_model(GTK_TREE_VIEW(gui.treeview_attach), model.model_attach); gtk_container_add(scrolledwindow, gui.treeview_search); gtk_container_add(scrolledwindow2, gui.treeview_attach); gui.mainwin = GTK_WIDGET(gtk_builder_get_object (gui.gtkBuilder, "addToSugarCRMwindow")); /* * Show the application window */ gtk_widget_show_all(gui.mainwin); //trigger on_button_search_clicked(NULL, gui.entry_search); if (DEBUG_ON) { //g_mem_profile (); } } // end-else comprobar conexion }