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

mn-autodetect-mailbox-properties.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-autodetect-mailbox-properties.h"

#include "mn-autodetect-mailbox-properties-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-autodetect-mailbox-properties.gob"

#include "config.h"
#include <glib/gi18n.h>
#include <eel/eel.h>
#include "mn-mailbox-properties.h"
#include "mn-mailbox-properties-util.h"
#include "mn-util.h"
#include "mn-properties-dialog.h"

  static char *current_folder_uri = NULL;

#line 39 "mn-autodetect-mailbox-properties.c"
/* self casting macros */
#define SELF(x) MN_AUTODETECT_MAILBOX_PROPERTIES(x)
#define SELF_CONST(x) MN_AUTODETECT_MAILBOX_PROPERTIES_CONST(x)
#define IS_SELF(x) MN_IS_AUTODETECT_MAILBOX_PROPERTIES(x)
#define TYPE_SELF MN_TYPE_AUTODETECT_MAILBOX_PROPERTIES
#define SELF_CLASS(x) MN_AUTODETECT_MAILBOX_PROPERTIES_CLASS(x)

#define SELF_GET_CLASS(x) MN_AUTODETECT_MAILBOX_PROPERTIES_GET_CLASS(x)

/* self typedefs */
typedef MNAutodetectMailboxProperties Self;
typedef MNAutodetectMailboxPropertiesClass 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_autodetect_mailbox_properties_init (MNAutodetectMailboxProperties * o) G_GNUC_UNUSED;
static void mn_autodetect_mailbox_properties_class_init (MNAutodetectMailboxPropertiesClass * c) G_GNUC_UNUSED;
static GObject * ___1_mn_autodetect_mailbox_properties_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_params) G_GNUC_UNUSED;
static void mn_autodetect_mailbox_properties_entry_changed_h (GtkEditable * editable, gpointer user_data) G_GNUC_UNUSED;
static void mn_autodetect_mailbox_properties_browse_clicked_h (GtkButton * button, gpointer user_data) G_GNUC_UNUSED;
static void mn_autodetect_mailbox_properties_current_folder_changed_h (GtkFileChooser * chooser, gpointer user_data) G_GNUC_UNUSED;
static void mn_autodetect_mailbox_properties_chooser_response_h (GtkDialog * dialog, int response, gpointer user_data) G_GNUC_UNUSED;
static gboolean mn_autodetect_mailbox_properties_set_uri (MNMailboxProperties * self, MNURI * uri) G_GNUC_UNUSED;
static MNURI * mn_autodetect_mailbox_properties_get_uri (MNMailboxProperties * self) G_GNUC_UNUSED;

enum {
      PROP_0,
      PROP_LABEL,
      PROP_SIZE_GROUP,
      PROP_COMPLETE
};

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

/* Short form macros */
#define self_entry_changed_h mn_autodetect_mailbox_properties_entry_changed_h
#define self_browse_clicked_h mn_autodetect_mailbox_properties_browse_clicked_h
#define self_current_folder_changed_h mn_autodetect_mailbox_properties_current_folder_changed_h
#define self_chooser_response_h mn_autodetect_mailbox_properties_chooser_response_h
#define self_set_uri mn_autodetect_mailbox_properties_set_uri
#define self_get_uri mn_autodetect_mailbox_properties_get_uri


static void
___MN_Mailbox_Properties_init (MNMailboxPropertiesIface *iface)
{
#line 176 "mn-autodetect-mailbox-properties.gob"
      iface->set_uri = self_set_uri;
#line 184 "mn-autodetect-mailbox-properties.gob"
      iface->get_uri = self_get_uri;
#line 92 "mn-autodetect-mailbox-properties.c"
}

GType
mn_autodetect_mailbox_properties_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (MNAutodetectMailboxPropertiesClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) mn_autodetect_mailbox_properties_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (MNAutodetectMailboxProperties),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) mn_autodetect_mailbox_properties_init,
                  NULL
            };

            static const GInterfaceInfo MN_Mailbox_Properties_info = {
                  (GInterfaceInitFunc) ___MN_Mailbox_Properties_init,
                  NULL,
                  NULL
            };

            type = g_type_register_static (GTK_TYPE_HBOX, "MNAutodetectMailboxProperties", &info, (GTypeFlags)0);
            g_type_add_interface_static (type,
                  MN_TYPE_MAILBOX_PROPERTIES,
                  &MN_Mailbox_Properties_info);
      }

      return type;
}

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

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


