Commit 1ef0cfe3 authored by Steve Frécinaux's avatar Steve Frécinaux Committed by Steve Frécinaux

Update property definitions to use the new enum GTypes.

2006-06-13  Steve Frécinaux  <steve@istique.net>

        * gedit/gedit-tab.c:
        * gedit/gedit-window.c:

        Update property definitions to use the new enum GTypes.

        * bindings/python/gedit.defs:
        * bindings/python/gedit.override:

        Update enum types to actually use the new GTypes. Add bindings for
        several new methods (GeditDocument.get_enable_search_highlighting,
        GeditDocument.get_enable_search_highlighting, GeditWindow.close_tabs,
        GeditWindow.get_tab_from_uri and GeditApp.get_lockdown)
parent e986abb6
2006-06-13 Steve Frécinaux <steve@istique.net>
* gedit/gedit-tab.c:
* gedit/gedit-window.c:
Update property definitions to use the new enum GTypes.
* bindings/python/gedit.defs:
* bindings/python/gedit.override:
Update enum types to actually use the new GTypes. Add bindings for
several new methods (GeditDocument.get_enable_search_highlighting,
GeditDocument.get_enable_search_highlighting, GeditWindow.close_tabs,
GeditWindow.get_tab_from_uri and GeditApp.get_lockdown)
=== gedit 2.15.3 === === gedit 2.15.3 ===
2006-06-12 Steve Frécinaux <steve@istique.net> 2006-06-12 Steve Frécinaux <steve@istique.net>
......
...@@ -51,9 +51,23 @@ ...@@ -51,9 +51,23 @@
;; Enumerations and flags ... ;; Enumerations and flags ...
(define-flags LockdownMask
(in-module "Gedit")
(c-name "GeditLockdownMask")
(gtype-id "GEDIT_TYPE_LOCKDOWN_MASK")
(values
'("command-line" "GEDIT_LOCKDOWN_COMMAND_LINE")
'("printing" "GEDIT_LOCKDOWN_PRINTING")
'("print-setup" "GEDIT_LOCKDOWN_PRINT_SETUP")
'("save-to-disk" "GEDIT_LOCKDOWN_SAVE_TO_DISK")
'("all" "GEDIT_LOCKDOWN_ALL")
)
)
(define-flags SearchFlags (define-flags SearchFlags
(in-module "Gedit") (in-module "Gedit")
(c-name "GeditSearchFlags") (c-name "GeditSearchFlags")
(gtype-id "GEDIT_TYPE_SEARCH_FLAGS")
(values (values
'("dont-set-flags" "GEDIT_SEARCH_DONT_SET_FLAGS") '("dont-set-flags" "GEDIT_SEARCH_DONT_SET_FLAGS")
'("entire-word" "GEDIT_SEARCH_ENTIRE_WORD") '("entire-word" "GEDIT_SEARCH_ENTIRE_WORD")
...@@ -61,37 +75,49 @@ ...@@ -61,37 +75,49 @@
) )
) )
(define-flags DocumentSaveFlags
(in-module "Gedit")
(c-name "GeditDocumentSaveFlags")
(gtype-id "GEDIT_TYPE_DOCUMENT_SAVE_FLAGS")
(values
'("ignore-mtime" "GEDIT_DOCUMENT_SAVE_IGNORE_MTIME")
'("ignore-backup" "GEDIT_DOCUMENT_SAVE_IGNORE_BACKUP")
'("preserve-backup" "GEDIT_DOCUMENT_SAVE_PRESERVE_BACKUP")
)
)
(define-enum TabState (define-enum TabState
(in-module "Gedit") (in-module "Gedit")
(c-name "GeditTabState") (c-name "GeditTabState")
(gtype-id "GEDIT_TYPE_TAB_STATE")
(values (values
'("state-normal" "GEDIT_TAB_STATE_NORMAL") '("normal" "GEDIT_TAB_STATE_NORMAL")
'("state-loading" "GEDIT_TAB_STATE_LOADING") '("loading" "GEDIT_TAB_STATE_LOADING")
'("state-reverting" "GEDIT_TAB_STATE_REVERTING") '("reverting" "GEDIT_TAB_STATE_REVERTING")
'("state-saving" "GEDIT_TAB_STATE_SAVING") '("saving" "GEDIT_TAB_STATE_SAVING")
'("state-printing" "GEDIT_TAB_STATE_PRINTING") '("printing" "GEDIT_TAB_STATE_PRINTING")
'("state-print-previewing" "GEDIT_TAB_STATE_PRINT_PREVIEWING") '("print-previewing" "GEDIT_TAB_STATE_PRINT_PREVIEWING")
'("state-showing-print-preview" "GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW") '("showing-print-preview" "GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW")
'("state-generic-not-editable" "GEDIT_TAB_STATE_GENERIC_NOT_EDITABLE") '("generic-not-editable" "GEDIT_TAB_STATE_GENERIC_NOT_EDITABLE")
'("state-loading-error" "GEDIT_TAB_STATE_LOADING_ERROR") '("loading-error" "GEDIT_TAB_STATE_LOADING_ERROR")
'("state-reverting-error" "GEDIT_TAB_STATE_REVERTING_ERROR") '("reverting-error" "GEDIT_TAB_STATE_REVERTING_ERROR")
'("state-saving-error" "GEDIT_TAB_STATE_SAVING_ERROR") '("saving-error" "GEDIT_TAB_STATE_SAVING_ERROR")
'("state-generic-error" "GEDIT_TAB_STATE_GENERIC_ERROR") '("generic-error" "GEDIT_TAB_STATE_GENERIC_ERROR")
'("state-closing" "GEDIT_TAB_STATE_CLOSING") '("closing" "GEDIT_TAB_STATE_CLOSING")
'("num-of-states" "GEDIT_TAB_NUM_OF_STATES")
) )
) )
(define-flags WindowState (define-flags WindowState
(in-module "Gedit") (in-module "Gedit")
(c-name "GeditWindowState") (c-name "GeditWindowState")
(gtype-id "GEDIT_TYPE_WINDOW_STATE")
(values (values
'("state-normal" "GEDIT_WINDOW_STATE_NORMAL") '("normal" "GEDIT_WINDOW_STATE_NORMAL")
'("state-saving" "GEDIT_WINDOW_STATE_SAVING") '("saving" "GEDIT_WINDOW_STATE_SAVING")
'("state-printing" "GEDIT_WINDOW_STATE_PRINTING") '("printing" "GEDIT_WINDOW_STATE_PRINTING")
'("state-loading" "GEDIT_WINDOW_STATE_LOADING") '("loading" "GEDIT_WINDOW_STATE_LOADING")
'("state-error" "GEDIT_WINDOW_STATE_ERROR") '("error" "GEDIT_WINDOW_STATE_ERROR")
'("state-saving-session" "GEDIT_WINDOW_STATE_SAVING_SESSION") '("saving-session" "GEDIT_WINDOW_STATE_SAVING_SESSION")
) )
) )
...@@ -161,6 +187,11 @@ ...@@ -161,6 +187,11 @@
(return-type "GList*") (return-type "GList*")
) )
(define-method get_lockdown
(of-object "GeditApp")
(c-name "gedit_app_get_lockdown")
(return-type "GeditLockdownMask")
)
;; From ../../gedit/gedit-document.h ;; From ../../gedit/gedit-document.h
...@@ -368,6 +399,21 @@ ...@@ -368,6 +399,21 @@
(return-type "const-GeditEncoding*") (return-type "const-GeditEncoding*")
) )
(define-method set_enable_search_highlighting
(of-object "GeditDocument")
(c-name "gedit_document_set_enable_search_highlighting")
(return-type "none")
(parameters
'("gboolean" "enable")
)
)
(define-method get_enable_search_highlighting
(of-object "GeditDocument")
(c-name "gedit_document_get_enable_search_highlighting")
(return-type "gboolean")
)
;; From ../../gedit/gedit-encodings.h ;; From ../../gedit/gedit-encodings.h
(define-function gedit_encoding_get_type (define-function gedit_encoding_get_type
...@@ -785,6 +831,15 @@ ...@@ -785,6 +831,15 @@
) )
) )
(define-method close_tabs
(of-object "GeditWindow")
(c-name "gedit_window_close_tabs")
(return-type "none")
(parameters
'("const-GList*" "tabs")
)
)
(define-method close_all_tabs (define-method close_all_tabs
(of-object "GeditWindow") (of-object "GeditWindow")
(c-name "gedit_window_close_all_tabs") (c-name "gedit_window_close_all_tabs")
...@@ -872,4 +927,12 @@ ...@@ -872,4 +927,12 @@
(return-type "GeditWindowState") (return-type "GeditWindowState")
) )
(define-method get_tab_from_uri
(of-object "GeditWindow")
(c-name "gedit_window_get_tab_from_uri")
(return-type "GeditTab*")
(parameters
'("const-gchar*" "uri")
)
)
...@@ -7,6 +7,7 @@ headers ...@@ -7,6 +7,7 @@ headers
#include "gedit-plugin.h" #include "gedit-plugin.h"
#include "gedit-app.h" #include "gedit-app.h"
#include "gedit-encodings.h" #include "gedit-encodings.h"
#include "gedit-enum-types.h"
void pygedit_register_classes (PyObject *d); void pygedit_register_classes (PyObject *d);
void pygedit_add_constants (PyObject *module, const gchar *strip_prefix); void pygedit_add_constants (PyObject *module, const gchar *strip_prefix);
...@@ -164,6 +165,54 @@ _wrap_gedit_window_get_views(PyGObject *self) ...@@ -164,6 +165,54 @@ _wrap_gedit_window_get_views(PyGObject *self)
return py_list; return py_list;
} }
%% %%
override gedit_window_close_tabs kwargs
static PyObject *
_wrap_gedit_window_close_tabs (PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
static char *kwlist[] = { "tabs", NULL };
PyObject *list, *item;
GList *glist = NULL;
int len, i;
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
"O:GeditWindow.close_tabs", kwlist,
&list))
return NULL;
if (!PySequence_Check (list))
{
PyErr_SetString (PyExc_TypeError,
"first argument must be a sequence");
return NULL;
}
len = PySequence_Length (list);
for (i = 0; i < len; i++)
{
item = PySequence_GetItem (list, i);
Py_DECREF(item);
if (!pygobject_check (item, &PyGeditTab_Type))
{
PyErr_SetString (PyExc_TypeError,
"sequence item not a Gtkwidget object");
g_list_free (glist);
return NULL;
}
glist = g_list_append (glist, pygobject_get (item));
}
gedit_window_close_tabs (GEDIT_WINDOW (self->obj), glist);
g_list_free (glist);
Py_INCREF (Py_None);
return Py_None;
}
%%
override gedit_document_get_search_text override gedit_document_get_search_text
static PyObject * static PyObject *
_wrap_gedit_document_get_search_text(PyGObject *self) _wrap_gedit_document_get_search_text(PyGObject *self)
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "gedit-prefs-manager-app.h" #include "gedit-prefs-manager-app.h"
#include "gedit-recent.h" #include "gedit-recent.h"
#include "gedit-convert.h" #include "gedit-convert.h"
#include "gedit-enum-types.h"
#define GEDIT_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_TAB, GeditTabPrivate)) #define GEDIT_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_TAB, GeditTabPrivate))
...@@ -182,8 +183,8 @@ gedit_tab_get_property (GObject *object, ...@@ -182,8 +183,8 @@ gedit_tab_get_property (GObject *object,
_gedit_tab_get_name (tab)); _gedit_tab_get_name (tab));
break; break;
case PROP_STATE: case PROP_STATE:
g_value_set_int (value, g_value_set_enum (value,
gedit_tab_get_state (tab)); gedit_tab_get_state (tab));
break; break;
case PROP_AUTO_SAVE: case PROP_AUTO_SAVE:
g_value_set_boolean (value, g_value_set_boolean (value,
...@@ -265,13 +266,12 @@ gedit_tab_class_init (GeditTabClass *klass) ...@@ -265,13 +266,12 @@ gedit_tab_class_init (GeditTabClass *klass)
G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_STATE, PROP_STATE,
g_param_spec_int ("state", g_param_spec_enum ("state",
"State", "State",
"The tab's state", "The tab's state",
0, /* GEDIT_TAB_STATE_NORMAL */ GEDIT_TYPE_TAB_STATE,
GEDIT_TAB_NUM_OF_STATES - 1, GEDIT_TAB_STATE_NORMAL,
0, /* GEDIT_TAB_STATE_NORMAL */ G_PARAM_READABLE));
G_PARAM_READABLE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_AUTO_SAVE, PROP_AUTO_SAVE,
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include "gedit-recent.h" #include "gedit-recent.h"
#include "gedit-documents-panel.h" #include "gedit-documents-panel.h"
#include "gedit-plugins-engine.h" #include "gedit-plugins-engine.h"
#include "gedit-enum-types.h"
#include "recent-files/egg-recent-model.h" #include "recent-files/egg-recent-model.h"
#include "recent-files/egg-recent-view.h" #include "recent-files/egg-recent-view.h"
...@@ -108,8 +109,8 @@ gedit_window_get_property (GObject *object, ...@@ -108,8 +109,8 @@ gedit_window_get_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_STATE: case PROP_STATE:
g_value_set_int (value, g_value_set_enum (value,
gedit_window_get_state (window)); gedit_window_get_state (window));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
...@@ -311,13 +312,12 @@ gedit_window_class_init (GeditWindowClass *klass) ...@@ -311,13 +312,12 @@ gedit_window_class_init (GeditWindowClass *klass)
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_STATE, PROP_STATE,
g_param_spec_int ("state", g_param_spec_flags ("state",
"State", "State",
"The window's state", "The window's state",
0, /* GEDIT_WINDOW_STATE_NORMAL */ GEDIT_TYPE_WINDOW_STATE,
G_MAXINT, GEDIT_WINDOW_STATE_NORMAL,
0, /* GEDIT_WINDOW_STATE_NORMAL */ G_PARAM_READABLE));
G_PARAM_READABLE));
g_type_class_add_private (object_class, sizeof(GeditWindowPrivate)); g_type_class_add_private (object_class, sizeof(GeditWindowPrivate));
} }
......
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