Logo Search packages:      
Sourcecode: gnome-compiz-manager version File versions

gcp-top-bottom-dialog.c

/* Generated by GOB (v2.0.14)   (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 14

#define selfp (self->_priv)

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

#include "gcp-top-bottom-dialog.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 31 "gcp-top-bottom-dialog.gob"

#include "gcm-entry-shortcut.h"
      
#ifdef ENABLE_NLS
#  include <libintl.h>
#  undef _
#  define _(String) dgettext (PACKAGE, String)
#  ifdef gettext_noop
#    define N_(String) gettext_noop (String)
#  else
#    define N_(String) (String)
#  endif
#else
#  define textdomain(String) (String)
#  define gettext(String) (String)
#  define dgettext(Domain,Message) (Message)
#  define dcgettext(Domain,Message,Type) (Message)
#  define bindtextdomain(Domain,Directory) (Domain)
#  define _(String) (String)
#  define N_(String) (String)
#endif
      
/* For testing propose use the local (not installed) glade file */
#define GCP_TOP_BOTTOM_DIALOG_GLADE_FILE PACKAGE_DATA_DIR"/gnome-compiz-manager/glade/gcp-page-workspaces.glade"
/* #define GCP_TOP_BOTTOM_DIALOG_GLADE_FILE "data/gcp-page-workspaces.glade" */

#line 51 "gcp-top-bottom-dialog.c"
static const GEnumValue _glb_top_bottom_slides_column_values[] = {
      { GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP, (char *)"GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP", (char *)"top" },
      { GCP_TOP_BOTTOM_SLIDES_COLUMN_PIXMAP, (char *)"GCP_TOP_BOTTOM_SLIDES_COLUMN_PIXMAP", (char *)"pixmap" },
      { GCP_TOP_BOTTOM_SLIDES_COLUMN_FILENAME, (char *)"GCP_TOP_BOTTOM_SLIDES_COLUMN_FILENAME", (char *)"filename" },
      { GCP_TOP_BOTTOM_SLIDES_COLUMN_BASENAME, (char *)"GCP_TOP_BOTTOM_SLIDES_COLUMN_BASENAME", (char *)"basename" },
      { GCP_TOP_BOTTOM_SLIDES_COLUMN_NUMBER, (char *)"GCP_TOP_BOTTOM_SLIDES_COLUMN_NUMBER", (char *)"number" },
      { 0, NULL, NULL }
};

GType
glb_top_bottom_slides_column_get_type (void)
{
      static GType type = 0;
      if ___GOB_UNLIKELY(type == 0)
            type = g_enum_register_static ("GlbTopBottomSlidesColumn", _glb_top_bottom_slides_column_values);
      return type;
}

/* self casting macros */
#define SELF(x) GCP_TOP_BOTTOM_DIALOG(x)
#define SELF_CONST(x) GCP_TOP_BOTTOM_DIALOG_CONST(x)
#define IS_SELF(x) GCP_IS_TOP_BOTTOM_DIALOG(x)
#define TYPE_SELF GCP_TYPE_TOP_BOTTOM_DIALOG
#define SELF_CLASS(x) GCP_TOP_BOTTOM_DIALOG_CLASS(x)

#define SELF_GET_CLASS(x) GCP_TOP_BOTTOM_DIALOG_GET_CLASS(x)

/* self typedefs */
typedef GCPTopBottomDialog Self;
typedef GCPTopBottomDialogClass SelfClass;