static void
___dispose (GObject *obj_self)
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::dispose"
      MNAutodetectMailboxProperties *self G_GNUC_UNUSED = MN_AUTODETECT_MAILBOX_PROPERTIES (obj_self);
      if (G_OBJECT_CLASS (parent_class)->dispose) \
            (* G_OBJECT_CLASS (parent_class)->dispose) (obj_self);
#line 41 "mn-autodetect-mailbox-properties.gob"
      if(self->_priv->size_group) { g_object_unref ((gpointer) self->_priv->size_group); self->_priv->size_group = NULL; }
#line 156 "mn-autodetect-mailbox-properties.c"
}
#undef __GOB_FUNCTION__


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::finalize"
      MNAutodetectMailboxProperties *self G_GNUC_UNUSED = MN_AUTODETECT_MAILBOX_PROPERTIES (obj_self);
      gpointer priv G_GNUC_UNUSED = self->_priv;
      if(G_OBJECT_CLASS(parent_class)->finalize) \
            (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
}
#undef __GOB_FUNCTION__

static void 
mn_autodetect_mailbox_properties_init (MNAutodetectMailboxProperties * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,TYPE_SELF,MNAutodetectMailboxPropertiesPrivate);
}
#undef __GOB_FUNCTION__
static void 
mn_autodetect_mailbox_properties_class_init (MNAutodetectMailboxPropertiesClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

      g_type_class_add_private(c,sizeof(MNAutodetectMailboxPropertiesPrivate));

      parent_class = g_type_class_ref (GTK_TYPE_HBOX);

#line 56 "mn-autodetect-mailbox-properties.gob"
      g_object_class->constructor = ___1_mn_autodetect_mailbox_properties_constructor;
#line 191 "mn-autodetect-mailbox-properties.c"
      g_object_class->dispose = ___dispose;
      g_object_class->finalize = ___finalize;
      g_object_class->get_property = ___object_get_property;
      g_object_class->set_property = ___object_set_property;
    {
      g_object_class_override_property (g_object_class,
            PROP_LABEL,
            "label");
      g_object_class_override_property (g_object_class,
            PROP_SIZE_GROUP,
            "size_group");
      g_object_class_override_property (g_object_class,
            PROP_COMPLETE,
            "complete");
    }
}
#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:Autodetect:Mailbox:Properties::set_property"
{
      MNAutodetectMailboxProperties *self G_GNUC_UNUSED;

      self = MN_AUTODETECT_MAILBOX_PROPERTIES (object);

      switch (property_id) {
      case PROP_SIZE_GROUP:
            {
#line 42 "mn-autodetect-mailbox-properties.gob"
{ GObject *___old = (GObject *)self->_priv->size_group; self->_priv->size_group = (void *)g_value_dup_object (VAL); if (___old != NULL) { g_object_unref (G_OBJECT (___old)); } }
#line 226 "mn-autodetect-mailbox-properties.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:Autodetect:Mailbox:Properties::get_property"
{
      MNAutodetectMailboxProperties *self G_GNUC_UNUSED;

      self = MN_AUTODETECT_MAILBOX_PROPERTIES (object);

      switch (property_id) {
      case PROP_LABEL:
            {
#line 39 "mn-autodetect-mailbox-properties.gob"
 g_value_set_string(VAL, _("<span style=\"italic\">autodetect</span>")); 
#line 257 "mn-autodetect-mailbox-properties.c"
            }
            break;
      case PROP_SIZE_GROUP:
            {
#line 42 "mn-autodetect-mailbox-properties.gob"
g_value_set_object (VAL, (gpointer)self->_priv->size_group);
#line 264 "mn-autodetect-mailbox-properties.c"
            }
            break;
      case PROP_COMPLETE:
            {
#line 46 "mn-autodetect-mailbox-properties.gob"

      const char *location;
      
      location = gtk_entry_get_text(GTK_ENTRY(SELF(self)->_priv->location_entry));
      g_value_set_boolean(VAL, *location != 0);
    
#line 276 "mn-autodetect-mailbox-properties.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 56 "mn-autodetect-mailbox-properties.gob"
static GObject * 
___1_mn_autodetect_mailbox_properties_constructor (GType type G_GNUC_UNUSED, guint n_construct_properties, GObjectConstructParam * construct_params)
#line 296 "mn-autodetect-mailbox-properties.c"
#define PARENT_HANDLER(___type,___n_construct_properties,___construct_params) \
      ((G_OBJECT_CLASS(parent_class)->constructor)? \
            (* G_OBJECT_CLASS(parent_class)->constructor)(___type,___n_construct_properties,___construct_params): \
            ((GObject * )0))
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::constructor"
{
#line 58 "mn-autodetect-mailbox-properties.gob"
      
    GObject *object;
    Self *self;
    GtkWidget *hbox;
    GtkWidget *label;
    GtkWidget *button;

    object = PARENT_HANDLER(type, n_construct_properties, construct_params);
    self = SELF(object);

    gtk_box_set_spacing(GTK_BOX(self), 12);
    
    label = gtk_label_new_with_mnemonic(_("_Location:"));
    gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
    
    hbox = gtk_hbox_new(FALSE, 6);
    
    selfp->location_entry = gtk_entry_new();
    button = gtk_button_new_with_mnemonic(_("_Browse..."));
    
    gtk_label_set_mnemonic_widget(GTK_LABEL(label), selfp->location_entry);
    gtk_entry_set_activates_default(GTK_ENTRY(selfp->location_entry), TRUE);

    mn_properties_dialog_set_tooltip(selfp->location_entry, _("The URI of the mailbox"));

    gtk_box_pack_start(GTK_BOX(hbox), selfp->location_entry, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(self), label, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(self), hbox, TRUE, TRUE, 0);
    
    gtk_widget_show(label);
    gtk_widget_show_all(hbox);

    gtk_size_group_add_widget(selfp->size_group, label);

    g_signal_connect(selfp->location_entry, "changed", G_CALLBACK(self_entry_changed_h), self);
    g_signal_connect(button, "clicked", G_CALLBACK(self_browse_clicked_h), self);

    return object;
  }}
#line 346 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__
#undef PARENT_HANDLER

#line 100 "mn-autodetect-mailbox-properties.gob"
static void 
mn_autodetect_mailbox_properties_entry_changed_h (GtkEditable * editable, gpointer user_data)
#line 353 "mn-autodetect-mailbox-properties.c"
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::entry_changed_h"
#line 100 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (editable != NULL);
#line 100 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (GTK_IS_EDITABLE (editable));
#line 100 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (user_data != NULL);
#line 362 "mn-autodetect-mailbox-properties.c"
{
#line 103 "mn-autodetect-mailbox-properties.gob"
      
    Self *self = user_data;
    g_object_notify(G_OBJECT(self), "complete");
  }}
#line 369 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__

#line 108 "mn-autodetect-mailbox-properties.gob"
static void 
mn_autodetect_mailbox_properties_browse_clicked_h (GtkButton * button, gpointer user_data)
#line 375 "mn-autodetect-mailbox-properties.c"
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::browse_clicked_h"
#line 108 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (button != NULL);
#line 108 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (GTK_IS_BUTTON (button));
#line 108 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (user_data != NULL);
#line 384 "mn-autodetect-mailbox-properties.c"
{
#line 111 "mn-autodetect-mailbox-properties.gob"
      
    Self *self = user_data;
    GtkWidget *toplevel;
    const char *location;

    if (selfp->chooser)
      {
      gtk_window_present(GTK_WINDOW(selfp->chooser));
      return;
      }
    
    toplevel = gtk_widget_get_toplevel(GTK_WIDGET(button));
    selfp->chooser = gtk_file_chooser_dialog_new_with_backend(_("Select a File or Folder"),
                                                GTK_WINDOW(toplevel),
                                                GTK_FILE_CHOOSER_ACTION_OPEN,
                                                "gnome-vfs",
                                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                                GTK_STOCK_OPEN, 1,
                                                NULL);
    eel_add_weak_pointer(&selfp->chooser);
    
    gtk_window_set_destroy_with_parent(GTK_WINDOW(selfp->chooser), TRUE);
    gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(selfp->chooser), FALSE);
    mn_file_chooser_dialog_allow_select_folder(GTK_FILE_CHOOSER_DIALOG(selfp->chooser), 1);

    location = gtk_entry_get_text(GTK_ENTRY(selfp->location_entry));
    if (*location)
      gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(selfp->chooser), location);
    else if (current_folder_uri)
      gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(selfp->chooser), current_folder_uri);
      
    g_object_connect(selfp->chooser,
                 "signal::current-folder-changed", self_current_folder_changed_h, self,
                 "signal::response", self_chooser_response_h, self,
                 NULL);

    gtk_widget_show(selfp->chooser);
  }}
