~ubuntu-branches/ubuntu/trusty/xiphos/trusty

« back to all changes in this revision

Viewing changes to src/gnome2/about_modules.c

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs, Dmitrijs Ledkovs
  • Date: 2012-03-11 18:43:32 UTC
  • mfrom: (17.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120311184332-splq3ecpx7tyi87d
Tags: 3.1.5+dfsg-1
[ Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> ]  
* New upstream release.
* Build using webkit backend
* Contains unpacked source for waf binary (Closes: #654511)
* Update debian/copyright to latest specification

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Xiphos Bible Study Tool
3
3
 * about_modules.c - Sword modules about dialog
4
4
 *
5
 
 * Copyright (C) 2000-2010 Xiphos Developer Team
 
5
 * Copyright (C) 2000-2011 Xiphos Developer Team
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
25
25
 
26
26
#include <gtk/gtk.h>
27
27
 
28
 
#ifdef USE_GTKMOZEMBED
29
 
#ifdef WIN32
30
 
#include "geckowin/gecko-html.h"
31
 
#else
32
 
#include "gecko/gecko-html.h"
33
 
#endif
34
 
#else
 
28
#include "../xiphos_html/xiphos_html.h"
 
29
#ifdef GTKHTML
35
30
#include <gtkhtml/gtkhtml.h>
36
31
#include "gui/html.h"
37
32
#endif
80
75
                 gpointer data)
81
76
{
82
77
        GS_message(("on_copy_activate"));
83
 
#ifdef USE_GTKMOZEMBED
84
 
        gecko_html_copy_selection(GECKO_HTML(text_html));
 
78
#ifdef USE_XIPHOS_HTML
 
79
        XIPHOS_HTML_COPY_SELECTION(text_html);
85
80
#else
86
81
        gui_copy_html(text_html);
87
82
#endif
100
95
        item =gtk_image_menu_item_new_from_stock  ("gtk-copy",
101
96
                                                        accel_group);
102
97
        gtk_widget_show(item);
103
 
        g_signal_connect(GTK_OBJECT(item), "clicked",
 
98
        g_signal_connect(G_OBJECT(item), "clicked",
104
99
                           G_CALLBACK  (on_copy_activate),
105
100
                          NULL);
106
101
        gtk_container_add(GTK_CONTAINER(menu), item);
126
121
 * Return value
127
122
 *   gboolean
128
123
 */
129
 
#ifndef USE_GTKMOZEMBED
 
124
#ifndef USE_XIPHOS_HTML
130
125
static gboolean
131
126
on_button_release_event(GtkWidget * widget,
132
127
                        GdkEventButton * event,
146
141
}
147
142
#endif /* 0 */
148
143
 
149
 
#ifdef USE_GTKMOZEMBED
 
144
 
 
145
#ifdef USE_XIPHOS_HTML
150
146
static void
151
 
_popupmenu_requested_cb(GeckoHtml *html,
 
147
_popupmenu_requested_cb (XiphosHtml *html,
152
148
                        gchar *uri,
153
149
                        gpointer user_data)
154
150
{
181
177
        GtkWidget *hbox21;
182
178
        GtkWidget *pixmap;
183
179
        GtkWidget *frame73;
184
 
#ifndef USE_GTKMOZEMBED
185
180
        GtkWidget *scrolledwindow30;
186
 
#endif
187
181
        GtkWidget *dialog_action_area28;
188
182
        GtkWidget *hbuttonbox7;
189
183
        GtkWidget *button;
218
212
        frame73 = gtk_frame_new(NULL);
219
213
        gtk_widget_show(frame73);
220
214
        gtk_box_pack_start(GTK_BOX(vbox25), frame73, TRUE, TRUE, 0);
221
 
#ifdef USE_GTKMOZEMBED
222
 
        text_html = GTK_WIDGET(gecko_html_new(NULL, FALSE, 12));
223
 
        gtk_widget_show(text_html);
224
 
        gtk_container_add(GTK_CONTAINER(frame73), text_html);
225
 
        //gtk_widget_set_sensitive(text_html,FALSE);
226
 
        g_signal_connect((gpointer)text_html,
227
 
                      "popupmenu_requested",
228
 
                      G_CALLBACK (_popupmenu_requested_cb),
229
 
                      NULL);
230
 
#else
231
215
 
232
216
        scrolledwindow30 = gtk_scrolled_window_new(NULL, NULL);
233
217
        gtk_widget_show(scrolledwindow30);
239
223
                                       GTK_POLICY_ALWAYS);
240
224
        gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)scrolledwindow30,
241
225
                                             settings.shadow_type);
 
226
#ifdef USE_XIPHOS_HTML
 
227
        text_html = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, 12));
 