struct _GCPTopBottomDialogPrivate {
#line 0 "gcp-top-bottom-dialog.gob"
      GladeXML * _glade_xml;
#line 69 "gcp-top-bottom-dialog.gob"
      GCMGLPlugin * cube;
#line 71 "gcp-top-bottom-dialog.gob"
      GCMGLPlugin * rotate;
#line 73 "gcp-top-bottom-dialog.gob"
      GCMGLOption * snap_top;
#line 75 "gcp-top-bottom-dialog.gob"
      GCMGLOption * scale_image;
#line 77 "gcp-top-bottom-dialog.gob"
      GCMGLOption * images;
#line 79 "gcp-top-bottom-dialog.gob"
      GCMGLOption * prev_slide_key;
#line 81 "gcp-top-bottom-dialog.gob"
      GCMGLOption * next_slide_key;
#line 83 "gcp-top-bottom-dialog.gob"
      GtkListStore * model;
#line 85 "gcp-top-bottom-dialog.gob"
      GtkTreeModel * model_filtered;
#line 87 "gcp-top-bottom-dialog.gob"
      gboolean top;
#line 88 "gcp-top-bottom-dialog.gob"
      GtkCheckButton * options_stay_top_checkbutton;
#line 89 "gcp-top-bottom-dialog.gob"
      GtkCheckButton * options_scale_images_checkbutton;
#line 90 "gcp-top-bottom-dialog.gob"
      GtkTreeView * slides_treeview;
#line 91 "gcp-top-bottom-dialog.gob"
      GtkButton * slides_add_button;
#line 92 "gcp-top-bottom-dialog.gob"
      GtkButton * slides_remove_button;
#line 93 "gcp-top-bottom-dialog.gob"
      GtkButton * slides_up_button;
#line 94 "gcp-top-bottom-dialog.gob"
      GtkButton * slides_down_button;
#line 95 "gcp-top-bottom-dialog.gob"
      GtkFrame * shortcuts_frame;
#line 96 "gcp-top-bottom-dialog.gob"
      GtkTable * shortcuts_table;
#line 124 "gcp-top-bottom-dialog.c"
};
/* here are local prototypes */
static void gcp_top_bottom_dialog_init (GCPTopBottomDialog * o) G_GNUC_UNUSED;
static void gcp_top_bottom_dialog_class_init (GCPTopBottomDialogClass * c) G_GNUC_UNUSED;
static void gcp_top_bottom_dialog_get_options (GCPTopBottomDialog * self) G_GNUC_UNUSED;
gboolean    gcp_top_bottom_dialog_delete_event  (GCPTopBottomDialog * self, GdkEvent * event, gpointer data);
void  gcp_top_bottom_dialog_on_cancel_button_clicked  (GCPTopBottomDialog * self, GtkWidget * button);
void  gcp_top_bottom_dialog_on_apply_button_clicked   (GCPTopBottomDialog * self, GtkWidget * button);
static void gcp_top_bottom_dialog_init_options (GCPTopBottomDialog * self) G_GNUC_UNUSED;
void  gcp_top_bottom_dialog_on_options_stay_top_checkbutton_toggled     (GCPTopBottomDialog * self, GtkWidget * button);
void  gcp_top_bottom_dialog_on_options_scale_images_checkbutton_toggled (GCPTopBottomDialog * self, GtkWidget * button);
static void gcp_top_bottom_dialog_init_slides (GCPTopBottomDialog * self) G_GNUC_UNUSED;
void  gcp_top_bottom_dialog_on_slides_add_button_clicked    (GCPTopBottomDialog * self, GtkButton * button);
void  gcp_top_bottom_dialog_on_slides_remove_button_clicked (GCPTopBottomDialog * self, GtkButton * button);
void  gcp_top_bottom_dialog_on_slides_up_button_clicked     (GCPTopBottomDialog * self, GtkButton * button);
void  gcp_top_bottom_dialog_on_slides_down_button_clicked   (GCPTopBottomDialog * self, GtkButton * button);
static void gcp_top_bottom_dialog_add_columns (GCPTopBottomDialog * self) G_GNUC_UNUSED;
static gboolean gcp_top_bottom_dialog_filter_slides (GtkTreeModel * model, GtkTreeIter * iter, GCPTopBottomDialog * self) G_GNUC_UNUSED;
static void gcp_top_bottom_dialog_init_shortcuts (GCPTopBottomDialog * self) G_GNUC_UNUSED;
static void gcp_top_bottom_dialog_on_prev_slide_entryshortcut_changed (GCPTopBottomDialog * self, GCMEntryShortcut * entry) G_GNUC_UNUSED;
static void gcp_top_bottom_dialog_on_next_slide_entryshortcut_changed (GCPTopBottomDialog * self, GCMEntryShortcut * entry) G_GNUC_UNUSED;

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

