~ubuntu-branches/ubuntu/maverick/conglomerate/maverick

« back to all changes in this revision

Viewing changes to src/cong-primary-window.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2005-11-08 05:07:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051108050706-bcg60nwqf1z3w0d6
Tags: 0.9.1-1ubuntu1
* Resynchronise with Debian (Closes: #4397).
  - Thanks, Jordan Mantha.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "cong-selection.h"
41
41
#include "cong-range.h"
42
42
#include "cong-ui-hooks.h"
 
43
#include "cong-plugin-manager.h"
43
44
 
44
45
#if 0
45
46
#include <libgnome/libgnome.h>
49
50
#endif
50
51
 
51
52
#define ENABLE_MAIN_WIDGET 1
 
53
#define ENABLE_PROPERTY_PAGES 0
52
54
#define LOG_PRIMARY_WINDOW_CREATION 0
53
55
 
54
56
#if LOG_PRIMARY_WINDOW_CREATION
65
67
 * |---------------------------------| LOGO |
66
68
 * | Toolbar                         |      |
67
69
 * |---------------------------------`------|
68
 
 * |       |                                |
69
 
 * | Tree  | Document view                  |
70
 
 * | View  |                                |
71
 
 * |       |                                |
72
 
 * |       |                                |
73
 
 * |       |                                |
74
 
 * |       |                                |
75
 
 * |       |                                |
76
 
 * |       |                                |
77
 
 * |       |                                |
78
 
 * |       |                                |
79
 
 * |       |                                |
80
 
 * |       O <- split pane                  |
81
 
 * |       |                                |
 
70
 * |         |                              |
 
71
 * | Tree    | Document view                |
 
72
 * | View    |                              |
 
73
 * |         |                              |
 
74
 * |         |                              |
 
75
 * |         |                              |
 
76
 * |         |                              |
 
77
 * |         |                              |
 
78
 * |---------|                              |
 
79
 * |Property |                              |
 
80
 * |  pages  |                              |
 
81
 * |         |                              |
 
82
 * |         O <- split pane                |
 
83
 * |         |                              |
82
84
 * |----------------------------------------|
83
85
 * | AppBar                                 |
84
86
 * `----------------------------------------'
341
343
        }
342
344
}
343
345
 
 
346
#if ENABLE_PROPERTY_PAGES
 
347
#if 0
 
348
static void
 
349
property_page_selection_change_cb (CongDocument *doc, gpointer user_data)
 
350
{
 
351
        GtkWidget *w = GTK_WIDGET (user_data);
 
352
 
 
353
#error move these into an inheritance hierarchy below GtkWidget
 
354
        /* Do something sane... */
 
355
        gtk_widget_hide (w);
 
356
}
 
357
#endif
 
358
 
 
359
static void
 
360
create_property_page_cb (CongService *service,
 
361
                         gpointer user_data)
 
362
{
 
363
        CongServiceNodePropertyPage *custom_property_page = CONG_SERVICE_NODE_PROPERTY_PAGE (service);
 
364
        CongPrimaryWindow *primary_window = (CongPrimaryWindow*)user_data;
 
365
        /* CongDocument *doc = cong_primary_window_get_document (primary_window); */
 
366
        GtkWidget *w = cong_custom_property_page_make (custom_property_page,
 
367
                                                       cong_primary_window_get_document (primary_window));
 
368
        gtk_widget_show (w);
 
369
        gtk_notebook_append_page (primary_window->property_notebook,
 
370
                                  w,
 
371
                                  gtk_label_new (cong_service_get_name (CONG_SERVICE (custom_property_page)))
 
372
                                  );
 
373
#if 0
 
374
        g_signal_connect (G_OBJECT (doc), "selection_change", G_CALLBACK (property_page_selection_change_cb), w);
 
375
        /* FIXME: disconnect from this signal? */
 
376
#endif
 
377
}
 
378
#endif
 
379
        
344
380
static void
345
381
add_standard_layout_for_doc (CongPrimaryWindow *primary_window, 
346
382
                             CongDocument *doc)
