aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-06-16 14:58:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-06-16 14:58:21 +0800
commit8bf6b2775468e604c275e1a0990729f4a328e02a (patch)
tree096b08c383f81d5056ab92c04b5a50f4015c0b50 /widgets
parent44c075e18b7cdc0756f5f20f4b36ce534864ea03 (diff)
downloadgsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.tar
gsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.tar.gz
gsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.tar.bz2
gsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.tar.lz
gsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.tar.xz
gsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.tar.zst
gsoc2013-evolution-8bf6b2775468e604c275e1a0990729f4a328e02a.zip
fix a path leak and maek the code more structured.
2004-06-16 Not Zed <NotZed@Ximian.com> * e-source-selector.c (cell_toggled_callback): fix a path leak and maek the code more structured. (e_source_selector_set_toggle_selection): set the mode on whether you can toggle the currnet selection or not. (cell_toggled_callback): implement set_toggle_selection behaviour. svn path=/trunk/; revision=26361
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-source-selector.c30
-rw-r--r--widgets/misc/e-source-selector.h2
3 files changed, 33 insertions, 7 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 9d6e8d266f..11ba7c99fd 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,11 @@
+2004-06-16 Not Zed <NotZed@Ximian.com>
+
+ * e-source-selector.c (cell_toggled_callback): fix a path leak and
+ maek the code more structured.
+ (e_source_selector_set_toggle_selection): set the mode on whether
+ you can toggle the currnet selection or not.
+ (cell_toggled_callback): implement set_toggle_selection behaviour.
+
2004-06-03 William Jon McCann <mccann@jhu.edu>
* e-error.c (e_error_newv): Add HIG border width for dialog window.
diff --git a/widgets/misc/e-source-selector.c b/widgets/misc/e-source-selector.c
index 2f85b5d534..28da3314b4 100644
--- a/widgets/misc/e-source-selector.c
+++ b/widgets/misc/e-source-selector.c
@@ -34,6 +34,7 @@
#include <gtk/gtktreestore.h>
#include <gtk/gtkcellrenderertoggle.h>
#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcellrendererpixbuf.h>
#define PARENT_TYPE gtk_tree_view_get_type ()
static GtkTreeViewClass *parent_class = NULL;
@@ -50,8 +51,8 @@ struct _ESourceSelectorPrivate {
int rebuild_model_idle_id;
gboolean toggled_last;
-
gboolean checkboxes_shown;
+ gboolean toggle_selection;
};
typedef struct {
@@ -496,12 +497,11 @@ cell_toggled_callback (GtkCellRendererToggle *renderer,
}
gtk_tree_model_get (model, &iter, 0, &data, -1);
- if (E_IS_SOURCE_GROUP (data)) {
- gtk_tree_path_free (path);
- } else {
+ if (!E_IS_SOURCE_GROUP (data)) {
source = E_SOURCE (data);
- if (e_source_selector_peek_primary_selection (selector) != source) {
+ if (e_source_selector_peek_primary_selection (selector) != source
+ || selector->priv->toggle_selection) {
if (source_is_selected (selector, source))
unselect_source (selector, source);
else
@@ -511,10 +511,10 @@ cell_toggled_callback (GtkCellRendererToggle *renderer,
gtk_tree_model_row_changed (model, path, &iter);
g_signal_emit (selector, signals[SELECTION_CHANGED], 0);
-
- gtk_tree_path_free (path);
}
}
+
+ gtk_tree_path_free (path);
g_object_unref (data);
}
@@ -887,6 +887,22 @@ e_source_selector_selection_shown (ESourceSelector *selector)
}
/**
+ * e_source_selector_set_toggle_selection:
+ * @selector:
+ * @state:
+ *
+ * Set the source selectr behaviour, whether you can toggle the
+ * current selection or not.
+ **/
+void
+e_source_selector_set_toggle_selection(ESourceSelector *selector, gboolean state)
+{
+ g_return_if_fail (E_IS_SOURCE_SELECTOR (selector));
+
+ selector->priv->toggle_selection = state;
+}
+
+/**
* e_source_selector_select_source:
* @selector: An ESourceSelector widget
* @source: An ESource.
diff --git a/widgets/misc/e-source-selector.h b/widgets/misc/e-source-selector.h
index 8d3540866d..0b65d9443a 100644
--- a/widgets/misc/e-source-selector.h
+++ b/widgets/misc/e-source-selector.h
@@ -72,6 +72,8 @@ void e_source_selector_show_selection (ESourceSelector *selector,
gboolean show);
gboolean e_source_selector_selection_shown (ESourceSelector *selector);
+void e_source_selector_set_toggle_selection(ESourceSelector *selector, gboolean state);
+
ESource *e_source_selector_peek_primary_selection (ESourceSelector *selector);
void e_source_selector_set_primary_selection (ESourceSelector *selector,
ESource *source);