Logo Search packages:      
Sourcecode: mail-notification version File versions

mn-auth-combo-box.c

/* Generated by GOB (v2.0.11) on Sun Mar  6 22:34:27 2005
   (do not edit directly) */

/* End world hunger, donate to the World Food Programme, http://www.wfp.org */

#define GOB_VERSION_MAJOR 2
#define GOB_VERSION_MINOR 0
#define GOB_VERSION_PATCHLEVEL 11

#define selfp (self->_priv)

#include <string.h> /* memset() */

#include "mn-auth-combo-box.h"

#include "mn-auth-combo-box-private.h"

#ifdef G_LIKELY
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
#else /* ! G_LIKELY */
#define ___GOB_LIKELY(expr) (expr)
#define ___GOB_UNLIKELY(expr) (expr)
#endif /* G_LIKELY */

#line 24 "mn-auth-combo-box.gob"

#include "config.h"
#include <glib/gi18n.h>
#ifdef WITH_SASL
#include <sasl/sasl.h>
#include "mn-sasl.h"
#endif /* WITH_SASL */

  enum 
  {
    COLUMN_MECHANISM,
    COLUMN_LABEL,
    N_COLUMNS
  };

#line 43 "mn-auth-combo-box.c"
/* self casting macros */
#define SELF(x) MN_AUTH_COMBO_BOX(x)
#define SELF_CONST(x) MN_AUTH_COMBO_BOX_CONST(x)
#define IS_SELF(x) MN_IS_AUTH_COMBO_BOX(x)
#define TYPE_SELF MN_TYPE_AUTH_COMBO_BOX
#define SELF_CLASS(x) MN_AUTH_COMBO_BOX_CLASS(x)

#define SELF_GET_CLASS(x) MN_AUTH_COMBO_BOX_GET_CLASS(x)

/* self typedefs */
typedef MNAuthComboBox Self;
typedef MNAuthComboBoxClass SelfClass;

/* here are local prototypes */
static void ___object_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
static void ___object_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void mn_auth_combo_box_class_init (MNAuthComboBoxClass * c) G_GNUC_UNUSED;
static void mn_auth_combo_box_init (MNAuthComboBox * self) G_GNUC_UNUSED;

enum {
      PROP_0,
      PROP_ACTIVE_MECHANISM
};

/* pointer to the class of our parent */
static GtkComboBoxClass *parent_class = NULL;

/* Short form macros */
#define self_get_active_mechanism mn_auth_combo_box_get_active_mechanism
#define self_set_active_mechanism mn_auth_combo_box_set_active_mechanism
#define self_append mn_auth_combo_box_append
#define self_new mn_auth_combo_box_new
GType
mn_auth_combo_box_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (MNAuthComboBoxClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) mn_auth_combo_box_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (MNAuthComboBox),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) mn_auth_combo_box_init,
                  NULL
            };

            type = g_type_register_static (GTK_TYPE_COMBO_BOX, "MNAuthComboBox", &info, (GTypeFlags)0);
      }

      return type;
}

/* a macro for creating a new object of our type */
#define GET_NEW ((MNAuthComboBox *)g_object_new(mn_auth_combo_box_get_type(), NULL))

/* a function for creating a new object of our type */
#include <stdarg.h>
static MNAuthComboBox * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
static MNAuthComboBox *
GET_NEW_VARG (const char *first, ...)
{
      MNAuthComboBox *ret;
      va_list ap;
      va_start (ap, first);
      ret = (MNAuthComboBox *)g_object_new_valist (mn_auth_combo_box_get_type (), first, ap);
      va_end (ap);
      return ret;
}