347
383
{
348
384
        GtkWidget *w1 = NULL, *w2 = NULL;
349
385
        GtkWidget *sidebar_notebook = NULL;
 
386
        GtkWidget *sidebar_vpane;
350
387
 
351
388
        /* --- Main window -> hpane --- */
352
389
        w1 = gtk_hpaned_new();
353
390
        gnome_app_set_contents(GNOME_APP(primary_window->window),w1);
354
391
        gtk_widget_show(w1);
 
392
 
 
393
        /* Sidebar vpane */
 
394
        sidebar_vpane = gtk_vpaned_new();
 
395
        gtk_widget_show (sidebar_vpane);
 
396
        gtk_paned_add1(GTK_PANED(w1), sidebar_vpane);
355
397
        
356
398
        /* --- Notebook to appear in the sidebar: --- */
357
399
        sidebar_notebook = gtk_notebook_new();
358
400
        gtk_widget_show(sidebar_notebook);
359
401
        gtk_notebook_set_tab_pos(GTK_NOTEBOOK(sidebar_notebook), GTK_POS_BOTTOM);
360
 
        
361
 
        gtk_paned_add1(GTK_PANED(w1), sidebar_notebook);
 
402
        gtk_paned_add1(GTK_PANED(sidebar_vpane), sidebar_notebook);
362
403
        
363
404
        /* --- Tree view --- */
364
405
        LOG_PRIMARY_WINDOW_CREATION1 ("Creating overview");
394
435
                                                    primary_window),
395
436
                                  gtk_label_new(_("Raw XML"))
396
437
                                  );
 
438
 
 
439
#if ENABLE_PROPERTY_PAGES
 
440
        /* Property pages for sidebar pane */
 
441
        {
 
442
                primary_window->property_notebook = GTK_NOTEBOOK (gtk_notebook_new());
 
443
                gtk_widget_show (GTK_WIDGET (primary_window->property_notebook));
 
444
                gtk_notebook_set_tab_pos (primary_window->property_notebook, GTK_POS_BOTTOM);
 
445
                gtk_paned_add2 (GTK_PANED(sidebar_vpane), GTK_WIDGET (primary_window->property_notebook));
 
446
 
 
447
                cong_plugin_manager_for_each_service_of_type (cong_app_get_plugin_manager (cong_app_singleton ()),
 
448
                                                              CONG_SERVICE_NODE_PROPERTY_PAGE_TYPE,
 
449
                                                              create_property_page_cb,
 
450
                                                              primary_window);
 
451
        }
 
452
#endif
397
453
        
398
 
                /* Set up the editor_widget v3: */
 
454
        /* Set up the editor_widget v3: */
399
455
#if ENABLE_MAIN_WIDGET
400
456
        {
401
457
                LOG_PRIMARY_WINDOW_CREATION1 ("Creating v3 widget");
416
472
                
417
473
                gtk_paned_add2 (GTK_PANED(w1), 
418
474
                                primary_window->scroller3);
 
475
 
 
476
                gtk_widget_grab_focus (GTK_WIDGET(primary_window->cong_editor_widget3));
419
477
        }
420
478
#endif
421
479
        
581
639
                gtk_window_add_accel_group (GTK_WINDOW (primary_window->window), accel_group);  
582
640
        }
583
641
        
 
642
        cong_menus_setup_recent_files (primary_window);
 
643
 
584
644
        /* --- Toolbar --- */
585
645
        primary_window->toolbar = GTK_TOOLBAR (gtk_ui_manager_get_widget (cong_primary_window_get_ui_manager (primary_window), "/MainToolBar"));
586
646
        gnome_app_set_toolbar(GNOME_APP(primary_window->window), primary_window->toolbar);
684
744
{
685
745
        g_return_if_fail(primary_window);
686
746
 
687
 
        g_message ("cong_primary_window_free");
 
747
        /* g_message ("cong_primary_window_free"); */
688
748
 
689
749
        if (primary_window->doc) {
 
750
                g_signal_handlers_disconnect_by_func (G_OBJECT(primary_window->doc),end_edit_cb, primary_window);
690
751
                g_object_unref(G_OBJECT(primary_window->doc));
691
752
        }
692
753