From 66d0a402e1b347a8cd0a9bedf717cd97b5d173b1 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 6 Apr 2007 15:52:49 +0200 Subject: [PATCH] Remove the unused push scroller code. --- lib/python/_sugar.defs | 34 ------ lib/python/_sugar.override | 1 - lib/src/Makefile.am | 2 - lib/src/sugar-push-scroller.c | 195 ---------------------------------- lib/src/sugar-push-scroller.h | 66 ------------ 5 files changed, 298 deletions(-) delete mode 100644 lib/src/sugar-push-scroller.c delete mode 100644 lib/src/sugar-push-scroller.h diff --git a/lib/python/_sugar.defs b/lib/python/_sugar.defs index a23e7523..f56b5188 100644 --- a/lib/python/_sugar.defs +++ b/lib/python/_sugar.defs @@ -38,13 +38,6 @@ (gtype-id "SUGAR_TYPE_KEY_GRABBER") ) -(define-object PushScroller - (in-module "Sugar") - (parent "GObject") - (c-name "SugarPushScroller") - (gtype-id "SUGAR_TYPE_PUSH_SCROLLER") -) - (define-object DownloadManager (in-module "Sugar") (parent "GObject") @@ -163,33 +156,6 @@ ) ) -;; From sugar-push-scroller.h - -(define-function push_scroller_get_type - (c-name "sugar_push_scroller_get_type") - (return-type "GType") -) - -(define-method start - (of-object "SugarPushScroller") - (c-name "sugar_push_scroller_start") - (return-type "none") - (parameters - '("SugarBrowser*" "browser") - '("int" "x") - '("int" "y") - ) -) - -(define-method stop - (of-object "SugarPushScroller") - (c-name "sugar_push_scroller_stop") - (return-type "none") - (parameters - '("guint32" "timestamp") - ) -) - ;; From sugar-download-manager.h (define-function sugar_download_manager_get_type diff --git a/lib/python/_sugar.override b/lib/python/_sugar.override index 1e328e90..74c5bcda 100644 --- a/lib/python/_sugar.override +++ b/lib/python/_sugar.override @@ -7,7 +7,6 @@ headers #include "sugar-browser.h" #include "sugar-key-grabber.h" #include "sugar-address-entry.h" -#include "sugar-push-scroller.h" #include "sugar-download-manager.h" #include "sugar-download.h" #include "sugar-audio-manager.h" diff --git a/lib/src/Makefile.am b/lib/src/Makefile.am index 8494971c..94ad6bdf 100644 --- a/lib/src/Makefile.am +++ b/lib/src/Makefile.am @@ -46,8 +46,6 @@ libsugarprivate_la_SOURCES = \ sugar-download-manager.c \ sugar-key-grabber.h \ sugar-key-grabber.c \ - sugar-push-scroller.c \ - sugar-push-scroller.h \ sugar-utils.c \ sugar-utils.h diff --git a/lib/src/sugar-push-scroller.c b/lib/src/sugar-push-scroller.c deleted file mode 100644 index aaff3f66..00000000 --- a/lib/src/sugar-push-scroller.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright © 2002 Ricardo Fernádez Pascual - * Copyright © 2005 Crispin Flowerday - * Copyright © 2005 Christian Persch - * Copyright © 2005 Samuel Abels - * Copyright (C) 2006, Red Hat, Inc. - * - * 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, 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. - * - * $Id: ephy-push-scroller.c,v 1.6 2006/09/13 19:01:24 chpe Exp $ - */ - -/* this file is based on work of Daniel Erat for galeon 1 */ - -#include "sugar-push-scroller.h" - -#include -#include -#include - -#include - -#define SUGAR_PUSH_SCROLLER_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), SUGAR_TYPE_PUSH_SCROLLER, SugarPushScrollerPrivate)) - -struct _SugarPushScrollerPrivate -{ - SugarBrowser *browser; - GdkCursor *cursor; - guint start_x; - guint start_y; - guint active : 1; -}; - -G_DEFINE_TYPE(SugarPushScroller, sugar_push_scroller, G_TYPE_OBJECT) - -/* private functions */ - -static gboolean -sugar_push_scroller_motion_cb(GtkWidget *widget, - GdkEventMotion *event, - SugarPushScroller *scroller) -{ - SugarPushScrollerPrivate *priv = scroller->priv; - int x_dist, x_dist_abs, y_dist, y_dist_abs; - - if (!priv->active) { - return FALSE; - } - - /* get distance between last known cursor position and cursor */ - x_dist = priv->start_x - event->x_root; - x_dist_abs = abs(x_dist); - y_dist = priv->start_y - event->y_root; - y_dist_abs = abs(y_dist); - - /* scroll */ - sugar_browser_scroll_pixels(priv->browser, x_dist, y_dist); - - priv->start_x = event->x_root; - priv->start_y = event->y_root; - - return TRUE; -} - -/* public functions */ - -void -sugar_push_scroller_start (SugarPushScroller *scroller, - SugarBrowser *browser, - int x, - int y) -{ - SugarPushScrollerPrivate *priv = scroller->priv; - GtkWidget *widget, *window; - guint32 timestamp; - - g_return_if_fail (browser != NULL); - - if (priv->active) - return; - - if (gdk_pointer_is_grabbed ()) - return; - - priv->active = TRUE; - - /* FIXME is this good enough? */ - timestamp = gtk_get_current_event_time(); - - g_object_ref (scroller); - - priv->browser = browser; - - window = gtk_widget_get_toplevel(GTK_WIDGET(browser)); - g_object_ref (window); - - /* set positions */ - priv->start_x = x; - priv->start_y = y; - - g_signal_connect(window, "motion-notify-event", - G_CALLBACK (sugar_push_scroller_motion_cb), scroller); - - /* grab the pointer */ - widget = GTK_WIDGET(window); - gtk_grab_add(widget); - if (gdk_pointer_grab(widget->window, FALSE, - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK, - NULL, priv->cursor, timestamp) != GDK_GRAB_SUCCESS) { - sugar_push_scroller_stop(scroller, timestamp); - return; - } -} - -void -sugar_push_scroller_stop (SugarPushScroller *scroller, - guint32 timestamp) -{ - SugarPushScrollerPrivate *priv = scroller->priv; - GtkWidget *widget, *window; - - if (priv->active == FALSE) - return; - - window = gtk_widget_get_toplevel(GTK_WIDGET(priv->browser)); - - /* disconnect the signals before ungrabbing! */ - g_signal_handlers_disconnect_matched (window, - G_SIGNAL_MATCH_DATA, 0, 0, - NULL, NULL, scroller); - - /* ungrab the pointer if it's grabbed */ - if (gdk_pointer_is_grabbed()) - { - gdk_pointer_ungrab(timestamp); - } - - gdk_keyboard_ungrab(timestamp); - - widget = GTK_WIDGET(window); - gtk_grab_remove(widget); - - g_object_unref(window); - - priv->browser = NULL; - priv->active = FALSE; - - g_object_unref(scroller); -} - -/* class implementation */ - -static void -sugar_push_scroller_init (SugarPushScroller *scroller) -{ - SugarPushScrollerPrivate *priv; - priv = scroller->priv = SUGAR_PUSH_SCROLLER_GET_PRIVATE(scroller); - priv->active = FALSE; - priv->cursor = gdk_cursor_new(GDK_FLEUR); -} - -static void -sugar_push_scroller_finalize (GObject *object) -{ - SugarPushScroller *scroller = SUGAR_PUSH_SCROLLER(object); - SugarPushScrollerPrivate *priv = scroller->priv; - - gdk_cursor_unref(priv->cursor); - - G_OBJECT_CLASS(sugar_push_scroller_parent_class)->finalize(object); -} - -static void -sugar_push_scroller_class_init (SugarPushScrollerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS(klass); - - object_class->finalize = sugar_push_scroller_finalize; - - g_type_class_add_private(klass, sizeof (SugarPushScrollerPrivate)); -} diff --git a/lib/src/sugar-push-scroller.h b/lib/src/sugar-push-scroller.h deleted file mode 100644 index 69a23357..00000000 --- a/lib/src/sugar-push-scroller.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright © 2002 Ricardo Fernádez Pascual - * Copyright © 2005 Crispin Flowerday - * Copyright © 2005 Christian Persch - * Copyright (C) 2006, Red Hat, Inc. - * - * 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, 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. - * - * $Id: ephy-push-scroller.h,v 1.2 2006/09/13 19:01:24 chpe Exp $ - */ - -#ifndef SUGAR_PUSH_SCROLLER_H -#define SUGAR_PUSH_SCROLLER_H - -#include -#include - -#include "sugar-browser.h" - -G_BEGIN_DECLS - -#define SUGAR_TYPE_PUSH_SCROLLER (sugar_push_scroller_get_type()) -#define SUGAR_PUSH_SCROLLER(object) (G_TYPE_CHECK_INSTANCE_CAST((object), SUGAR_TYPE_PUSH_SCROLLER, SugarPushScroller)) -#define SUGAR_PUSH_SCROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SUGAR_TYPE_PUSH_SCROLLER, SugarPushScrollerClass)) -#define SUGAR_IS_PUSH_SCROLLER(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), SUGAR_TYPE_PUSH_SCROLLER)) -#define SUGAR_IS_PUSH_SCROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SUGAR_TYPE_PUSH_SCROLLER)) -#define SUGAR_PUSH_SCROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SUGAR_TYPE_PUSH_SCROLLER, SugarPushScrollerClass)) - -typedef struct _SugarPushScrollerClass SugarPushScrollerClass; -typedef struct _SugarPushScroller SugarPushScroller; -typedef struct _SugarPushScrollerPrivate SugarPushScrollerPrivate; - -struct _SugarPushScrollerClass { - GObjectClass parent_class; -}; - -struct _SugarPushScroller { - GObject parent_object; - - /*< private >*/ - SugarPushScrollerPrivate *priv; -}; - -GType sugar_push_scroller_get_type (void); -void sugar_push_scroller_start (SugarPushScroller *scroller, - SugarBrowser *browser, - int x, - int y); -void sugar_push_scroller_stop (SugarPushScroller *scroller, - guint32 timestamp); - -G_END_DECLS - -#endif