228
        gtk_widget_show(text_html);
 
229
        g_signal_connect((gpointer)text_html,
 
230
                      "popupmenu_requested",
 
231
                      G_CALLBACK (_popupmenu_requested_cb),
 
232
                      NULL);
 
233
#else
242
234
        text_html = gtk_html_new();
243
235
        gtk_widget_show(text_html);
244
 
        gtk_container_add(GTK_CONTAINER(scrolledwindow30), text_html);
245
 
 
246
 
        g_signal_connect(GTK_OBJECT(text_html),"button_release_event",
 
236
        g_signal_connect(G_OBJECT(text_html),"button_release_event",
247
237
                                G_CALLBACK(on_button_release_event),
248
238
                                NULL);
249
239
#endif
 
240
        gtk_container_add(GTK_CONTAINER(scrolledwindow30), text_html);
250
241
        dialog_action_area28 =
251
242
                gtk_dialog_get_action_area(GTK_DIALOG(dialog_about_mods));
252
243
        g_object_set_data(G_OBJECT(dialog_about_mods),
269
260
#ifdef HAVE_GTK_218
270
261
        gtk_widget_set_can_default(button, TRUE);
271
262
#else
 
263
  #ifdef USE_GTK_3
 
264
        gtk_widget_set_can_default(button, 1);
 
265
  #else
272
266
        GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
 
267
  #endif
273
268
#endif
274
 
        g_signal_connect(GTK_OBJECT(button), "clicked",
 
269
        g_signal_connect(G_OBJECT(button), "clicked",
275
270
                           G_CALLBACK(about_modules_ok), NULL);
276
271
        return dialog_about_mods;
277
272
 
367
362
void
368
363
gui_core_display_about_dialog(gchar * desc,
369
364
                              gchar * abouttext,
370
 
                              const gchar * version)
 
365
                              const gchar * version,
 
366
                              gchar * modname)
371
367
{
372
368
        GtkWidget *aboutbox;    //-- pointer to about dialog
373
369
        GString *str = g_string_new(NULL);
374
370
        GString *description = g_string_new(NULL);
375
371
        GString *text = g_string_new(NULL);
376
 
        static const char *html_start =
377
 
            "<html><head><meta http-equiv=\"content-type\" "
378
 
            "content=\"text/html; charset=utf-8\"></head><body>";
379
 
        static const char *html_end = "</body></html>";
380
 
 
 
372
        GString *html_start = g_string_new(NULL);
 
373
            
 
374
        static const char *html_end = "</font></body></html>";
 
375
        MOD_FONT *mf = get_font(modname);
 
376
        g_string_printf (html_start,
 
377
                         "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"></head><body bgcolor=\"%s\" text=\"%s\"><font face=\"%s\" size=\"%+d\">",
 
378
                         settings.bible_bg_color,
 
379
                         settings.bible_text_color,
 
380
                         ((mf->old_font) ? mf->old_font : ""),
 
381
                         mf->old_font_size_value - 1);
 
382
        free_font(mf);
 
383
                         
381
384
        g_string_printf(description,
382
385
                        "<center><font color=\"#000fcf\"><b>%s</b></font><hr/>%s %s</center><br/>",
383
386
                        (desc ? desc : "No module present"),
392
395
                              : _("The module has no About information.")),
393
396
                             FALSE);
394
397
 
395
 
        g_string_append_len(text, html_start, strlen(html_start));
 
398
        g_string_append_len(text, html_start->str, strlen(html_start->str));
396
399
        g_string_append_len(text, description->str, strlen(description->str));
397
400
        g_string_append_len(text, str->str, strlen(str->str));
398
401
        g_string_append_len(text, html_end, strlen(html_end));
400
403
 
401
404
        g_string_free(text, TRUE);
402
405
        g_string_free(str, TRUE);
403
 
        g_string_free(description, TRUE);
 
406
        g_string_free(description, TRUE);  
 
407
        g_string_free(html_start, TRUE);
404
408
}
405
409
 
406
410
/******************************************************************************
430
434
        bufabout = main_get_mod_about_info(modname);
431
435
        version = main_get_mod_config_entry(modname, "Version");
432
436
 
433
 
        gui_core_display_about_dialog(buf, bufabout, version);
 
437
        gui_core_display_about_dialog(buf, bufabout, version, modname);
434
438
 
435
439
        if (bufabout)
436
440
                g_free(bufabout);