[Commits] callbacks.c 1.17 1.18 callbacks.h 1.3 1.4 gtk-utils.c 1.7 1.8 gtk-utils.h 1.3 1.4
miras at claws-mail.org
miras at claws-mail.org
Sat Dec 31 11:58:02 CET 2011
Update of /home/claws-mail/contacts/src
In directory claws-mail:/tmp/cvs-serv13118/src
Modified Files:
callbacks.c callbacks.h gtk-utils.c gtk-utils.h
Log Message:
2011-12-31 [mir] 0.6.0cvs62
* src/callbacks.c
* src/callbacks.h
* src/gtk-utils.c
* src/gtk-utils.h
Moved some convinience functions from callbacks
to gtk-utils.
Index: gtk-utils.h
===================================================================
RCS file: /home/claws-mail/contacts/src/gtk-utils.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gtk-utils.h 27 Sep 2011 17:13:04 -0000 1.3
+++ gtk-utils.h 31 Dec 2011 10:57:59 -0000 1.4
@@ -97,6 +97,12 @@
void dialog_set_focus(GtkDialog* dialog, const gchar* button_label);
GtkWidget* create_combo_box_text(GSList* items);
gchar* combo_box_text_get_active(GtkWidget* combobox);
+AddressBook* get_selected_address_book(GtkTreeView* view);
+void set_selected_address_book(GtkTreeView* view, AddressBook* book);
+Plugin* get_selected_plugin(GtkTreeView* view);
+Contact* get_selected_contact(GtkTreeView* view);
+void list_view_clear(GtkTreeView* view, MainWindow* mainwindow);
+void list_view_append_contact(GtkTreeView* view, Contact* contact);
G_END_DECLS
Index: gtk-utils.c
===================================================================
RCS file: /home/claws-mail/contacts/src/gtk-utils.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gtk-utils.c 21 Dec 2011 22:02:52 -0000 1.7
+++ gtk-utils.c 31 Dec 2011 10:57:59 -0000 1.8
@@ -41,6 +41,7 @@
#include "utils.h"
#include "plugin-loader.h"
#include "plugin.h"
+#include "mainwindow.h"
typedef struct {
GHashTable* hash_table;
@@ -479,3 +480,124 @@
}
}
}
+
+AddressBook* get_selected_address_book(GtkTreeView* view) {
+ GtkTreeIter iter;
+ GtkTreeModel* model;
+ GtkTreeSelection* row;
+ GValue value={0,};
+ AddressBook* abook = NULL;
+
+ cm_return_val_if_fail(view != NULL, NULL);
+
+ row = gtk_tree_view_get_selection(view);
+ if (row) {
+ if (gtk_tree_selection_get_selected(row, &model, &iter)) {
+ gtk_tree_model_get_value(model, &iter, BOOK_DATA_COLUMN, &value);
+ abook = (AddressBook *) g_value_get_pointer(&value);
+ g_value_unset(&value);
+ }
+ }
+
+ return abook;
+}
+
+void set_selected_address_book(GtkTreeView* view, AddressBook* book) {
+ if (! view || ! book)
+ return;
+}
+
+Plugin* get_selected_plugin(GtkTreeView* view) {
+ GtkTreeIter iter;
+ GtkTreeModel* model;
+ GtkTreeSelection* row;
+ GValue value={0,};
+ Plugin* plugin = NULL;
+
+ cm_return_val_if_fail(view != NULL, NULL);
+
+ row = gtk_tree_view_get_selection(view);
+ if (row) {
+ if (gtk_tree_selection_get_selected(row, &model, &iter)) {
+ gtk_tree_model_get_value(model, &iter, BOOK_PLUGIN_COLUMN, &value);
+ plugin = (Plugin *) g_value_get_pointer(&value);
+ g_value_unset(&value);
+ }
+ }
+
+ return plugin;
+}
+
+Contact* get_selected_contact(GtkTreeView* view) {
+ GtkTreeIter iter;
+ GtkTreeModel* model;
+ GtkTreeSelection* row;
+ GValue value={0,};
+ Contact* contact = NULL;
+
+ cm_return_val_if_fail(view != NULL, NULL);
+
+ row = gtk_tree_view_get_selection(view);
+ if (row) {
+ if (gtk_tree_selection_get_selected(row, &model, &iter)) {
+ gtk_tree_model_get_value(model, &iter, CONTACT_DATA_COLUMN, &value);
+ contact = (Contact *) g_value_get_pointer(&value);
+ g_value_unset(&value);
+ }
+ }
+
+ return contact;
+}
+
+void list_view_clear(GtkTreeView* view, MainWindow* mainwindow) {
+ GtkListStore* store;
+ GtkTreeModel* model;
+
+ if (! view)
+ return;
+
+ model = gtk_tree_view_get_model(view);
+ store = GTK_LIST_STORE(model);
+
+ gtk_list_store_clear(store);
+ if (gtk_tree_model_get_n_columns(model) == CONTACT_N_COLUMNS &&
+ mainwindow->compose_mode) {
+ gtk_widget_set_sensitive(mainwindow->to_btn, FALSE);
+ gtk_widget_set_sensitive(mainwindow->cc_btn, FALSE);
+ gtk_widget_set_sensitive(mainwindow->bcc_btn, FALSE);
+ }
+}
+
+void list_view_append_contact(GtkTreeView* view, Contact* contact) {
+ GtkTreeIter iter;
+ GtkListStore* store;
+ GtkTreeModel* model;
+ gchar *cn, *first, *last, *mail = NULL;
+
+ cm_return_if_fail(view != NULL);
+ cm_return_if_fail(contact != NULL);
+
+ cn = first = last = mail = NULL;
+ model = gtk_tree_view_get_model(view);
+ store = GTK_LIST_STORE(model);
+
+ if (contact->emails) {
+ Email* email = (Email *) contact->emails->data;
+ mail = email->email;
+ }
+ extract_data(contact->data, "first-name", (void *) &first);
+ extract_data(contact->data, "last-name", (void *) &last);
+ extract_data(contact->data, "cn", (void *) &cn);
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ CONTACT_DISPLAYNAME_COLUMN, cn,
+ CONTACT_FIRSTNAME_COLUMN, first,
+ CONTACT_LASTNAME_COLUMN, last,
+ CONTACT_EMAIL_COLUMN, mail,
+ CONTACT_DATA_COLUMN, contact,
+ -1);
+ g_free(first);
+ g_free(last);
+ g_free(cn);
+}
Index: callbacks.c
===================================================================
RCS file: /home/claws-mail/contacts/src/callbacks.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- callbacks.c 21 Dec 2011 22:02:52 -0000 1.17
+++ callbacks.c 31 Dec 2011 10:57:59 -0000 1.18
@@ -483,59 +483,6 @@
}
}
-void list_view_clear(GtkTreeView* view, MainWindow* mainwindow) {
- GtkListStore* store;
- GtkTreeModel* model;
-
- if (! view)
- return;
-
- model = gtk_tree_view_get_model(view);
- store = GTK_LIST_STORE(model);
-
- gtk_list_store_clear(store);
- if (gtk_tree_model_get_n_columns(model) == CONTACT_N_COLUMNS &&
- mainwindow->compose_mode) {
- gtk_widget_set_sensitive(mainwindow->to_btn, FALSE);
- gtk_widget_set_sensitive(mainwindow->cc_btn, FALSE);
- gtk_widget_set_sensitive(mainwindow->bcc_btn, FALSE);
- }
-}
-
-void list_view_append_contact(GtkTreeView* view, Contact* contact) {
- GtkTreeIter iter;
- GtkListStore* store;
- GtkTreeModel* model;
- gchar *cn, *first, *last, *mail = NULL;
-
- cm_return_if_fail(view != NULL);
- cm_return_if_fail(contact != NULL);
-
- cn = first = last = mail = NULL;
- model = gtk_tree_view_get_model(view);
- store = GTK_LIST_STORE(model);
-
- if (contact->emails) {
- Email* email = (Email *) contact->emails->data;
- mail = email->email;
- }
- extract_data(contact->data, "first-name", (void *) &first);
- extract_data(contact->data, "last-name", (void *) &last);
- extract_data(contact->data, "cn", (void *) &cn);
-
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- CONTACT_DISPLAYNAME_COLUMN, cn,
- CONTACT_FIRSTNAME_COLUMN, first,
- CONTACT_LASTNAME_COLUMN, last,
- CONTACT_EMAIL_COLUMN, mail,
- CONTACT_DATA_COLUMN, contact,
- -1);
- g_free(first);
- g_free(last);
- g_free(cn);
-}
-
gchar* contact_write_to_backend(Plugin* plugin,
AddressBook* abook,
Contact* old,
@@ -558,74 +505,6 @@
return error;
}
-AddressBook* get_selected_address_book(GtkTreeView* view) {
- GtkTreeIter iter;
- GtkTreeModel* model;
- GtkTreeSelection* row;
- GValue value={0,};
- AddressBook* abook = NULL;
-
- cm_return_val_if_fail(view != NULL, NULL);
-
- row = gtk_tree_view_get_selection(view);
- if (row) {
- if (gtk_tree_selection_get_selected(row, &model, &iter)) {
- gtk_tree_model_get_value(model, &iter, BOOK_DATA_COLUMN, &value);
- abook = (AddressBook *) g_value_get_pointer(&value);
- g_value_unset(&value);
- }
- }
-
- return abook;
-}
-
-void set_selected_address_book(GtkTreeView* view, AddressBook* book) {
- if (! view || ! book)
- return;
-}
-
-Plugin* get_selected_plugin(GtkTreeView* view) {
- GtkTreeIter iter;
- GtkTreeModel* model;
- GtkTreeSelection* row;
- GValue value={0,};
- Plugin* plugin = NULL;
-
- cm_return_val_if_fail(view != NULL, NULL);
-
- row = gtk_tree_view_get_selection(view);
- if (row) {
- if (gtk_tree_selection_get_selected(row, &model, &iter)) {
- gtk_tree_model_get_value(model, &iter, BOOK_PLUGIN_COLUMN, &value);
- plugin = (Plugin *) g_value_get_pointer(&value);
- g_value_unset(&value);
- }
- }
-
- return plugin;
-}
-
-Contact* get_selected_contact(GtkTreeView* view) {
- GtkTreeIter iter;
- GtkTreeModel* model;
- GtkTreeSelection* row;
- GValue value={0,};
- Contact* contact = NULL;
-
- cm_return_val_if_fail(view != NULL, NULL);
-
- row = gtk_tree_view_get_selection(view);
- if (row) {
- if (gtk_tree_selection_get_selected(row, &model, &iter)) {
- gtk_tree_model_get_value(model, &iter, CONTACT_DATA_COLUMN, &value);
- contact = (Contact *) g_value_get_pointer(&value);
- g_value_unset(&value);
- }
- }
-
- return contact;
-}
-
#define MISSING "Missing name"
void book_cell_data_format(GtkTreeViewColumn *col,
GtkCellRenderer *renderer,
Index: callbacks.h
===================================================================
RCS file: /home/claws-mail/contacts/src/callbacks.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- callbacks.h 18 Dec 2011 01:00:42 -0000 1.3
+++ callbacks.h 31 Dec 2011 10:57:59 -0000 1.4
@@ -42,10 +42,6 @@
#include "plugin.h"
#include "plugin-loader.h"
-AddressBook* get_selected_address_book(GtkTreeView* view);
-void set_selected_address_book(GtkTreeView* view, AddressBook* book);
-Plugin* get_selected_plugin(GtkTreeView* view);
-Contact* get_selected_contact(GtkTreeView* view);
gint delete_event(GtkWidget* widget, GdkEvent* event, gpointer data);
void menu_quit_cb(GtkMenuItem* menuitem, gpointer data);
void toolbar_quit_cb(GtkToolButton* toolbutton, gpointer data);
@@ -106,8 +102,6 @@
AddressBook* abook,
Contact* old,
Contact* new);
-void list_view_clear(GtkTreeView* view, MainWindow* mainwindow);
-void list_view_append_contact(GtkTreeView* view, Contact* contact);
void read_config(MainWindow* mainwindow);
void shutdown_application(gpointer data);
void markup_default_book(GtkTreeViewColumn* col,
More information about the Commits
mailing list