[bijiben] editor: remove unused alignment code
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] editor: remove unused alignment code
- Date: Sat, 9 Mar 2013 23:10:33 +0000 (UTC)
commit 7a917aa53a55da47af33adc5befe9be75a85e062
Author: Pierre-Yves Luyten <py luyten fr>
Date: Sun Mar 10 00:09:22 2013 +0100
editor: remove unused alignment code
This code will not be used and this removes a warning when compiling
src/libbiji/editor/biji-editor-selection.c | 108 ----------------------------
1 files changed, 0 insertions(+), 108 deletions(-)
---
diff --git a/src/libbiji/editor/biji-editor-selection.c b/src/libbiji/editor/biji-editor-selection.c
index d77836b..bb0388c 100644
--- a/src/libbiji/editor/biji-editor-selection.c
+++ b/src/libbiji/editor/biji-editor-selection.c
@@ -56,7 +56,6 @@ G_DEFINE_TYPE (
enum {
PROP_0,
PROP_WEBVIEW,
- PROP_ALIGNMENT,
PROP_BACKGROUND_COLOR,
PROP_BOLD,
PROP_FONT_NAME,
@@ -217,7 +216,6 @@ static void
webview_selection_changed (WebKitWebView *webview,
EEditorSelection *selection)
{
- g_object_notify (G_OBJECT (selection), "alignment");
g_object_notify (G_OBJECT (selection), "background-color");
g_object_notify (G_OBJECT (selection), "bold");
g_object_notify (G_OBJECT (selection), "font-name");
@@ -255,11 +253,6 @@ e_editor_selection_get_property (GObject *object,
EEditorSelection *selection = E_EDITOR_SELECTION (object);
switch (property_id) {
- case PROP_ALIGNMENT:
- g_value_set_int (value,
- e_editor_selection_get_alignment (selection));
- return;
-
case PROP_BACKGROUND_COLOR:
g_value_set_string (value,
e_editor_selection_get_background_color (selection));
@@ -348,11 +341,6 @@ e_editor_selection_set_property (GObject *object,
selection, g_value_get_object (value));
return;
- case PROP_ALIGNMENT:
- e_editor_selection_set_alignment (
- selection, g_value_get_int (value));
- return;
-
case PROP_BACKGROUND_COLOR:
e_editor_selection_set_background_color (
selection, g_value_get_string (value));
@@ -450,18 +438,6 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
g_object_class_install_property (
object_class,
- PROP_ALIGNMENT,
- g_param_spec_int (
- "alignment",
- NULL,
- NULL,
- E_EDITOR_SELECTION_ALIGNMENT_LEFT,
- E_EDITOR_SELECTION_ALIGNMENT_RIGHT,
- E_EDITOR_SELECTION_ALIGNMENT_LEFT,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
PROP_BACKGROUND_COLOR,
g_param_spec_string (
"background-color",
@@ -735,90 +711,6 @@ e_editor_selection_replace (EEditorSelection *selection,
webkit_dom_range_insert_node (range, WEBKIT_DOM_NODE (frag), NULL);
}
-EEditorSelectionAlignment
-e_editor_selection_get_alignment (EEditorSelection *selection)
-{
- WebKitDOMRange *range;
- WebKitDOMNode *node;
- WebKitDOMElement *element;
- WebKitDOMCSSStyleDeclaration *style;
- gchar *value;
- EEditorSelectionAlignment alignment;
-
- g_return_val_if_fail (
- E_IS_EDITOR_SELECTION (selection),
- E_EDITOR_SELECTION_ALIGNMENT_LEFT);
-
- range = editor_selection_get_current_range (selection);
- if (!range) {
- return E_EDITOR_SELECTION_ALIGNMENT_LEFT;
- }
-
- node = webkit_dom_range_get_start_container (range, NULL);
- if (!node) {
- return E_EDITOR_SELECTION_ALIGNMENT_LEFT;
- }
-
- if (!WEBKIT_DOM_IS_ELEMENT (node)) {
- element = webkit_dom_node_get_parent_element (node);
- } else {
- element = WEBKIT_DOM_ELEMENT (node);
- }
-
- style = webkit_dom_element_get_style (element);
- value = webkit_dom_css_style_declaration_get_property_value (
- style, "text-align");
-
- if (!value || !*value ||
- (g_ascii_strncasecmp (value, "left", 4) == 0)) {
- alignment = E_EDITOR_SELECTION_ALIGNMENT_LEFT;
- } else if (g_ascii_strncasecmp (value, "center", 6) == 0) {
- alignment = E_EDITOR_SELECTION_ALIGNMENT_CENTER;
- } else if (g_ascii_strncasecmp (value, "right", 5) == 0) {
- alignment = E_EDITOR_SELECTION_ALIGNMENT_RIGHT;
- } else {
- alignment = E_EDITOR_SELECTION_ALIGNMENT_LEFT;
- }
-
- g_free (value);
-
- return alignment;
-}
-
-void
-e_editor_selection_set_alignment (EEditorSelection *selection,
- EEditorSelectionAlignment alignment)
-{
- WebKitDOMDocument *document;
- const gchar *command;
-
- g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
-
- if (e_editor_selection_get_alignment (selection) == alignment) {
- return;
- }
-
- switch (alignment) {
- case E_EDITOR_SELECTION_ALIGNMENT_CENTER:
- command = "justifyCenter";
- break;
-
- case E_EDITOR_SELECTION_ALIGNMENT_LEFT:
- command = "justifyLeft";
- break;
-
- case E_EDITOR_SELECTION_ALIGNMENT_RIGHT:
- command = "justifyRight";
- break;
- }
-
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, command, FALSE, "");
-
- g_object_notify (G_OBJECT (selection), "alignment");
-}
-
-
const gchar *
e_editor_selection_get_background_color (EEditorSelection *selection)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]