/* Short form macros */
#define self_new gcp_top_bottom_dialog_new
#define self_get_options gcp_top_bottom_dialog_get_options
#define self_delete_event gcp_top_bottom_dialog_delete_event
#define self_on_cancel_button_clicked gcp_top_bottom_dialog_on_cancel_button_clicked
#define self_on_apply_button_clicked gcp_top_bottom_dialog_on_apply_button_clicked
#define self_init_options gcp_top_bottom_dialog_init_options
#define self_on_options_stay_top_checkbutton_toggled gcp_top_bottom_dialog_on_options_stay_top_checkbutton_toggled
#define self_on_options_scale_images_checkbutton_toggled gcp_top_bottom_dialog_on_options_scale_images_checkbutton_toggled
#define self_init_slides gcp_top_bottom_dialog_init_slides
#define self_on_slides_add_button_clicked gcp_top_bottom_dialog_on_slides_add_button_clicked
#define self_on_slides_remove_button_clicked gcp_top_bottom_dialog_on_slides_remove_button_clicked
#define self_on_slides_up_button_clicked gcp_top_bottom_dialog_on_slides_up_button_clicked
#define self_on_slides_down_button_clicked gcp_top_bottom_dialog_on_slides_down_button_clicked
#define self_add_columns gcp_top_bottom_dialog_add_columns
#define self_filter_slides gcp_top_bottom_dialog_filter_slides
#define self_init_shortcuts gcp_top_bottom_dialog_init_shortcuts
#define self_on_prev_slide_entryshortcut_changed gcp_top_bottom_dialog_on_prev_slide_entryshortcut_changed
#define self_on_next_slide_entryshortcut_changed gcp_top_bottom_dialog_on_next_slide_entryshortcut_changed
GType
gcp_top_bottom_dialog_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCPTopBottomDialogClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcp_top_bottom_dialog_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCPTopBottomDialog),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcp_top_bottom_dialog_init,
                  NULL
            };

            type = g_type_register_static (GTK_TYPE_WINDOW, "GCPTopBottomDialog", &info, (GTypeFlags)0);
      }

      return type;
}

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

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

/* a function to connect glade callback */
static void
___glade_xml_connect_foreach(const gchar *handler_name,
GObject *object,
const gchar *signal_name,
const gchar *signal_data,
GObject *connect_object,
gboolean after,
gpointer user_data)
{
      static GModule * allsymbols = NULL;
      
      if (!allsymbols) allsymbols = g_module_open(NULL, 0);
      if (allsymbols) {
            gchar * func_name = g_strdup_printf("gcp_top_bottom_dialog_%s", handler_name);
            GCallback func;

            if (!g_module_symbol(allsymbols, func_name, (gpointer)&func)){
                  if (!g_module_symbol(allsymbols, handler_name, (gpointer)&func)) {
                        g_warning("could not find signal handler '%s'.", func_name);
                        g_free(func_name);
                        return;
                  }
            }
            if (after)
                  g_signal_connect_data(object, signal_name, func, user_data, NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
            else
                  g_signal_connect_data(object, signal_name, func, user_data, NULL, G_CONNECT_SWAPPED);
            g_free(func_name);
      }
}


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::finalize"
      GCPTopBottomDialog *self G_GNUC_UNUSED = GCP_TOP_BOTTOM_DIALOG (obj_self);
      gpointer priv G_GNUC_UNUSED = self->_priv;
      if(G_OBJECT_CLASS(parent_class)->finalize) \
            (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
      if(self->_priv->_glade_xml) { g_object_unref ((gpointer) self->_priv->_glade_xml); self->_priv->_glade_xml = NULL; }
#line 70 "gcp-top-bottom-dialog.gob"
      if(self->_priv->cube) { g_object_unref ((gpointer) self->_priv->cube); self->_priv->cube = NULL; }
#line 255 "gcp-top-bottom-dialog.c"
#line 72 "gcp-top-bottom-dialog.gob"
      if(self->_priv->rotate) { g_object_unref ((gpointer) self->_priv->rotate); self->_priv->rotate = NULL; }
#line 258 "gcp-top-bottom-dialog.c"
#line 74 "gcp-top-bottom-dialog.gob"
      if(self->_priv->snap_top) { g_object_unref ((gpointer) self->_priv->snap_top); self->_priv->snap_top = NULL; }
#line 261 "gcp-top-bottom-dialog.c"
#line 76 "gcp-top-bottom-dialog.gob"
      if(self->_priv->scale_image) { g_object_unref ((gpointer) self->_priv->scale_image); self->_priv->scale_image = NULL; }
#line 264 "gcp-top-bottom-dialog.c"
#line 78 "gcp-top-bottom-dialog.gob"
      if(self->_priv->images) { g_object_unref ((gpointer) self->_priv->images); self->_priv->images = NULL; }
#line 267 "gcp-top-bottom-dialog.c"
#line 80 "gcp-top-bottom-dialog.gob"
      if(self->_priv->prev_slide_key) { g_object_unref ((gpointer) self->_priv->prev_slide_key); self->_priv->prev_slide_key = NULL; }
#line 270 "gcp-top-bottom-dialog.c"
#line 82 "gcp-top-bottom-dialog.gob"
      if(self->_priv->next_slide_key) { g_object_unref ((gpointer) self->_priv->next_slide_key); self->_priv->next_slide_key = NULL; }
#line 273 "gcp-top-bottom-dialog.c"
#line 84 "gcp-top-bottom-dialog.gob"
      if(self->_priv->model) { g_object_unref ((gpointer) self->_priv->model); self->_priv->model = NULL; }
#line 276 "gcp-top-bottom-dialog.c"
#line 86 "gcp-top-bottom-dialog.gob"
      if(self->_priv->model_filtered) { g_object_unref ((gpointer) self->_priv->model_filtered); self->_priv->model_filtered = NULL; }
#line 279 "gcp-top-bottom-dialog.c"
}
#undef __GOB_FUNCTION__

static void 
gcp_top_bottom_dialog_init (GCPTopBottomDialog * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,GCP_TYPE_TOP_BOTTOM_DIALOG,GCPTopBottomDialogPrivate);
      {
      GtkWidget * root;
      o->_priv->_glade_xml = glade_xml_new(GCP_TOP_BOTTOM_DIALOG_GLADE_FILE, "top_bottom_dialog", NULL);
      root = glade_xml_get_widget(o->_priv->_glade_xml, "top_bottom_dialog");
      gtk_widget_show(root);
      gtk_container_add(GTK_CONTAINER(o), root);
      glade_xml_signal_autoconnect_full(o->_priv->_glade_xml, (GladeXMLConnectFunc)___glade_xml_connect_foreach, (gpointer)o);
}
#line 31 "gcp-top-bottom-dialog.gob"
      o->_priv->top = TRUE;
#line 298 "gcp-top-bottom-dialog.c"
      o->_priv->options_stay_top_checkbutton = (GtkCheckButton * )glade_xml_get_widget(o->_priv->_glade_xml, "options_stay_top_checkbutton");
      o->_priv->options_scale_images_checkbutton = (GtkCheckButton * )glade_xml_get_widget(o->_priv->_glade_xml, "options_scale_images_checkbutton");
      o->_priv->slides_treeview = (GtkTreeView * )glade_xml_get_widget(o->_priv->_glade_xml, "slides_treeview");
      o->_priv->slides_add_button = (GtkButton * )glade_xml_get_widget(o->_priv->_glade_xml, "slides_add_button");
      o->_priv->slides_remove_button = (GtkButton * )glade_xml_get_widget(o->_priv->_glade_xml, "slides_remove_button");
      o->_priv->slides_up_button = (GtkButton * )glade_xml_get_widget(o->_priv->_glade_xml, "slides_up_button");
      o->_priv->slides_down_button = (GtkButton * )glade_xml_get_widget(o->_priv->_glade_xml, "slides_down_button");
      o->_priv->shortcuts_frame = (GtkFrame * )glade_xml_get_widget(o->_priv->_glade_xml, "shortcuts_frame");
      o->_priv->shortcuts_table = (GtkTable * )glade_xml_get_widget(o->_priv->_glade_xml, "shortcuts_table");
}
#undef __GOB_FUNCTION__
static void 
gcp_top_bottom_dialog_class_init (GCPTopBottomDialogClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

      g_type_class_add_private(c,sizeof(GCPTopBottomDialogPrivate));

      parent_class = g_type_class_ref (GTK_TYPE_WINDOW);

      g_object_class->finalize = ___finalize;
}
#undef __GOB_FUNCTION__