#line 425 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__

#line 150 "mn-autodetect-mailbox-properties.gob"
static void 
mn_autodetect_mailbox_properties_current_folder_changed_h (GtkFileChooser * chooser, gpointer user_data)
#line 431 "mn-autodetect-mailbox-properties.c"
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::current_folder_changed_h"
#line 150 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (chooser != NULL);
#line 150 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
#line 438 "mn-autodetect-mailbox-properties.c"
{
#line 153 "mn-autodetect-mailbox-properties.gob"
      
    g_free(current_folder_uri);
    current_folder_uri = gtk_file_chooser_get_current_folder_uri(chooser);
  }}
#line 445 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__

#line 158 "mn-autodetect-mailbox-properties.gob"
static void 
mn_autodetect_mailbox_properties_chooser_response_h (GtkDialog * dialog, int response, gpointer user_data)
#line 451 "mn-autodetect-mailbox-properties.c"
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::chooser_response_h"
#line 158 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (dialog != NULL);
#line 158 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (GTK_IS_DIALOG (dialog));
#line 158 "mn-autodetect-mailbox-properties.gob"
      g_return_if_fail (user_data != NULL);
#line 460 "mn-autodetect-mailbox-properties.c"
{
#line 162 "mn-autodetect-mailbox-properties.gob"
      
    if (response == 1)
      {
      Self *self = user_data;
      char *uri;
      
      uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
      gtk_entry_set_text(GTK_ENTRY(selfp->location_entry), uri);
      g_free(uri);
      }

    gtk_widget_destroy(GTK_WIDGET(dialog));
  }}
