[gedit/multiviews: 12/12] Merge branch 'master' into multiviews
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/multiviews: 12/12] Merge branch 'master' into multiviews
- Date: Thu, 7 Jan 2010 19:03:21 +0000 (UTC)
commit 1096f41655cf1211f108083f4a760df211cd0e31
Merge: cc07b27 49bb378
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Jan 7 20:02:34 2010 +0100
Merge branch 'master' into multiviews
Conflicts:
gedit/Makefile.am
gedit/gedit-notebook.c
gedit/Makefile.am | 42 +-
gedit/gedit-close-button.c | 80 +++
gedit/gedit-close-button.h | 56 ++
gedit/gedit-notebook.c | 310 ++--------
gedit/gedit-panel.c | 103 +---
gedit/gedit-tab-label.c | 291 +++++++++
gedit/gedit-tab-label.h | 66 ++
plugins/filebrowser/gedit-file-browser-widget.c | 27 +-
plugins/spell/Makefile.am | 17 +-
plugins/spell/gedit-spell-checker-dialog.c | 98 +---
plugins/spell/gedit-spell-checker.c | 113 +---
...ialog-marshal.list => gedit-spell-marshal.list} | 0
plugins/spell/gedit-spell-plugin.c | 93 ++--
plugins/spell/gedit-spell-utils.c | 54 ++
plugins/spell/gedit-spell-utils.h | 2 +
plugins/spell/preload.c | 53 --
plugins/spell/preload.h | 53 --
po/uk.po | 634 ++++++++++----------
18 files changed, 1070 insertions(+), 1022 deletions(-)
---
diff --cc gedit/Makefile.am
index d30ad2d,e9eae45..0708a5b
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@@ -69,25 -79,15 +79,17 @@@ NOINST_H_FILES =
gedit-plugin-info-priv.h \
gedit-plugin-manager.h \
gedit-plugins-engine.h \
- gedit-object-module.h \
- gedit-ui.h \
- gedit-window-private.h \
- gedit-documents-panel.h \
- gedit-document-loader.h \
- gedit-gio-document-loader.h \
- gedit-document-saver.h \
- gedit-local-document-saver.h \
- gedit-gio-document-saver.h \
- gedit-history-entry.h \
+ gedit-prefs-manager-private.h \
gedit-print-job.h \
gedit-print-preview.h \
- gedit-io-error-message-area.h \
- gedit-prefs-manager-private.h \
- gedittextregion.h \
gedit-session.h \
- gedit-dirs.h \
+ gedit-web-view.h \
- gedit-data-binding.h
++ gedit-data-binding.h \
+ gedit-style-scheme-manager.h \
+ gedit-tab-label.h \
+ gedittextregion.h \
+ gedit-ui.h \
+ gedit-window-private.h
INST_H_FILES = \
gedit-app.h \
@@@ -169,6 -167,6 +172,7 @@@ libgedit_la_SOURCES =
gedit-message.c \
gedit-object-module.c \
gedit-notebook.c \
++ gedit-page.c \
gedit-panel.c \
gedit-plugin-info.c \
gedit-plugin.c \
@@@ -185,16 -183,12 +189,16 @@@
gedit-statusbar.c \
gedit-status-combo-box.c \
gedit-style-scheme-manager.c \
- gedit-view-container.c \
- gedit-tab.c \
+ gedit-tab-label.c \
gedit-utils.c \
- gedit-view.c \
+ gedit-view-interface.c \
+ gedit-text-view.c \
+ gedit-text-buffer.c \
++ gedit-view-container.c \
+ gedit-web-view.c \
- gedit-page.c \
gedit-window.c \
gedittextregion.c \
+ gedit-data-binding.c \
$(NOINST_H_FILES) \
$(INST_H_FILES)
diff --cc gedit/gedit-notebook.c
index ac89f54,b5c84a3..89f1842
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@@ -44,6 -44,8 +44,8 @@@
#include <gtk/gtk.h>
#include "gedit-notebook.h"
-#include "gedit-tab.h"
++#include "gedit-page.h"
+ #include "gedit-tab-label.h"
#include "gedit-marshal.h"
#include "gedit-window.h"
@@@ -154,20 -156,9 +156,9 @@@ gedit_notebook_class_init (GeditNoteboo
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- GEDIT_TYPE_TAB);
+ GEDIT_TYPE_PAGE);
- g_type_class_add_private (object_class, sizeof (GeditNotebookPrivate));
-
- /* Set up a style for the close button with no focus padding. */
- gtk_rc_parse_string (
- "style \"gedit-close-button-style\"\n"
- "{\n"
- " GtkWidget::focus-padding = 0\n"
- " GtkWidget::focus-line-width = 0\n"
- " xthickness = 0\n"
- " ythickness = 0\n"
- "}\n"
- "widget \"*.gedit-close-button\" style \"gedit-close-button-style\"");
+ g_type_class_add_private (object_class, sizeof(GeditNotebookPrivate));
}
static GeditNotebook *
@@@ -774,211 -763,56 +765,57 @@@ gedit_notebook_change_current_page (Gtk
}
static void
- sync_name (GeditPage *page,
- GeditViewContainer *container,
- GtkWidget *hbox)
-close_button_clicked_cb (GeditTabLabel *tab_label, GeditNotebook *notebook)
++close_button_clicked_cb (GeditTabLabel *tab_label,
++ GeditNotebook *notebook)
{
- GeditNotebook *nb;
- GtkWidget *label;
- GtkWidget *ebox;
- GtkWidget *button;
- GtkWidget *spinner;
- gchar *str;
- GtkImage *icon;
- GeditViewContainerState state;
-
- label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
- ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label-ebox"));
- icon = GTK_IMAGE (g_object_get_data (G_OBJECT (hbox), "icon"));
- button = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "close-button"));
- spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "spinner"));
-
- nb = GEDIT_NOTEBOOK (gtk_widget_get_parent (GTK_WIDGET (page)));
- container = gedit_page_get_active_view_container (page);
-
- g_return_if_fail ((label != NULL) &&
- (ebox != NULL) &&
- (button != NULL) &&
- (icon != NULL) &&
- (spinner != NULL) &&
- (nb != NULL) &&
- (page != NULL));
-
- str = _gedit_view_container_get_name (container);
- g_return_if_fail (str != NULL);
-
- gtk_label_set_text (GTK_LABEL (label), str);
- g_free (str);
-
- str = _gedit_view_container_get_tooltips (container);
- g_return_if_fail (str != NULL);
-
- gtk_widget_set_tooltip_markup (ebox, str);
- g_free (str);
-
- state = gedit_view_container_get_state (container);
-
- gtk_widget_set_sensitive (button,
- nb->priv->close_buttons_sensitive &&
- (state != GEDIT_VIEW_CONTAINER_STATE_CLOSING) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_SAVING) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_SHOWING_PRINT_PREVIEW) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_SAVING_ERROR));
-
- if ((state == GEDIT_VIEW_CONTAINER_STATE_LOADING) ||
- (state == GEDIT_VIEW_CONTAINER_STATE_SAVING) ||
- (state == GEDIT_VIEW_CONTAINER_STATE_REVERTING))
- {
- gtk_widget_hide (GTK_WIDGET (icon));
-
- gtk_widget_show (spinner);
- #ifdef BUILD_SPINNER
- gedit_spinner_start (GEDIT_SPINNER (spinner));
- #else
- gtk_spinner_start (GTK_SPINNER (spinner));
- #endif
- }
- else
- {
- GdkPixbuf *pixbuf;
-
- pixbuf = _gedit_view_container_get_icon (container);
- gtk_image_set_from_pixbuf (icon, pixbuf);
-
- if (pixbuf != NULL)
- g_object_unref (pixbuf);
- GeditTab *tab;
++ GeditPage *page;
- gtk_widget_show (GTK_WIDGET (icon));
-
- gtk_widget_hide (spinner);
- #ifdef BUILD_SPINNER
- gedit_spinner_stop (GEDIT_SPINNER (spinner));
- #else
- gtk_spinner_stop (GTK_SPINNER (spinner));
- #endif
- }
- tab = gedit_tab_label_get_tab (tab_label);
- g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
++ page = gedit_tab_label_get_page (tab_label);
++ g_signal_emit (notebook, signals[PAGE_CLOSE_REQUEST], 0, page);
}
- static void
- on_notify_name_cb (GeditViewContainer *container,
- GParamSpec *pspec,
- GtkWidget *hbox)
+ static GtkWidget *
+ create_tab_label (GeditNotebook *nb,
- GeditTab *tab)
++ GeditPage *page)
{
- GeditPage *page;
-
- page = gedit_page_get_from_container (container);
+ GtkWidget *tab_label;
- sync_name (page, container, hbox);
- }
- tab_label = gedit_tab_label_new (tab);
++ tab_label = gedit_tab_label_new (page);
- static void
- close_button_clicked_cb (GtkWidget *widget,
- GtkWidget *page)
- {
- GeditNotebook *notebook;
+ g_signal_connect (tab_label,
+ "close-clicked",
+ G_CALLBACK (close_button_clicked_cb),
+ nb);
- notebook = GEDIT_NOTEBOOK (gtk_widget_get_parent (page));
- g_signal_emit (notebook, signals[PAGE_CLOSE_REQUEST], 0, page);
- g_object_set_data (G_OBJECT (tab), "tab-label", tab_label);
++ g_object_set_data (G_OBJECT (page), "tab-label", tab_label);
+
+ return tab_label;
}
static void
- close_button_style_set_cb (GtkWidget *button,
- GtkStyle *previous_style,
- gpointer user_data)
+ remove_tab_label (GeditNotebook *nb,
- GeditTab *tab)
++ GeditPage *page)
{
- gint h, w;
+ GtkWidget *tab_label;
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
- GTK_ICON_SIZE_MENU, &w, &h);
- tab_label = gedit_tab_label_new (tab);
++ tab_label = gedit_tab_label_new (page);
- gtk_widget_set_size_request (button, w + 2, h + 2);
+ g_signal_handlers_disconnect_by_func (tab_label,
+ G_CALLBACK (close_button_clicked_cb),
+ nb);
+
- g_object_set_data (G_OBJECT (tab), "tab-label", NULL);
++ g_object_set_data (G_OBJECT (page), "tab-label", NULL);
}
static GtkWidget *
- build_tab_label (GeditNotebook *nb,
- GeditPage *page)
-get_tab_label (GeditTab *tab)
++get_tab_label (GeditPage *page)
{
- GtkWidget *hbox, *label_hbox, *label_ebox;
- GtkWidget *label, *dummy_label;
- GtkWidget *close_button;
- GtkWidget *image;
- GtkWidget *spinner;
- GtkWidget *icon;
-
- hbox = gtk_hbox_new (FALSE, 4);
-
- label_ebox = gtk_event_box_new ();
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
-
- label_hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
-
- /* setup close button */
- close_button = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (close_button),
- GTK_RELIEF_NONE);
- /* don't allow focus on the close button */
- gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
-
- /* make it as small as possible */
- gtk_widget_set_name (close_button, "gedit-close-button");
+ GtkWidget *tab_label;
- image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
- GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (close_button), image);
- gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
- tab_label = GTK_WIDGET (g_object_get_data (G_OBJECT (tab), "tab-label"));
++ tab_label = GTK_WIDGET (g_object_get_data (G_OBJECT (page), "tab-label"));
+ g_return_val_if_fail (tab_label != NULL, NULL);
- gtk_widget_set_tooltip_text (close_button, _("Close document"));
-
- g_signal_connect (close_button,
- "clicked",
- G_CALLBACK (close_button_clicked_cb),
- page);
-
- /* setup spinner */
- #ifdef BUILD_SPINNER
- spinner = gedit_spinner_new ();
- gedit_spinner_set_size (GEDIT_SPINNER (spinner), GTK_ICON_SIZE_MENU);
- #else
- spinner = gtk_spinner_new ();
- #endif
- gtk_box_pack_start (GTK_BOX (label_hbox), spinner, FALSE, FALSE, 0);
-
- /* setup site icon, empty by default */
- icon = gtk_image_new ();
- gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0);
-
- /* setup label */
- label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
-
- dummy_label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
-
- /* Set minimal size */
- g_signal_connect (close_button, "style-set",
- G_CALLBACK (close_button_style_set_cb), NULL);
-
- gtk_widget_show (hbox);
- gtk_widget_show (label_ebox);
- gtk_widget_show (label_hbox);
- gtk_widget_show (label);
- gtk_widget_show (dummy_label);
- gtk_widget_show (image);
- gtk_widget_show (close_button);
- gtk_widget_show (icon);
-
- g_object_set_data (G_OBJECT (hbox), "label", label);
- g_object_set_data (G_OBJECT (hbox), "label-ebox", label_ebox);
- g_object_set_data (G_OBJECT (hbox), "spinner", spinner);
- g_object_set_data (G_OBJECT (hbox), "icon", icon);
- g_object_set_data (G_OBJECT (hbox), "close-button", close_button);
- g_object_set_data (G_OBJECT (page), "close-button", close_button);
-
- return hbox;
+ return tab_label;
}
/**
@@@ -1000,59 -834,33 +837,33 @@@ gedit_notebook_set_always_show_tabs (Ge
}
/**
- * gedit_notebook_add_tab:
+ * gedit_notebook_add_page:
* @nb: a #GeditNotebook
- * @tab: a #GeditTab
- * @position: the position where the @tab should be added
- * @jump_to: %TRUE to set the @tab as active
+ * @page: a #GeditPage
+ * @position: the position where the @page should be added
+ * @jump_to: %TRUE to set the @page as active
*
- * Adds the specified @tab to the @nb.
+ * Adds the specified @page to the @nb.
*/
void
-gedit_notebook_add_tab (GeditNotebook *nb,
- GeditTab *tab,
- gint position,
- gboolean jump_to)
+gedit_notebook_add_page (GeditNotebook *nb,
+ GeditPage *page,
+ gint position,
+ gboolean jump_to)
{
- GtkWidget *label;
- GList *containers, *l;
+ GtkWidget *tab_label;
g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
- g_return_if_fail (GEDIT_IS_TAB (tab));
+ g_return_if_fail (GEDIT_IS_PAGE (page));
- label = build_tab_label (nb, page);
-
- update_tabs_visibility (nb, TRUE);
-
- tab_label = create_tab_label (nb, tab);
++ tab_label = create_tab_label (nb, page);
gtk_notebook_insert_page (GTK_NOTEBOOK (nb),
- GTK_WIDGET (tab),
+ GTK_WIDGET (page),
- label,
+ tab_label,
position);
-
- sync_name (page, NULL, label);
-
- containers = gedit_page_get_view_containers (page);
- for (l = containers; l != NULL; l = g_list_next (l))
- {
- g_signal_connect_object (l->data,
- "notify::name",
- G_CALLBACK (on_notify_name_cb),
- label,
- 0);
- g_signal_connect_object (l->data,
- "notify::state",
- G_CALLBACK (on_notify_name_cb),
- label,
- 0);
- }
-
- g_signal_connect_object (page,
- "active-container-changed",
- G_CALLBACK (sync_name),
- label,
- 0);
+ update_tabs_visibility (nb, TRUE);
- g_signal_emit (G_OBJECT (nb), signals[TAB_ADDED], 0, tab);
+ g_signal_emit (G_OBJECT (nb), signals[PAGE_ADDED], 0, page);
/* The signal handler may have reordered the tabs */
position = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
@@@ -1104,33 -910,25 +915,25 @@@ smart_page_switching_on_closure (GeditN
}
static void
-remove_tab (GeditTab *tab,
- GeditNotebook *nb)
+remove_page (GeditPage *page,
+ GeditNotebook *nb)
{
- GtkWidget *label, *ebox;
gint position;
- position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
+ position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (page));
- label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (nb), GTK_WIDGET (page));
- ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (label), "label-ebox"));
-
- g_signal_handlers_disconnect_by_func (page,
- G_CALLBACK (sync_name),
- label);
-
- /* we ref the tab so that it's still alive while the tabs_removed
+ /* we ref the page so that it's still alive while the page_removed
* signal is processed.
*/
- g_object_ref (tab);
+ g_object_ref (page);
- remove_tab_label (nb, tab);
++ remove_tab_label (nb, page);
gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position);
-
update_tabs_visibility (nb, FALSE);
- g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab);
+ g_signal_emit (G_OBJECT (nb), signals[PAGE_REMOVED], 0, page);
- g_object_unref (tab);
+ g_object_unref (page);
}
/**
@@@ -1184,28 -982,15 +987,15 @@@ gedit_notebook_remove_all_pages (GeditN
}
static void
-set_close_buttons_sensitivity (GeditTab *tab,
+set_close_buttons_sensitivity (GeditPage *page,
GeditNotebook *nb)
{
- GtkWidget *button;
- GeditViewContainerState state;
- GeditViewContainer *container;
-
- button = GTK_WIDGET (g_object_get_data (G_OBJECT (page),
- "close-button"));
- g_return_if_fail (button != NULL);
-
- container = gedit_page_get_active_view_container (page);
- state = gedit_view_container_get_state (container);
-
- gtk_widget_set_sensitive (button,
- nb->priv->close_buttons_sensitive &&
- (state != GEDIT_VIEW_CONTAINER_STATE_CLOSING) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_SAVING) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_SHOWING_PRINT_PREVIEW) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_PRINTING) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_PRINT_PREVIEWING) &&
- (state != GEDIT_VIEW_CONTAINER_STATE_SAVING_ERROR));
+ GtkWidget *tab_label;
+
- tab_label = get_tab_label (tab);
++ tab_label = get_tab_label (page);
+
+ gedit_tab_label_set_close_button_sensitive (GEDIT_TAB_LABEL (tab_label),
+ nb->priv->close_buttons_sensitive);
}
/**
diff --cc gedit/gedit-tab-label.c
index 0000000,0fc48c3..9e9273f
mode 000000,100644..100644
--- a/gedit/gedit-tab-label.c
+++ b/gedit/gedit-tab-label.c
@@@ -1,0 -1,283 +1,291 @@@
+ /*
+ * gedit-tab-label.c
+ * This file is part of gedit
+ *
+ * Copyright (C) 2010 - Paolo Borelli
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+ #include <glib/gi18n.h>
+ #include <gtk/gtk.h>
+ #include "gedit-tab-label.h"
+ #include "gedit-close-button.h"
++#include "gedit-view-container.h"
+
+ #define GEDIT_TAB_LABEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_TAB_LABEL, GeditTabLabelPrivate))
+
+ struct _GeditTabLabelPrivate
+ {
- GeditTab *tab;
++ GeditPage *page;
+
+ GtkWidget *ebox;
+ GtkWidget *close_button;
+ GtkWidget *spinner;
+ GtkWidget *icon;
+ GtkWidget *label;
+
+ gboolean close_button_sensitive;
+ };
+
+ /* Signals */
+ enum
+ {
+ CLOSE_CLICKED,
+ LAST_SIGNAL
+ };
+
+ static guint signals[LAST_SIGNAL] = { 0 };
+
+ G_DEFINE_TYPE (GeditTabLabel, gedit_tab_label, GTK_TYPE_HBOX)
+
+ static void
+ gedit_tab_label_finalize (GObject *object)
+ {
+ G_OBJECT_CLASS (gedit_tab_label_parent_class)->finalize (object);
+ }
+
+ static void
+ gedit_tab_label_class_init (GeditTabLabelClass *klass)
+ {
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gedit_tab_label_finalize;
+
+ signals[CLOSE_CLICKED] =
+ g_signal_new ("close-clicked",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GeditTabLabelClass, close_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_type_class_add_private (object_class, sizeof(GeditTabLabelPrivate));
+ }
+
+ static void
+ close_button_clicked_cb (GtkWidget *widget,
+ GeditTabLabel *tab_label)
+ {
+ g_signal_emit (tab_label, signals[CLOSE_CLICKED], 0, NULL);
+ }
+
+ static void
-sync_name (GeditTab *tab, GParamSpec *pspec, GeditTabLabel *tab_label)
++sync_name (GeditPage *page, GParamSpec *pspec, GeditTabLabel *tab_label)
+ {
++ GeditViewContainer *container;
+ gchar *str;
+
- g_return_if_fail (tab == tab_label->priv->tab);
++ g_return_if_fail (page == tab_label->priv->page);
+
- str = _gedit_tab_get_name (tab);
++ container = gedit_page_get_active_view_container (page);
++
++ str = _gedit_view_container_get_name (container);
+ g_return_if_fail (str != NULL);
+
+ gtk_label_set_text (GTK_LABEL (tab_label->priv->label), str);
+ g_free (str);
+
- str = _gedit_tab_get_tooltips (tab);
++ str = _gedit_view_container_get_tooltips (container);
+ g_return_if_fail (str != NULL);
+
+ gtk_widget_set_tooltip_markup (tab_label->priv->ebox, str);
+ g_free (str);
+ }
+
+ static void
-sync_state (GeditTab *tab, GParamSpec *pspec, GeditTabLabel *tab_label)
++sync_state (GeditPage *page, GParamSpec *pspec, GeditTabLabel *tab_label)
+ {
- GeditTabState state;
++ GeditViewContainer *container;
++ GeditViewContainerState state;
+
- g_return_if_fail (tab == tab_label->priv->tab);
++ g_return_if_fail (page == tab_label->priv->page);
+
- state = gedit_tab_get_state (tab);
++ container = gedit_page_get_active_view_container (page);
++ state = gedit_view_container_get_state (container);
+
+ gtk_widget_set_sensitive (tab_label->priv->close_button,
+ tab_label->priv->close_button_sensitive &&
- (state != GEDIT_TAB_STATE_CLOSING) &&
- (state != GEDIT_TAB_STATE_SAVING) &&
- (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
- (state != GEDIT_TAB_STATE_SAVING_ERROR));
-
- if ((state == GEDIT_TAB_STATE_LOADING) ||
- (state == GEDIT_TAB_STATE_SAVING) ||
- (state == GEDIT_TAB_STATE_REVERTING))
++ (state != GEDIT_VIEW_CONTAINER_STATE_CLOSING) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_SAVING) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_SHOWING_PRINT_PREVIEW) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_SAVING_ERROR));
++
++ if ((state == GEDIT_VIEW_CONTAINER_STATE_LOADING) ||
++ (state == GEDIT_VIEW_CONTAINER_STATE_SAVING) ||
++ (state == GEDIT_VIEW_CONTAINER_STATE_REVERTING))
+ {
+ gtk_widget_hide (tab_label->priv->icon);
+
+ gtk_widget_show (tab_label->priv->spinner);
+ #ifdef BUILD_SPINNER
+ gedit_spinner_start (GEDIT_SPINNER (tab_label->priv->spinner));
+ #else
+ gtk_spinner_start (GTK_SPINNER (tab_label->priv->spinner));
+ #endif
+ }
+ else
+ {
+ GdkPixbuf *pixbuf;
+
- pixbuf = _gedit_tab_get_icon (tab);
++ pixbuf = _gedit_view_container_get_icon (container);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (tab_label->priv->icon), pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
+
+ gtk_widget_show (tab_label->priv->icon);
+
+ gtk_widget_hide (tab_label->priv->spinner);
+ #ifdef BUILD_SPINNER
+ gedit_spinner_stop (GEDIT_SPINNER (tab_label->priv->spinner));
+ #else
+ gtk_spinner_stop (GTK_SPINNER (tab_label->priv->spinner));
+ #endif
+ }
+ }
+
+ static void
+ gedit_tab_label_init (GeditTabLabel *tab_label)
+ {
+ GtkWidget *ebox;
+ GtkWidget *hbox;
+ GtkWidget *close_button;
+ GtkWidget *spinner;
+ GtkWidget *icon;
+ GtkWidget *label;
+ GtkWidget *dummy_label;
+
+ tab_label->priv = GEDIT_TAB_LABEL_GET_PRIVATE (tab_label);
+
+ tab_label->priv->close_button_sensitive = TRUE;
+
+ ebox = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
+ gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0);
+ tab_label->priv->ebox = ebox;
+
+ hbox = gtk_hbox_new (FALSE, 4);
+ gtk_container_add (GTK_CONTAINER (ebox), hbox);
+
+ close_button = gedit_close_button_new ();
+ gtk_widget_set_tooltip_text (close_button, _("Close document"));
+ gtk_box_pack_start (GTK_BOX (tab_label), close_button, FALSE, FALSE, 0);
+ tab_label->priv->close_button = close_button;
+
+ g_signal_connect (close_button,
+ "clicked",
+ G_CALLBACK (close_button_clicked_cb),
+ tab_label);
+
+ #ifdef BUILD_SPINNER
+ spinner = gedit_spinner_new ();
+ gedit_spinner_set_size (GEDIT_SPINNER (spinner), GTK_ICON_SIZE_MENU);
+ #else
+ spinner = gtk_spinner_new ();
+ #endif
+ gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
+ tab_label->priv->spinner = spinner;
+
+ /* setup icon, empty by default */
+ icon = gtk_image_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
+ tab_label->priv->icon = icon;
+
+ label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_misc_set_padding (GTK_MISC (label), 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ tab_label->priv->label = label;
+
+ dummy_label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (hbox), dummy_label, TRUE, TRUE, 0);
+
+ gtk_widget_show (ebox);
+ gtk_widget_show (hbox);
+ gtk_widget_show (close_button);
+ gtk_widget_show (icon);
+ gtk_widget_show (label);
+ gtk_widget_show (dummy_label);
+ }
+
+ void
+ gedit_tab_label_set_close_button_sensitive (GeditTabLabel *tab_label,
+ gboolean sensitive)
+ {
- GeditTabState state;
++ GeditViewContainer *container;
++ GeditViewContainerState state;
+
+ g_return_if_fail (GEDIT_IS_TAB_LABEL (tab_label));
+
+ sensitive = (sensitive != FALSE);
+
+ if (sensitive == tab_label->priv->close_button_sensitive)
+ return;
+
+ tab_label->priv->close_button_sensitive = sensitive;
+
- state = gedit_tab_get_state (tab_label->priv->tab);
++ container = gedit_page_get_active_view_container (tab_label->priv->page);
++ state = gedit_view_container_get_state (container);
+
+ gtk_widget_set_sensitive (tab_label->priv->close_button,
+ tab_label->priv->close_button_sensitive &&
- (state != GEDIT_TAB_STATE_CLOSING) &&
- (state != GEDIT_TAB_STATE_SAVING) &&
- (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
- (state != GEDIT_TAB_STATE_PRINTING) &&
- (state != GEDIT_TAB_STATE_PRINT_PREVIEWING) &&
- (state != GEDIT_TAB_STATE_SAVING_ERROR));
++ (state != GEDIT_VIEW_CONTAINER_STATE_CLOSING) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_SAVING) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_SHOWING_PRINT_PREVIEW) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_PRINTING) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_PRINT_PREVIEWING) &&
++ (state != GEDIT_VIEW_CONTAINER_STATE_SAVING_ERROR));
+ }
+
-GeditTab *
-gedit_tab_label_get_tab (GeditTabLabel *tab_label)
++GeditPage *
++gedit_tab_label_get_page (GeditTabLabel *tab_label)
+ {
+ g_return_val_if_fail (GEDIT_IS_TAB_LABEL (tab_label), NULL);
+
- return tab_label->priv->tab;
++ return tab_label->priv->page;
+ }
+
+ GtkWidget *
-gedit_tab_label_new (GeditTab *tab)
++gedit_tab_label_new (GeditPage *page)
+ {
+ GeditTabLabel *tab_label;
+
+ tab_label = g_object_new (GEDIT_TYPE_TAB_LABEL,
+ "homogeneous", FALSE,
+ NULL);
+
+ /* FIXME: should turn tab in a property */
- tab_label->priv->tab = tab;
++ tab_label->priv->page = page;
+
- sync_name (tab, NULL, tab_label);
- sync_state (tab, NULL, tab_label);
++ sync_name (page, NULL, tab_label);
++ sync_state (page, NULL, tab_label);
+
- g_signal_connect_object (tab,
++ g_signal_connect_object (page,
+ "notify::name",
+ G_CALLBACK (sync_name),
+ tab_label,
+ 0);
- g_signal_connect_object (tab,
++ g_signal_connect_object (page,
+ "notify::state",
+ G_CALLBACK (sync_state),
+ tab_label,
+ 0);
+
+ return GTK_WIDGET (tab_label);
+ }
diff --cc gedit/gedit-tab-label.h
index 0000000,4b0360a..7b4982e
mode 000000,100644..100644
--- a/gedit/gedit-tab-label.h
+++ b/gedit/gedit-tab-label.h
@@@ -1,0 -1,66 +1,66 @@@
+ /*
+ * gedit-tab-label.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2010 - Paolo Borelli
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+ #ifndef __GEDIT_TAB_LABEL_H__
+ #define __GEDIT_TAB_LABEL_H__
+
+ #include <gtk/gtk.h>
-#include <gedit/gedit-tab.h>
++#include <gedit/gedit-page.h>
+
+ G_BEGIN_DECLS
+
+ #define GEDIT_TYPE_TAB_LABEL (gedit_tab_label_get_type ())
+ #define GEDIT_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_TAB_LABEL, GeditTabLabel))
+ #define GEDIT_TAB_LABEL_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_TAB_LABEL, GeditTabLabel const))
+ #define GEDIT_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_TAB_LABEL, GeditTabLabelClass))
+ #define GEDIT_IS_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_TAB_LABEL))
+ #define GEDIT_IS_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_TAB_LABEL))
+ #define GEDIT_TAB_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_TAB_LABEL, GeditTabLabelClass))
+
+ typedef struct _GeditTabLabel GeditTabLabel;
+ typedef struct _GeditTabLabelClass GeditTabLabelClass;
+ typedef struct _GeditTabLabelPrivate GeditTabLabelPrivate;
+
+ struct _GeditTabLabel {
+ GtkHBox parent;
+
+ GeditTabLabelPrivate *priv;
+ };
+
+ struct _GeditTabLabelClass {
+ GtkHBoxClass parent_class;
+
+ void (* close_clicked) (GeditTabLabel *tab_label);
+ };
+
+ GType gedit_tab_label_get_type (void) G_GNUC_CONST;
+
-GtkWidget *gedit_tab_label_new (GeditTab *tab);
++GtkWidget *gedit_tab_label_new (GeditPage *page);
+
-GeditTab *gedit_tab_label_get_tab (GeditTabLabel *tab_label);
++GeditPage *gedit_tab_label_get_page (GeditTabLabel *tab_label);
+
+ void gedit_tab_label_set_close_button_sensitive (GeditTabLabel *tab_label,
+ gboolean sensitive);
+
+ G_END_DECLS
+
+ #endif /* __GEDIT_TAB_LABEL_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]