Logo Search packages:      
Sourcecode: latexila version File versions  Download package

custom_statusbar.c

/* custom_statusbar.c generated by valac 0.10.3, the Vala compiler
 * generated from custom_statusbar.vala, do not modify */

/*
 * This file is part of LaTeXila.
 *
 * Copyright © 2010 Sébastien Wilmet
 *
 * LaTeXila is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LaTeXila is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>


#define TYPE_CUSTOM_STATUSBAR (custom_statusbar_get_type ())
#define CUSTOM_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CUSTOM_STATUSBAR, CustomStatusbar))
#define CUSTOM_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CUSTOM_STATUSBAR, CustomStatusbarClass))
#define IS_CUSTOM_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CUSTOM_STATUSBAR))
#define IS_CUSTOM_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CUSTOM_STATUSBAR))
#define CUSTOM_STATUSBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CUSTOM_STATUSBAR, CustomStatusbarClass))

typedef struct _CustomStatusbar CustomStatusbar;
typedef struct _CustomStatusbarClass CustomStatusbarClass;
typedef struct _CustomStatusbarPrivate CustomStatusbarPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

00044 struct _CustomStatusbar {
      GtkStatusbar parent_instance;
      CustomStatusbarPrivate * priv;
};

00049 struct _CustomStatusbarClass {
      GtkStatusbarClass parent_class;
};

00053 struct _CustomStatusbarPrivate {
      GtkStatusbar* cursor_position;
};


static gpointer custom_statusbar_parent_class = NULL;

GType custom_statusbar_get_type (void) G_GNUC_CONST;
#define CUSTOM_STATUSBAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CUSTOM_STATUSBAR, CustomStatusbarPrivate))
enum  {
      CUSTOM_STATUSBAR_DUMMY_PROPERTY
};
CustomStatusbar* custom_statusbar_new (void);
CustomStatusbar* custom_statusbar_construct (GType object_type);
void custom_statusbar_set_cursor_position (CustomStatusbar* self, gint line, gint col);
static void custom_statusbar_finalize (GObject* obj);



CustomStatusbar* custom_statusbar_construct (GType object_type) {
      CustomStatusbar * self;
      GtkStatusbar* _tmp0_;
      self = g_object_newv (object_type, 0, NULL);
      self->priv->cursor_position = (_tmp0_ = g_object_ref_sink ((GtkStatusbar*) gtk_statusbar_new ()), _g_object_unref0 (self->priv->cursor_position), _tmp0_);
      gtk_statusbar_set_has_resize_grip (self->priv->cursor_position, FALSE);
      gtk_widget_set_size_request ((GtkWidget*) self->priv->cursor_position, 150, -1);
      gtk_box_pack_end ((GtkBox*) self, (GtkWidget*) self->priv->cursor_position, FALSE, TRUE, (guint) 0);
      return self;
}


CustomStatusbar* custom_statusbar_new (void) {
      return custom_statusbar_construct (TYPE_CUSTOM_STATUSBAR);
}


void custom_statusbar_set_cursor_position (CustomStatusbar* self, gint line, gint col) {
      gboolean _tmp0_ = FALSE;
      char* _tmp1_;
      g_return_if_fail (self != NULL);
      gtk_statusbar_pop (self->priv->cursor_position, (guint) 0);
      if (line == (-1)) {
            _tmp0_ = col == (-1);
      } else {
            _tmp0_ = FALSE;
      }
      if (_tmp0_) {
            return;
      }
      gtk_statusbar_push (self->priv->cursor_position, (guint) 0, _tmp1_ = g_strdup_printf (_ ("Ln %d, Col %d"), line, col));
      _g_free0 (_tmp1_);
}


static void custom_statusbar_class_init (CustomStatusbarClass * klass) {
      custom_statusbar_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (CustomStatusbarPrivate));
      G_OBJECT_CLASS (klass)->finalize = custom_statusbar_finalize;
}


static void custom_statusbar_instance_init (CustomStatusbar * self) {
      self->priv = CUSTOM_STATUSBAR_GET_PRIVATE (self);
}


static void custom_statusbar_finalize (GObject* obj) {
      CustomStatusbar * self;
      self = CUSTOM_STATUSBAR (obj);
      _g_object_unref0 (self->priv->cursor_position);
      G_OBJECT_CLASS (custom_statusbar_parent_class)->finalize (obj);
}


GType custom_statusbar_get_type (void) {
      static volatile gsize custom_statusbar_type_id__volatile = 0;
      if (g_once_init_enter (&custom_statusbar_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (CustomStatusbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) custom_statusbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CustomStatusbar), 0, (GInstanceInitFunc) custom_statusbar_instance_init, NULL };
            GType custom_statusbar_type_id;
            custom_statusbar_type_id = g_type_register_static (GTK_TYPE_STATUSBAR, "CustomStatusbar", &g_define_type_info, 0);
            g_once_init_leave (&custom_statusbar_type_id__volatile, custom_statusbar_type_id);
      }
      return custom_statusbar_type_id__volatile;
}





Generated by  Doxygen 1.6.0   Back to index