Do ignore empty recipients when checking names
[modest] / src / modest-dimming-rule.h
index 300d098..d1f1a29 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <glib-object.h>
 #include "widgets/modest-window.h"
 
 #include <glib-object.h>
 #include "widgets/modest-window.h"
+#include "modest-dimming-rules-group.h"
 
 G_BEGIN_DECLS
 
 
 G_BEGIN_DECLS
 
@@ -48,6 +49,8 @@ typedef struct _ModestDimmingRuleClass ModestDimmingRuleClass;
 
 typedef gboolean (*ModestDimmingCallback) (ModestWindow *self, gpointer user_data);
 
 
 typedef gboolean (*ModestDimmingCallback) (ModestWindow *self, gpointer user_data);
 
+#define MODEST_DIMMING_CALLBACK(x) ((ModestDimmingCallback) (x))
+
 
 struct _ModestDimmingRule {
         GObject parent;
 
 struct _ModestDimmingRule {
         GObject parent;
@@ -81,6 +84,25 @@ ModestDimmingRule*    modest_dimming_rule_new     (ModestWindow *win,
                                                   ModestDimmingCallback dimming_rule,
                                                   const gchar *action_path);
 
                                                   ModestDimmingCallback dimming_rule,
                                                   const gchar *action_path);
 
+
+/**
+ * modest_dimming_rule_new:
+ * @win: the #ModestWindow object which executes dimming rule.
+ * @dimming_rule: a #ModestDimmingCallback function to check dimmed status.
+ * @widget: the widget the rule will apply to
+ * 
+ * Creates a new instance of class #ModestDimmingRule using parameters to
+ * fill private data, required to process dimming rules. All parameters
+ * are required and NULL will be returned if one of these parameters is
+ * invalid or NULL.
+ * 
+ * Returns: a new instance of #ModestDimmingRule class, or NULL, if parameters
+ * are invalid.
+ **/
+ModestDimmingRule*
+modest_dimming_rule_new_from_widget (ModestWindow *win,
+                                    ModestDimmingCallback dimming_rule,
+                                    GtkWidget *widget);
 /**
  * modest_dimming_rule_process:
  * @rule: a #ModestDimmingRule object to process.
 /**
  * modest_dimming_rule_process:
  * @rule: a #ModestDimmingRule object to process.
@@ -93,6 +115,51 @@ ModestDimmingRule*    modest_dimming_rule_new     (ModestWindow *win,
  **/
 void modest_dimming_rule_process (ModestDimmingRule *self);
 
  **/
 void modest_dimming_rule_process (ModestDimmingRule *self);
 
+/**
+ * modest_dimming_rule_set_group:
+ * @rule: a #ModestDimmingRule object to process.
+ * @group: a #ModestDimmingRulesGroup object to associate.
+ * 
+ * Creates a new reference of @group, associated to this "rule.
+ */
+void modest_dimming_rule_set_group (ModestDimmingRule *rule,
+                                   ModestDimmingRulesGroup *group);
+
+/**
+ * modest_dimming_rule_set_group:
+ * @rule: a #ModestDimmingRule object to process.
+ * 
+ * Gets a new reference of associated group of this @rule.
+ *
+ * @Returns: a new object reference of #ModestDimmingRulesGroup, or 
+ * NULL if invalid @rule.
+ */
+ModestDimmingRulesGroup *
+modest_dimming_rule_get_group (ModestDimmingRule *rule);
+
+/**
+ * modest_dimming_rule_get_widget:
+ * @rule: a #ModestDimmingRule
+ *
+ * Widget the dimming rule is referenced to
+ *
+ * Returns: a #GtkWidget or %NULL if the dimming rule has no widget attached
+ */
+const gchar*
+modest_dimming_rule_get_action_path (ModestDimmingRule *rule);
+
+/**
+ * modest_dimming_rule_get_widget:
+ * @rule: a #ModestDimmingRule
+ *
+ * In case the dimming rule references directly a widget, it
+ * returns the widget.
+ *
+ * Returns: a #GtkWidget or %NULL if the dimming rule has no direct widget attached
+ */
+GtkWidget *
+modest_dimming_rule_get_widget (ModestDimmingRule *rule);
+
 void modest_dimming_rule_set_notification (ModestDimmingRule *rule,
                                           const gchar *notification);
 
 void modest_dimming_rule_set_notification (ModestDimmingRule *rule,
                                           const gchar *notification);