#line 98 "gcp-top-bottom-dialog.gob"
GtkWidget * 
gcp_top_bottom_dialog_new (GCMGLPlugin * cube, GCMGLPlugin * rotate)
#line 329 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::new"
#line 98 "gcp-top-bottom-dialog.gob"
      g_return_val_if_fail (cube != NULL, (GtkWidget * )NULL);
#line 98 "gcp-top-bottom-dialog.gob"
      g_return_val_if_fail (rotate != NULL, (GtkWidget * )NULL);
#line 336 "gcp-top-bottom-dialog.c"
{
#line 100 "gcp-top-bottom-dialog.gob"
      
            GCPTopBottomDialog * self = GET_NEW;
            
            gtk_window_set_title(GTK_WINDOW(self), 
                                           _("Top and bottom cube images"));
            
            gtk_window_set_modal(GTK_WINDOW(self), TRUE);
            
            g_signal_connect(GTK_WIDGET(self), 
                                    "delete-event", 
                                    G_CALLBACK(self_delete_event), NULL);
            
            selfp->cube = g_object_ref(cube);
            selfp->rotate = g_object_ref(rotate);
            self_get_options(self);
            
            /* Create models */
            selfp->model = gtk_list_store_new(GCP_TOP_BOTTOM_SLIDES_COLUMN_NUMBER,
                                                              G_TYPE_BOOLEAN,
                                                              GDK_TYPE_PIXBUF,
                                                              G_TYPE_STRING,
                                                              G_TYPE_STRING);
            selfp->model_filtered = gtk_tree_model_filter_new(GTK_TREE_MODEL(selfp->model),
                                                                                      NULL);
            gtk_tree_view_set_model(selfp->slides_treeview, selfp->model_filtered);
            
            gtk_tree_model_filter_set_visible_func(
                                          GTK_TREE_MODEL_FILTER(selfp->model_filtered),
                                          (GtkTreeModelFilterVisibleFunc)self_filter_slides,
                                          self,
                                          NULL);
            
            /* add columns */ 
            self_add_columns(self);
            
            self_init_slides(self);
            self_init_options(self);
            self_init_shortcuts(self);
            
            return GTK_WIDGET(self);
      }}
