#include <config.h>
#include <glib/gi18n-lib.h>
-#include "libedataserver/e-categories.h"
+
+#include <libedataserver/libedataserver.h>
+
#include "e-categories-selector.h"
#include "e-data-server-ui-marshal.h"
-G_DEFINE_TYPE (
- ECategoriesSelector,
- e_categories_selector,
- GTK_TYPE_TREE_VIEW)
+#define E_CATEGORIES_SELECTOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CATEGORIES_SELECTOR, ECategoriesSelectorPrivate))
struct _ECategoriesSelectorPrivate {
gboolean checkable;
static gint signals[LAST_SIGNAL] = {0};
+G_DEFINE_TYPE (
+ ECategoriesSelector,
+ e_categories_selector,
+ GTK_TYPE_TREE_VIEW)
+
static void
categories_selector_build_model (ECategoriesSelector *selector)
{
gchar *category;
gboolean active;
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (
+ model, &iter,
COLUMN_ACTIVE, &active,
COLUMN_CATEGORY, &category, -1);
{
ECategoriesSelectorPrivate *priv;
- priv = E_CATEGORIES_SELECTOR (object)->priv;
+ priv = E_CATEGORIES_SELECTOR_GET_PRIVATE (object);
if (priv->selected_categories != NULL) {
g_hash_table_destroy (priv->selected_categories);
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
- selector->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- selector, E_TYPE_CATEGORIES_SELECTOR,
- ECategoriesSelectorPrivate);
+ selector->priv = E_CATEGORIES_SELECTOR_GET_PRIVATE (selector);
selector->priv->checkable = TRUE;
selector->priv->selected_categories = g_hash_table_new_full (
g_return_if_fail (E_IS_CATEGORIES_SELECTOR (selector));
+ if ((selector->priv->checkable ? 1 : 0) == (checkable ? 1 : 0))
+ return;
+
selector->priv->checkable = checkable;
column = gtk_tree_view_get_column (
gchar *category_name;
gboolean found;
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (
+ model, &iter,
COLUMN_CATEGORY, &category_name,
-1);
found = (g_hash_table_lookup (
gchar *category;
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (
+ model, &iter,
COLUMN_CATEGORY, &category, -1);
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
e_categories_remove (category);
gchar *category;
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (
+ model, &iter,
COLUMN_CATEGORY, &category, -1);
if (str->len == 0)
g_string_assign (str, category);