From 85b2913a380c69f14ae0254ad23b10fabfb33667 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 24 Oct 2008 23:52:05 +0000 Subject: Merge revisions 36534:36684 from trunk. svn path=/branches/kill-bonobo/; revision=36685 --- widgets/misc/ChangeLog | 21 +++++++++ widgets/misc/e-dateedit.c | 14 +++--- widgets/misc/e-dateedit.h | 9 ++-- widgets/misc/e-reflow.c | 50 +++++++++------------ widgets/misc/e-spinner.c | 110 ++++++++++++++++++++++++---------------------- widgets/misc/e-spinner.h | 35 +-------------- 6 files changed, 110 insertions(+), 129 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 57e1d25b7a..85ec90411f 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,24 @@ +2008-10-21 Sankar P + + * e-spinner.c (e_spinner_stop), + (e_spinner_new_spinning_small_shown): + * e-spinner.h: + * e-task-widget.c (e_task_widget_construct): + Re-factor spinner usage. + +2008-10-17 Sankar P + +License Changes + + * e-dateedit.c: + * e-dateedit.h: + +2008-10-10 Sankar P + +License Changes + code cleanup + + * e-reflow.c (e_reflow_event), (e_reflow_init): + 2008-10-01 Milan Crha ** Part of fix for bug #554418 diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index f11ecbe029..272223025e 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -1,23 +1,21 @@ /* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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, + * This library 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 * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public + * You should have received a copy of the GNU Library General Public * License along with the program; if not, see * - * * Authors: * Damon Chaplin * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * */ /* diff --git a/widgets/misc/e-dateedit.h b/widgets/misc/e-dateedit.h index 587120148d..5c1e20deac 100644 --- a/widgets/misc/e-dateedit.h +++ b/widgets/misc/e-dateedit.h @@ -9,11 +9,12 @@ * Based on the GnomeDateEdit, part of the Gnome Library. * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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, + * This library 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. diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c index 6fd7021b54..f51a502a83 100644 --- a/widgets/misc/e-reflow.c +++ b/widgets/misc/e-reflow.c @@ -1,26 +1,24 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * e-reflow.c - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * - * Authors: - * Chris Lahey + * 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 + * Lesser General Public License for more details. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * This library 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 - * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. + * Authors: + * Chris Lahey + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) */ - #include #include @@ -955,14 +953,12 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) case 1: { GdkEventButton *button = (GdkEventButton *) event; - double n_x, max_x; + double n_x; n_x = button->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) { + if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { /* don't allow to drag the first line*/ if (e_reflow_pick_line(reflow, button->x) == 0) return TRUE; @@ -1046,16 +1042,13 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) return TRUE; } else { GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x, max_x; + double n_x; n_x = motion->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; - - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) { + if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { if ( reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor); reflow->default_cursor_shown = FALSE; @@ -1071,14 +1064,12 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) case GDK_ENTER_NOTIFY: if (!reflow->column_drag) { GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x, max_x; + double n_x; n_x = crossing->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) { + if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { if ( reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor); reflow->default_cursor_shown = FALSE; @@ -1541,4 +1532,3 @@ e_reflow_init (EReflow *reflow) e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow); } - diff --git a/widgets/misc/e-spinner.c b/widgets/misc/e-spinner.c index 26a77e6126..56990d71a1 100644 --- a/widgets/misc/e-spinner.c +++ b/widgets/misc/e-spinner.c @@ -32,6 +32,30 @@ #include "e-spinner.h" +#define E_TYPE_SPINNER (e_spinner_get_type ()) +#define E_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SPINNER, ESpinner)) +#define E_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_SPINNER, ESpinnerClass)) +#define E_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SPINNER)) +#define E_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SPINNER)) +#define E_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_SPINNER, ESpinnerClass)) + +typedef struct _ESpinner ESpinner; +typedef struct _ESpinnerClass ESpinnerClass; +typedef struct _ESpinnerDetails ESpinnerDetails; + +struct _ESpinner +{ + GtkWidget parent; + + /*< private >*/ + ESpinnerDetails *details; +}; + +struct _ESpinnerClass +{ + GtkWidgetClass parent_class; +}; + #define LOG(msg, args...) #define START_PROFILER(name) #define STOP_PROFILER(name) @@ -518,7 +542,7 @@ static void e_spinner_init (ESpinner *spinner); static GObjectClass *parent_class; -GType +static GType e_spinner_get_type (void) { static GType type = 0; @@ -701,13 +725,7 @@ bump_spinner_frame_cb (ESpinner *spinner) return TRUE; } -/** - * e_spinner_start: - * @spinner: a #ESpinner - * - * Start the spinner animation. - **/ -void +static void e_spinner_start (ESpinner *spinner) { ESpinnerDetails *details = spinner->details; @@ -742,39 +760,7 @@ e_spinner_remove_update_callback (ESpinner *spinner) } } -/** - * e_spinner_stop: - * @spinner: a #ESpinner - * - * Stop the spinner animation. - **/ -void -e_spinner_stop (ESpinner *spinner) -{ - ESpinnerDetails *details = spinner->details; - - details->spinning = FALSE; - details->current_image = 0; - - if (details->timer_task != 0) - { - e_spinner_remove_update_callback (spinner); - - if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner))) - { - gtk_widget_queue_draw (GTK_WIDGET (spinner)); - } - } -} - -/* - * e_spinner_set_size: - * @spinner: a #ESpinner - * @size: the size of type %GtkIconSize - * - * Set the size of the spinner. - **/ -void +static void e_spinner_set_size (ESpinner *spinner, GtkIconSize size) { @@ -794,6 +780,27 @@ e_spinner_set_size (ESpinner *spinner, } #if 0 + +static void +e_spinner_stop (ESpinner *spinner) +{ + ESpinnerDetails *details = spinner->details; + + details->spinning = FALSE; + details->current_image = 0; + + if (details->timer_task != 0) + { + e_spinner_remove_update_callback (spinner); + + if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner))) + { + gtk_widget_queue_draw (GTK_WIDGET (spinner)); + } + } +} + + /* * e_spinner_set_timeout: * @spinner: a #ESpinner @@ -958,17 +965,14 @@ e_spinner_class_init (ESpinnerClass *class) g_type_class_add_private (object_class, sizeof (ESpinnerDetails)); } -/* - * e_spinner_new: - * - * Create a new #ESpinner. The spinner is a widget - * that gives the user feedback about network status with - * an animated image. - * - * Return Value: the spinner #GtkWidget - **/ -GtkWidget * -e_spinner_new (void) +GtkWidget *e_spinner_new_spinning_small_shown (void) { - return GTK_WIDGET (g_object_new (E_TYPE_SPINNER, NULL)); + ESpinner *image; + image = E_SPINNER (g_object_new (E_TYPE_SPINNER, NULL)); + + e_spinner_set_size (image, GTK_ICON_SIZE_SMALL_TOOLBAR); + e_spinner_start (image); + gtk_widget_show (GTK_WIDGET(image)); + + return GTK_WIDGET (image); } diff --git a/widgets/misc/e-spinner.h b/widgets/misc/e-spinner.h index 5a1cd42c5e..0fb97d945e 100644 --- a/widgets/misc/e-spinner.h +++ b/widgets/misc/e-spinner.h @@ -32,40 +32,7 @@ G_BEGIN_DECLS -#define E_TYPE_SPINNER (e_spinner_get_type ()) -#define E_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SPINNER, ESpinner)) -#define E_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_SPINNER, ESpinnerClass)) -#define E_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SPINNER)) -#define E_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SPINNER)) -#define E_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_SPINNER, ESpinnerClass)) - -typedef struct _ESpinner ESpinner; -typedef struct _ESpinnerClass ESpinnerClass; -typedef struct _ESpinnerDetails ESpinnerDetails; - -struct _ESpinner -{ - GtkWidget parent; - - /*< private >*/ - ESpinnerDetails *details; -}; - -struct _ESpinnerClass -{ - GtkWidgetClass parent_class; -}; - -GType e_spinner_get_type (void); - -GtkWidget *e_spinner_new (void); - -void e_spinner_start (ESpinner *throbber); - -void e_spinner_stop (ESpinner *throbber); - -void e_spinner_set_size (ESpinner *spinner, - GtkIconSize size); +GtkWidget *e_spinner_new_spinning_small_shown (void); G_END_DECLS -- cgit v1.2.3