[gedit] gedit-panel: add gedit_panel_get_current_item
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] gedit-panel: add gedit_panel_get_current_item
- Date: Sat, 16 Jul 2011 15:01:44 +0000 (UTC)
commit fd55423436c398c910ad5a216b063eae99587f7a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Jul 16 16:59:29 2011 +0200
gedit-panel: add gedit_panel_get_current_item
Needed to for plugins that activate a specific panel item depending
on the document.
gedit/gedit-panel.c | 25 +++++++++++++++++++++++++
gedit/gedit-panel.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-panel.c b/gedit/gedit-panel.c
index 1b5d915..5bee5ee 100644
--- a/gedit/gedit-panel.c
+++ b/gedit/gedit-panel.c
@@ -918,6 +918,31 @@ gedit_panel_activate_item (GeditPanel *panel,
}
/**
+ * gedit_panel_get_active:
+ * @panel: a #GeditPanel
+ *
+ * Gets the active item in @panel
+ *
+ * Returns: (transfer none): the active item in @panel
+ */
+GtkWidget *
+gedit_panel_get_active (GeditPanel *panel)
+{
+ gint current;
+
+ g_return_val_if_fail (GEDIT_IS_PANEL (panel), NULL);
+
+ current = gtk_notebook_get_current_page (GTK_NOTEBOOK (panel->priv->notebook));
+
+ if (current == -1)
+ {
+ return NULL;
+ }
+
+ return gtk_notebook_get_nth_page (GTK_NOTEBOOK (panel->priv->notebook), current);
+}
+
+/**
* gedit_panel_item_is_active:
* @panel: a #GeditPanel
* @item: a #GtkWidget
diff --git a/gedit/gedit-panel.h b/gedit/gedit-panel.h
index 3e3bb42..c8a5f41 100644
--- a/gedit/gedit-panel.h
+++ b/gedit/gedit-panel.h
@@ -111,6 +111,8 @@ gboolean gedit_panel_remove_item (GeditPanel *panel,
gboolean gedit_panel_activate_item (GeditPanel *panel,
GtkWidget *item);
+GtkWidget *gedit_panel_get_active (GeditPanel *panel);
+
gboolean gedit_panel_item_is_active (GeditPanel *panel,
GtkWidget *item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]