#line 380 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 142 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_get_options (GCPTopBottomDialog * self)
#line 386 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::get_options"
#line 142 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 142 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 393 "gcp-top-bottom-dialog.c"
{
#line 144 "gcp-top-bottom-dialog.gob"
      
            selfp->snap_top = gcm_gl_plugin_get_option(selfp->rotate, "snap_top", 
                                                   0);
            selfp->scale_image = gcm_gl_plugin_get_option(selfp->cube, "scale_image", 
                                                      0);
            selfp->images = gcm_gl_plugin_get_option(selfp->cube, "images", 0);
            selfp->prev_slide_key = gcm_gl_plugin_get_option(selfp->cube, 
                                                                                     "prev_slide_key", 
                                                                                     GCM_GL_OPTION_SCREEN_ALL);
            selfp->next_slide_key = gcm_gl_plugin_get_option(selfp->cube, 
                                                                                     "next_slide_key",
                                                                                     GCM_GL_OPTION_SCREEN_ALL);
      }}
#line 409 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 158 "gcp-top-bottom-dialog.gob"
gboolean 
gcp_top_bottom_dialog_delete_event (GCPTopBottomDialog * self, GdkEvent * event, gpointer data)
#line 415 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::delete_event"
#line 158 "gcp-top-bottom-dialog.gob"
      g_return_val_if_fail (self != NULL, (gboolean )0);
#line 158 "gcp-top-bottom-dialog.gob"
      g_return_val_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self), (gboolean )0);
#line 422 "gcp-top-bottom-dialog.c"
{
#line 160 "gcp-top-bottom-dialog.gob"
      
            gtk_widget_hide(GTK_WIDGET(self));
            return TRUE;
      }}
#line 429 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 165 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_cancel_button_clicked (GCPTopBottomDialog * self, GtkWidget * button)
#line 435 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_cancel_button_clicked"
#line 165 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 165 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 442 "gcp-top-bottom-dialog.c"
{
#line 167 "gcp-top-bottom-dialog.gob"
      
            gtk_widget_hide(GTK_WIDGET(self));
      }}
#line 448 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 171 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_apply_button_clicked (GCPTopBottomDialog * self, GtkWidget * button)
#line 454 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_apply_button_clicked"
#line 171 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 171 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 461 "gcp-top-bottom-dialog.c"
{
#line 173 "gcp-top-bottom-dialog.gob"
      
            GtkTreeIter iter;
            GSList * top_images_list = NULL;
            
            gtk_widget_hide(GTK_WIDGET(self));
            if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(selfp->model), &iter))
            {
                  do 
                  {
                        gboolean top;
                        gchar * filename;
                        
                        gtk_tree_model_get(GTK_TREE_MODEL(selfp->model), &iter, 
                                                   GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP,
                                                   &top,
                                                   GCP_TOP_BOTTOM_SLIDES_COLUMN_FILENAME, 
                                                   &filename, -1);
                        if (top)
                              top_images_list = g_slist_append(top_images_list, filename);
                  } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(selfp->model), 
                                                                    &iter));
            }
            gcm_gl_option_set_string_list(selfp->images,
                                                        top_images_list);
            if (top_images_list)
            {
                  g_slist_foreach(top_images_list, (GFunc)g_free, NULL);
                  g_slist_free(top_images_list);
            }
      }}
#line 494 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 204 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_init_options (GCPTopBottomDialog * self)
#line 500 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::init_options"
#line 204 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 204 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 507 "gcp-top-bottom-dialog.c"
{
#line 206 "gcp-top-bottom-dialog.gob"
      
            gboolean stay_on_top = gcm_gl_option_get_boolean(selfp->snap_top);
            gboolean scale_image = gcm_gl_option_get_boolean(selfp->scale_image);
            GtkTooltips * tooltips;
            
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(selfp->options_stay_top_checkbutton),
                                                       stay_on_top);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(selfp->options_scale_images_checkbutton),
                                                       scale_image);
            tooltips = gtk_tooltips_new();
            gtk_tooltips_set_tip(tooltips, GTK_WIDGET(selfp->options_stay_top_checkbutton),
                                           gcm_gl_option_get_description(selfp->snap_top),
                                           NULL);
        gtk_tooltips_set_tip(tooltips, GTK_WIDGET(selfp->options_scale_images_checkbutton),
                                           gcm_gl_option_get_description(selfp->scale_image),
                                           NULL);           
      }}
