Commit 75ad5eaa authored by Sébastien Lafargue's avatar Sébastien Lafargue Committed by Paolo Borelli

Use of listbox widget for document panel

https://bugzilla.gnome.org/show_bug.cgi?id=723566
parent 85c6ccf8
......@@ -108,7 +108,6 @@ gedit_built_sources = \
gedit/gedit-marshal.h
gedit_NOINST_H_FILES = \
gedit/gedit-cell-renderer-button.h \
gedit/gedit-close-confirmation-dialog.h \
gedit/gedit-dirs.h \
gedit/gedit-document-input-stream.h \
......@@ -174,7 +173,6 @@ gedit_libgedit_private_la_SOURCES = \
gedit_libgedit_c_files = \
gedit/gedit-app.c \
gedit/gedit-cell-renderer-button.c \
gedit/gedit-close-confirmation-dialog.c \
gedit/gedit-commands-documents.c \
gedit/gedit-commands-edit.c \
......
/*
* gedit-cell-renderer-button.c
* This file is part of gedit
*
* Copyright (C) 2011 - Garrett Regier
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gedit-cell-renderer-button.h"
G_DEFINE_TYPE (GeditCellRendererButton, gedit_cell_renderer_button, GTK_TYPE_CELL_RENDERER_PIXBUF)
enum
{
CLICKED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void
gedit_cell_renderer_button_render (GtkCellRenderer *cell,
cairo_t *cr,
GtkWidget *widget,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
if ((flags & GTK_CELL_RENDERER_PRELIT) == 0)
{
return;
}
GTK_CELL_RENDERER_CLASS (gedit_cell_renderer_button_parent_class)->render (cell, cr, widget,
background_area,
cell_area,
flags);
}
static gboolean
gedit_cell_renderer_button_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
if (event != NULL && event->type == GDK_BUTTON_PRESS)
{
g_signal_emit (cell, signals[CLICKED], 0, path);
return TRUE;
}
return FALSE;
}
static void
gedit_cell_renderer_button_class_init (GeditCellRendererButtonClass *klass)
{
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
cell_class->render = gedit_cell_renderer_button_render;
cell_class->activate = gedit_cell_renderer_button_activate;
signals[CLICKED] = g_signal_new ("clicked",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditCellRendererButtonClass, clicked),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
}
static void
gedit_cell_renderer_button_init (GeditCellRendererButton *button)
{
g_object_set (button, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
}
GtkCellRenderer *
gedit_cell_renderer_button_new (void)
{
return g_object_new (GEDIT_TYPE_CELL_RENDERER_BUTTON, NULL);
}
/*
* gedit-cell-renderer-button.h
* This file is part of gedit
*
* Copyright (C) 2011 - Garrett Regier
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GEDIT_CELL_RENDERER_BUTTON_H__
#define __GEDIT_CELL_RENDERER_BUTTON_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GEDIT_TYPE_CELL_RENDERER_BUTTON (gedit_cell_renderer_button_get_type ())
#define GEDIT_CELL_RENDERER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_CELL_RENDERER_BUTTON, GeditCellRendererButton))
#define GEDIT_CELL_RENDERER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_CELL_RENDERER_BUTTON, GeditCellRendererButtonClass))
#define GEDIT_IS_CELL_RENDERER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_CELL_RENDERER_BUTTON))
#define GEDIT_IS_CELL_RENDERER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_CELL_RENDERER_BUTTON))
#define GEDIT_CELL_RENDERER_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_CELL_RENDERER_BUTTON, GeditCellRendererButtonClass))
typedef struct _GeditCellRendererButton GeditCellRendererButton;
typedef struct _GeditCellRendererButtonClass GeditCellRendererButtonClass;
struct _GeditCellRendererButton
{
GtkCellRendererPixbuf parent_instance;
};
struct _GeditCellRendererButtonClass
{
GtkCellRendererPixbufClass parent_class;
void (* clicked) (GeditCellRendererButton *cell,
const gchar *path);
};
GType gedit_cell_renderer_button_get_type (void) G_GNUC_CONST;
GtkCellRenderer *gedit_cell_renderer_button_new (void);
G_END_DECLS
#endif /* __GEDIT_CELL_RENDERER_BUTTON_H__ */
This diff is collapsed.
......@@ -84,7 +84,10 @@ gedit_notebook_grab_focus (GtkWidget *widget)
current_page = gtk_notebook_get_current_page (nb);
tab = gtk_notebook_get_nth_page (nb, current_page);
gtk_widget_grab_focus (tab);
if (tab)
{
gtk_widget_grab_focus (tab);
}
}
static gint
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment