~ubuntu-branches/debian/wheezy/linuxdcpp/wheezy

« back to all changes in this revision

Viewing changes to linux/bookentry.cc

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2006-10-24 16:46:05 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20061024164605-ydvywkpog32r1wiw
Tags: 0.0.1.cvs20061024-1
* New upstream release
* Patched SContruct to remove unneeded ld flags, according to
checklib

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
2
 
* Copyright (C) 2004 Jens Oknelid, paskharen@gmail.com
3
 
*
4
 
* This program is free software; you can redistribute it and/or modify
5
 
* it under the terms of the GNU General Public License as published by
6
 
* the Free Software Foundation; either version 2 of the License, or
7
 
* (at your option) any later version.
8
 
*
9
 
* This program is distributed in the hope that it will be useful,
10
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
* GNU General Public License for more details.
13
 
*
14
 
* You should have received a copy of the GNU General Public License
15
 
* along with this program; if not, write to the Free Software
16
 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 
*/
 
2
 * Copyright © 2004-2006 Jens Oknelid, paskharen@gmail.com
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
17
 */
18
18
 
19
19
#include "bookentry.hh"
20
 
#include <client/stdinc.h>
21
 
#include <client/DCPlusPlus.h>
22
 
#include <client/Util.h>
 
20
#include "wulformanager.hh"
23
21
 
24
22
using namespace std;
25
23
 
26
 
BookEntry::BookEntry(string title)
 
24
BookEntry::BookEntry(string title, string glade):
 
25
        Entry(title, glade)
27
26
{
28
 
        // Allow search tab to have many tabs with the same title.
29
 
        if (title == "Search")
30
 
                this->id = title + Util::toString((long)this);
31
 
        else
32
 
                this->id = title;
33
 
 
34
27
        bold = FALSE;
35
28
        box = gtk_hbox_new(FALSE, 5);
36
29
 
43
36
        gtk_container_add(GTK_CONTAINER(eventBox), GTK_WIDGET(label));
44
37
 
45
38
        button = GTK_BUTTON(gtk_button_new());
46
 
        gtk_container_add(GTK_CONTAINER(button), 
47
 
                gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
 
39
        gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
48
40
        gtk_widget_set_size_request(GTK_WIDGET(button), 16, 16);
49
41
        gtk_button_set_relief(button, GTK_RELIEF_NONE);
50
42
        gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(button), FALSE, TRUE, 0);
57
49
        setLabel_gui(title);
58
50
}
59
51
 
 
52
GtkWidget* BookEntry::getContainer()
 
53
{
 
54
        return getWidget("mainBox");
 
55
}
 
56
 
60
57
GtkWidget *BookEntry::getTitle()
61
58
{
62
59
        return box;
63
60
}
64
61
 
65
 
std::string BookEntry::getID()
66
 
{
67
 
        return id;
68
 
}
69
 
 
70
62
void BookEntry::applyCallback(GCallback closeCallback)
71
63
{
72
 
        g_signal_connect(G_OBJECT(button), "clicked", closeCallback, (gpointer)this);
 
64
        g_signal_connect(button, "clicked", closeCallback, (gpointer)this);
73
65
}
74
66
 
75
 
void BookEntry::setLabel_gui(std::string text)
 
67
void BookEntry::setLabel_gui(string text)
76
68
{
77
69
        gtk_tooltips_set_tip(tips, eventBox, text.c_str(), text.c_str());
78
70
        if (text.size() > 20) 
79
 
                text = text.substr(0, 20) + "...";
 
71
                text = text.substr(0, 17) + "...";
80
72
        gtk_label_set_text(label, text.c_str());
81
73
        title = text;
82
74
}
83
75
 
84
76
void BookEntry::setBold_gui()
85
77
{
86
 
        if (!bold)
 
78
        if (!bold && WulforManager::get()->getMainWindow()->currentPage_gui() != getContainer())
87
79
        {
88
80
                char *markup = g_markup_printf_escaped("<b>%s</b>", title.c_str());
89
81
                gtk_label_set_markup(label, markup);