#line 476 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__

#line 176 "mn-autodetect-mailbox-properties.gob"
static gboolean 
mn_autodetect_mailbox_properties_set_uri (MNMailboxProperties * self, MNURI * uri)
#line 482 "mn-autodetect-mailbox-properties.c"
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::set_uri"
#line 176 "mn-autodetect-mailbox-properties.gob"
      g_return_val_if_fail (self != NULL, (gboolean )0);
#line 176 "mn-autodetect-mailbox-properties.gob"
      g_return_val_if_fail (MN_IS_MAILBOX_PROPERTIES (self), (gboolean )0);
#line 176 "mn-autodetect-mailbox-properties.gob"
      g_return_val_if_fail (uri != NULL, (gboolean )0);
#line 176 "mn-autodetect-mailbox-properties.gob"
      g_return_val_if_fail (MN_IS_URI (uri), (gboolean )0);
#line 493 "mn-autodetect-mailbox-properties.c"
{
#line 179 "mn-autodetect-mailbox-properties.gob"
      
    gtk_entry_set_text(GTK_ENTRY(SELF(self)->_priv->location_entry), uri->text);
    return TRUE;
  }}
#line 500 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__

#line 184 "mn-autodetect-mailbox-properties.gob"
static MNURI * 
mn_autodetect_mailbox_properties_get_uri (MNMailboxProperties * self)
#line 506 "mn-autodetect-mailbox-properties.c"
{
#define __GOB_FUNCTION__ "MN:Autodetect:Mailbox:Properties::get_uri"
#line 184 "mn-autodetect-mailbox-properties.gob"
      g_return_val_if_fail (self != NULL, (MNURI * )0);
#line 184 "mn-autodetect-mailbox-properties.gob"
      g_return_val_if_fail (MN_IS_MAILBOX_PROPERTIES (self), (MNURI * )0);
#line 513 "mn-autodetect-mailbox-properties.c"
{
#line 186 "mn-autodetect-mailbox-properties.gob"
      
    const char *location;

    location = gtk_entry_get_text(GTK_ENTRY(SELF(self)->_priv->location_entry));
    return mn_uri_new(location);
  }}
#line 522 "mn-autodetect-mailbox-properties.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index