#line 527 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 224 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_options_stay_top_checkbutton_toggled (GCPTopBottomDialog * self, GtkWidget * button)
#line 533 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_options_stay_top_checkbutton_toggled"
#line 224 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 224 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 540 "gcp-top-bottom-dialog.c"
{
#line 226 "gcp-top-bottom-dialog.gob"
      
            gcm_gl_option_set_boolean(selfp->snap_top, 
                  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(selfp->options_stay_top_checkbutton)));
      }}
#line 547 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 231 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_options_scale_images_checkbutton_toggled (GCPTopBottomDialog * self, GtkWidget * button)
#line 553 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_options_scale_images_checkbutton_toggled"
#line 231 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 231 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 560 "gcp-top-bottom-dialog.c"
{
#line 233 "gcp-top-bottom-dialog.gob"
      
            gcm_gl_option_set_boolean(selfp->scale_image, 
                  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(selfp->options_scale_images_checkbutton)));
      }}
#line 567 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 238 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_init_slides (GCPTopBottomDialog * self)
#line 573 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::init_slides"
#line 238 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 238 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 580 "gcp-top-bottom-dialog.c"
{
#line 240 "gcp-top-bottom-dialog.gob"
      
            GSList * top_images_list = gcm_gl_option_get_string_list(selfp->images);
            GSList * item;
            GtkTreeIter iter;
            GtkTooltips * tooltips;
            
            for (item = top_images_list; item; item = item->next)
            {
                  gchar * filename = (gchar *)item->data;
                  gchar * basename = g_path_get_basename(filename);
                  GdkPixbuf *  pixbuf = gdk_pixbuf_new_from_file_at_size(filename,
                                                                                                   128,
                                                                                                   128,
                                                                                                   NULL);
                  
                  gtk_list_store_append(selfp->model, &iter);
                  gtk_list_store_set(selfp->model, &iter,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP, TRUE,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_PIXMAP, pixbuf,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_FILENAME, filename,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_BASENAME, basename,
                                             -1);
            }
            g_slist_foreach(top_images_list, (GFunc)g_free, NULL);
            g_slist_free(top_images_list);
            tooltips = gtk_tooltips_new();
            gtk_tooltips_set_tip(tooltips, GTK_WIDGET(selfp->slides_treeview),
                                           gcm_gl_option_get_description(selfp->images),
                                           NULL);
      }}
#line 613 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 271 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_slides_add_button_clicked (GCPTopBottomDialog * self, GtkButton * button)
#line 619 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_slides_add_button_clicked"
#line 271 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 271 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 626 "gcp-top-bottom-dialog.c"
{
#line 273 "gcp-top-bottom-dialog.gob"
      
            static gchar * uri_folder = NULL;
            GtkFileFilter * filter;
            GtkWidget * dialog = gtk_file_chooser_dialog_new(_("Add slide image"),
                                                                        GTK_WINDOW(self),
                                                                        GTK_FILE_CHOOSER_ACTION_OPEN,
                                                                        GTK_STOCK_CANCEL, 
                                                                        GTK_RESPONSE_CANCEL,
                                                                        GTK_STOCK_OPEN, 
                                                                        GTK_RESPONSE_OK,
                                                                        NULL);
            if (uri_folder)
                  gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), 
                                                                              uri_folder);
            
            filter = gtk_file_filter_new ();    
            gtk_file_filter_add_pattern (filter, "*.svg");
            gtk_file_filter_add_pattern (filter, "*.png");
            gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), 
                                                       filter);

            if ((gtk_dialog_run(GTK_DIALOG(dialog))) == GTK_RESPONSE_OK)
            {
                  gchar * filename;
                  gchar * basename;
                  GtkTreeIter iter;
                  GdkPixbuf * pixbuf;
                  
                  if (uri_folder) g_free(uri_folder);
                  uri_folder = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (dialog));
                  filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
                  basename = g_path_get_basename(filename);
                  pixbuf = gdk_pixbuf_new_from_file_at_size(filename,
                                                                                128,
                                                                                128,
                                                                                NULL);
                  gtk_list_store_append(selfp->model, &iter);
                  gtk_list_store_set(selfp->model, &iter,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP, selfp->top,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_PIXMAP, pixbuf,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_FILENAME, filename,
                                             GCP_TOP_BOTTOM_SLIDES_COLUMN_BASENAME, basename,
                                             -1);
            }
            gtk_widget_destroy(dialog);
      }}