static void 
mn_auth_combo_box_class_init (MNAuthComboBoxClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

      parent_class = g_type_class_ref (GTK_TYPE_COMBO_BOX);

      g_object_class->get_property = ___object_get_property;
      g_object_class->set_property = ___object_set_property;
    {
      GParamSpec   *param_spec;

      param_spec = g_param_spec_string
            ("active_mechanism" /* name */,
             NULL /* nick */,
             NULL /* blurb */,
             NULL /* default_value */,
             (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
      g_object_class_install_property (g_object_class,
            PROP_ACTIVE_MECHANISM,
            param_spec);
    }
}
#undef __GOB_FUNCTION__
#line 87 "mn-auth-combo-box.gob"
static void 
mn_auth_combo_box_init (MNAuthComboBox * self G_GNUC_UNUSED)
#line 146 "mn-auth-combo-box.c"
{
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::init"
 {
#line 88 "mn-auth-combo-box.gob"

    GtkListStore *store;
    GtkCellRenderer *renderer;

    store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
    gtk_combo_box_set_model(GTK_COMBO_BOX(self), GTK_TREE_MODEL(store));
    g_object_unref(store);

    renderer = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(self), renderer, TRUE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(self), renderer,
                           "markup", COLUMN_LABEL,
                           NULL);
    
    self_append(self, NULL, _("<span style=\"italic\">autodetect</span>"));
#ifdef WITH_SASL
    if (mn_sasl_use(NULL))
      {
        const char **mechanisms;

      mechanisms = sasl_global_listmech();
      if (mechanisms)
        {
          int i;

          for (i = 0; mechanisms[i]; i++)
            {
            char *escaped = g_markup_escape_text(mechanisms[i], -1);
            self_append(self, mechanisms[i], escaped);
            g_free(escaped);
            }
        }
      mn_sasl_unuse();
      }
#endif /* WITH_SASL */

    self_set_active_mechanism(self, NULL);
  
#line 189 "mn-auth-combo-box.c"
 }
}
#undef __GOB_FUNCTION__

static void
___object_set_property (GObject *object,
      guint property_id,
      const GValue *VAL G_GNUC_UNUSED,
      GParamSpec *pspec G_GNUC_UNUSED)
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::set_property"
{
      MNAuthComboBox *self G_GNUC_UNUSED;

      self = MN_AUTH_COMBO_BOX (object);

      switch (property_id) {
      case PROP_ACTIVE_MECHANISM:
            {
#line 44 "mn-auth-combo-box.gob"

      const char *mechanism = g_value_get_string(VAL);
      GtkTreeModel *model;
      GtkTreeIter iter;
      gboolean valid;

      model = gtk_combo_box_get_model(GTK_COMBO_BOX(self));
      valid = gtk_tree_model_get_iter_first(model, &iter);
    
      while (valid)
      {
        char *this_mech;
        gboolean found;
        
        gtk_tree_model_get(model, &iter, COLUMN_MECHANISM, &this_mech, -1);
        found = (! this_mech && ! mechanism)
          || (this_mech && mechanism && ! strcmp(this_mech, mechanism));
        g_free(this_mech);
        
        if (found)
          {
            gtk_combo_box_set_active_iter(GTK_COMBO_BOX(self), &iter);
            break;
          }
        
        valid = gtk_tree_model_iter_next(model, &iter);
      }
    
#line 237 "mn-auth-combo-box.c"
            }
            break;
      default:
/* Apparently in g++ this is needed, glib is b0rk */
#ifndef __PRETTY_FUNCTION__
#  undef G_STRLOC
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
#endif
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}
#undef __GOB_FUNCTION__

static void
___object_get_property (GObject *object,
      guint property_id,
      GValue *VAL G_GNUC_UNUSED,
      GParamSpec *pspec G_GNUC_UNUSED)
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::get_property"
{
      MNAuthComboBox *self G_GNUC_UNUSED;

      self = MN_AUTH_COMBO_BOX (object);

      switch (property_id) {
      case PROP_ACTIVE_MECHANISM:
            {
#line 73 "mn-auth-combo-box.gob"

      char *mechanism = NULL;
      GtkTreeIter iter;

      if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(self), &iter))
      {
        GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(self));
        gtk_tree_model_get(model, &iter, COLUMN_MECHANISM, &mechanism, -1);
      }

      g_value_set_string(VAL, mechanism);
      g_free(mechanism);
    
#line 280 "mn-auth-combo-box.c"
            }
            break;
      default:
/* Apparently in g++ this is needed, glib is b0rk */
#ifndef __PRETTY_FUNCTION__
#  undef G_STRLOC
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
#endif
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}
#undef __GOB_FUNCTION__


#line 73 "mn-auth-combo-box.gob"
gchar * 
mn_auth_combo_box_get_active_mechanism (MNAuthComboBox * self)
#line 299 "mn-auth-combo-box.c"
{
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::get_active_mechanism"
{
#line 42 "mn-auth-combo-box.gob"
            gchar* val; g_object_get (G_OBJECT (self), "active_mechanism", &val, NULL); return val;
}}
#line 306 "mn-auth-combo-box.c"
#undef __GOB_FUNCTION__

#line 44 "mn-auth-combo-box.gob"
void 
mn_auth_combo_box_set_active_mechanism (MNAuthComboBox * self, gchar * val)
#line 312 "mn-auth-combo-box.c"
{
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::set_active_mechanism"
{
#line 42 "mn-auth-combo-box.gob"
            g_object_set (G_OBJECT (self), "active_mechanism", val, NULL);
}}
#line 319 "mn-auth-combo-box.c"
#undef __GOB_FUNCTION__


#line 127 "mn-auth-combo-box.gob"
void 
mn_auth_combo_box_append (MNAuthComboBox * self, const char * mechanism, const char * label)
#line 326 "mn-auth-combo-box.c"
{
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::append"
#line 127 "mn-auth-combo-box.gob"
      g_return_if_fail (self != NULL);
#line 127 "mn-auth-combo-box.gob"
      g_return_if_fail (MN_IS_AUTH_COMBO_BOX (self));
#line 127 "mn-auth-combo-box.gob"
      g_return_if_fail (label != NULL);
#line 335 "mn-auth-combo-box.c"
{
#line 129 "mn-auth-combo-box.gob"
      
    GtkTreeModel *model;
    GtkTreeIter iter;

    model = gtk_combo_box_get_model(GTK_COMBO_BOX(self));
    
    gtk_list_store_append(GTK_LIST_STORE(model), &iter);
    gtk_list_store_set(GTK_LIST_STORE(model), &iter,
                   COLUMN_MECHANISM, mechanism,
                   COLUMN_LABEL, label,
                   -1);
  }}
#line 350 "mn-auth-combo-box.c"
#undef __GOB_FUNCTION__

#line 142 "mn-auth-combo-box.gob"
GtkWidget * 
mn_auth_combo_box_new (void)
#line 356 "mn-auth-combo-box.c"
{
#define __GOB_FUNCTION__ "MN:Auth:Combo:Box::new"
{
#line 144 "mn-auth-combo-box.gob"
      
    return GTK_WIDGET(GET_NEW);
  }}
#line 364 "mn-auth-combo-box.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index