~ubuntu-branches/ubuntu/trusty/gq/trusty

« back to all changes in this revision

Viewing changes to src/gq-tree-view.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2009-10-25 23:34:56 UTC
  • mfrom: (1.1.4 upstream) (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091025233456-i794n3yg2cff930j
Tags: 1.3.4-1
* QA upload.
  + Set maintainer to Debian QA Group <packages@qa.debian.org>.
* New upstream release. (Closes: #534705).
  + Does not segfault on amd64. (Closes: #444312).
  + Remove all existing patches and change patch system to quilt.
  + Replace dpatch build-dep with quilt.
* 01_desktop_file.diff - Remove encoding and bogus categories 
  from desktop file.
* Copy in config.{sub,guess} on configure, rm them on clean.
  + Add build-dep on autotools-dev.
* Make clean not ignore errors.
* Add copyright holders and version path to GPL (GPL-2).
* Update watch file to use SF redirector. (Closes: #449749).
* Bump debhelper build-dep and compat to 5.
* Bump Standards Version to 3.8.3.
  + Menu policy transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of GQ
 
2
 *
 
3
 * AUTHORS
 
4
 *     Sven Herzberg  <herzi@gnome-de.org>
 
5
 *
 
6
 * Copyright (C) 2007  Sven Herzberg
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public License as
 
10
 * published by the Free Software Foundation; either version 2.1 of the
 
11
 * License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public License
 
19
 * along with this program; if not, write to the Free Software
 
20
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
21
 * USA
 
22
 */
 
23
 
 
24
#include "gq-tree-view.h"
 
25
 
 
26
#include "gq-main-loop.h"
 
27
 
 
28
struct GqTreeViewPrivate {
 
29
        guint      source_id;
 
30
};
 
31
#define P(i) (G_TYPE_INSTANCE_GET_PRIVATE((i), GQ_TYPE_TREE_VIEW, struct GqTreeViewPrivate))
 
32
 
 
33
GtkWidget*
 
34
gq_tree_view_new(void)
 
35
{
 
36
        return g_object_new(GQ_TYPE_TREE_VIEW, NULL);
 
37
}
 
38
 
 
39
/* GType */
 
40
G_DEFINE_TYPE(GqTreeView, gq_tree_view, GTK_TYPE_TREE_VIEW);
 
41
 
 
42
static void
 
43
gq_tree_view_init(GqTreeView* self G_GNUC_UNUSED)
 
44
{}
 
45
 
 
46
static void
 
47
tree_view_dispose(GObject* object)
 
48
{
 
49
        if(P(object)->source_id) {
 
50
                g_source_remove(P(object)->source_id);
 
51
                P(object)->source_id = 0;
 
52
        }
 
53
        G_OBJECT_CLASS(gq_tree_view_parent_class)->dispose(object);
 
54
}
 
55
 
 
56
static gboolean
 
57
tree_view_queue_draw(gpointer data)
 
58
{
 
59
        if(!gq_main_loop_blocked()) {
 
60
                GtkWidget* widget = GTK_WIDGET(data);
 
61
                gtk_widget_queue_draw(widget);
 
62
                P(widget)->source_id = 0;
 
63
                return FALSE;
 
64
        }
 
65
 
 
66
        return TRUE;
 
67
}
 
68
 
 
69
static gboolean
 
70
tree_view_expose_event(GtkWidget     * widget,
 
71
                       GdkEventExpose* event)
 
72
{
 
73
        if(gq_main_loop_blocked() && !P(widget)->source_id) {
 
74
                P(widget)->source_id = g_timeout_add(100, tree_view_queue_draw, widget);
 
75
                return TRUE;
 
76
        }
 
77
        else if(!gq_main_loop_blocked())
 
78
        {
 
79
                return GTK_WIDGET_CLASS(gq_tree_view_parent_class)->expose_event(widget, event);
 
80
        }
 
81
        return FALSE;
 
82
}
 
83
 
 
84
static void
 
85
gq_tree_view_class_init(GqTreeViewClass* self_class)
 
86
{
 
87
        GObjectClass* object_class = G_OBJECT_CLASS(self_class);
 
88
        GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(self_class);
 
89
 
 
90
        object_class->dispose      = tree_view_dispose;
 
91
        widget_class->expose_event = tree_view_expose_event;
 
92
 
 
93
        g_type_class_add_private(self_class, sizeof(struct GqTreeViewPrivate));
 
94
}
 
95