#line 675 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 320 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_slides_remove_button_clicked (GCPTopBottomDialog * self, GtkButton * button)
#line 681 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_slides_remove_button_clicked"
#line 320 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 320 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 688 "gcp-top-bottom-dialog.c"
{
#line 322 "gcp-top-bottom-dialog.gob"
      
            GtkTreeSelection * selection = gtk_tree_view_get_selection(selfp->slides_treeview);
            GtkTreeIter iter;
            
            if (gtk_tree_selection_get_selected(selection, NULL, &iter))
            {
                  GtkTreeIter iter_child;
                  
                  gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(selfp->model_filtered),
                                                                                           &iter_child, &iter);
                  gtk_list_store_remove(selfp->model, &iter_child);
            }
      }}
#line 704 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 336 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_slides_up_button_clicked (GCPTopBottomDialog * self, GtkButton * button)
#line 710 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_slides_up_button_clicked"
#line 336 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 336 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 717 "gcp-top-bottom-dialog.c"
{
#line 338 "gcp-top-bottom-dialog.gob"
      
            GtkTreeSelection * selection = gtk_tree_view_get_selection(selfp->slides_treeview);
            GtkTreeIter iter;
            
            if (gtk_tree_selection_get_selected(selection, NULL, &iter))
            {
                  GtkTreeIter iter_child, iter_prev;
                  GtkTreePath * path;
                  gboolean top, result;
                  
                  gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(selfp->model_filtered),
                                                                                           &iter_child, &iter);
                  path = gtk_tree_model_get_path(GTK_TREE_MODEL(selfp->model),
                                                                                     &iter_child);
                  do {
                        result = gtk_tree_path_prev (path);
                        if (!result) break;
                        result = gtk_tree_model_get_iter (GTK_TREE_MODEL(selfp->model), 
                                                                              &iter_prev, path);
                        if (!result) break;
                        gtk_tree_model_get(GTK_TREE_MODEL(selfp->model), &iter_prev,
                                                   GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP, &top, -1);
                  } while (top != selfp->top);
                  if (result)
                        gtk_list_store_move_before (selfp->model,
                                                                  &iter_child, &iter_prev);
            }
      }}
#line 748 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 367 "gcp-top-bottom-dialog.gob"
void 
gcp_top_bottom_dialog_on_slides_down_button_clicked (GCPTopBottomDialog * self, GtkButton * button)
#line 754 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_slides_down_button_clicked"
#line 367 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 367 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 761 "gcp-top-bottom-dialog.c"
{
#line 369 "gcp-top-bottom-dialog.gob"
      
            GtkTreeSelection * selection = gtk_tree_view_get_selection(selfp->slides_treeview);
            GtkTreeIter iter;
            
            if (gtk_tree_selection_get_selected(selection, NULL, &iter))
            {
                  GtkTreeIter iter_child, iter_next;
                  GtkTreePath * path;
                  gboolean top, result;
                  
                  gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(selfp->model_filtered),
                                                                                           &iter_child, &iter);
                  path = gtk_tree_model_get_path(GTK_TREE_MODEL(selfp->model),
                                                                                     &iter_child);
                  do {
                        gtk_tree_path_next (path);
                        result = gtk_tree_model_get_iter (GTK_TREE_MODEL(selfp->model), 
                                                                              &iter_next, path);
                        if (!result) break;
                        gtk_tree_model_get(GTK_TREE_MODEL(selfp->model), &iter_next,
                                                   GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP, &top, -1);
                  } while (top != selfp->top);
                                          
                  if (result)
                        gtk_list_store_move_after (selfp->model,
                                                                  &iter_child, &iter_next);
            }
      }}
#line 792 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 398 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_add_columns (GCPTopBottomDialog * self)
#line 798 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::add_columns"
#line 398 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 398 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 805 "gcp-top-bottom-dialog.c"
{
#line 400 "gcp-top-bottom-dialog.gob"
      
            gtk_tree_view_insert_column_with_attributes(selfp->slides_treeview, 
                                                            -1, 
                                                            _("Image"), 
                                                            gtk_cell_renderer_pixbuf_new(),
                                                            "pixbuf", 
                                                            GCP_TOP_BOTTOM_SLIDES_COLUMN_PIXMAP, 
                                                            NULL);
            
            gtk_tree_view_insert_column_with_attributes(selfp->slides_treeview, 
                                                            -1, 
                                                            _("Name"), 
                                                            gtk_cell_renderer_text_new(),
                                                            "text", 
                                                            GCP_TOP_BOTTOM_SLIDES_COLUMN_BASENAME,
                                                            NULL);
      }}
#line 825 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 418 "gcp-top-bottom-dialog.gob"
static gboolean 
gcp_top_bottom_dialog_filter_slides (GtkTreeModel * model, GtkTreeIter * iter, GCPTopBottomDialog * self)
#line 831 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::filter_slides"
{
#line 421 "gcp-top-bottom-dialog.gob"
      
            gboolean top;
            
            gtk_tree_model_get(model, iter,
                                       GCP_TOP_BOTTOM_SLIDES_COLUMN_TOP, &top, -1);
            
            return (selfp->top == top);
      }}
#line 844 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 430 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_init_shortcuts (GCPTopBottomDialog * self)
#line 850 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::init_shortcuts"
#line 430 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 430 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 857 "gcp-top-bottom-dialog.c"
{
#line 432 "gcp-top-bottom-dialog.gob"
      
            GtkWidget * prev_slide_entryshortcut;
            GtkWidget * next_slide_entryshortcut;
            gchar * prev_slide = gcm_gl_option_get_string(selfp->prev_slide_key);
            gchar * next_slide = gcm_gl_option_get_string(selfp->next_slide_key);
            GtkTooltips * tooltips;
            
            prev_slide_entryshortcut = gcm_entry_shortcut_new(prev_slide, FALSE);
            g_free(prev_slide);
            gtk_widget_show(prev_slide_entryshortcut);
            gtk_table_attach_defaults(selfp->shortcuts_table, 
                                                  prev_slide_entryshortcut, 1, 2, 0, 1);
            g_signal_connect_swapped(prev_slide_entryshortcut,
                                                 "edited",
                                                 G_CALLBACK(self_on_prev_slide_entryshortcut_changed),
                                                 self);
            
            next_slide_entryshortcut = gcm_entry_shortcut_new(next_slide, FALSE);
            g_free(next_slide);
            gtk_widget_show(next_slide_entryshortcut);
            gtk_table_attach_defaults(selfp->shortcuts_table, 
                                                  next_slide_entryshortcut, 3, 4, 0, 1);
            g_signal_connect_swapped(next_slide_entryshortcut,
                                                 "edited",
                                                 G_CALLBACK(self_on_next_slide_entryshortcut_changed),
                                                 self);
            tooltips = gtk_tooltips_new();
            gtk_tooltips_set_tip(tooltips, GTK_WIDGET(prev_slide_entryshortcut),
                                           gcm_gl_option_get_description(selfp->prev_slide_key),
                                           NULL);
            gtk_tooltips_set_tip(tooltips, GTK_WIDGET(next_slide_entryshortcut),
                                           gcm_gl_option_get_description(selfp->next_slide_key),
                                           NULL);
      }}
#line 894 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 467 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_on_prev_slide_entryshortcut_changed (GCPTopBottomDialog * self, GCMEntryShortcut * entry)
#line 900 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_prev_slide_entryshortcut_changed"
#line 467 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 467 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 907 "gcp-top-bottom-dialog.c"
{
#line 469 "gcp-top-bottom-dialog.gob"
      
            const gchar * value = gtk_entry_get_text(GTK_ENTRY(entry));
            
            gcm_gl_option_set_string(selfp->prev_slide_key, (gchar *)value);
      }}
#line 915 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

#line 475 "gcp-top-bottom-dialog.gob"
static void 
gcp_top_bottom_dialog_on_next_slide_entryshortcut_changed (GCPTopBottomDialog * self, GCMEntryShortcut * entry)
#line 921 "gcp-top-bottom-dialog.c"
{
#define __GOB_FUNCTION__ "GCP:Top:Bottom:Dialog::on_next_slide_entryshortcut_changed"
#line 475 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (self != NULL);
#line 475 "gcp-top-bottom-dialog.gob"
      g_return_if_fail (GCP_IS_TOP_BOTTOM_DIALOG (self));
#line 928 "gcp-top-bottom-dialog.c"
{
#line 477 "gcp-top-bottom-dialog.gob"
      
            const gchar * value = gtk_entry_get_text(GTK_ENTRY(entry));
            
            gcm_gl_option_set_string(selfp->next_slide_key, (gchar *)value);
      }}
#line 936 "gcp-top-bottom-dialog.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index