Code

typo fixed
[inkscape.git] / src / ui / dialog / extension-editor.cpp
index 7cbde9e1fd92a2b7f9aa2403c82c58102894ae43..7df2eaee5954f0882bfcd510afe9e16550f686f9 100644 (file)
@@ -24,6 +24,7 @@
 #include "extension-editor.h"
 #include "verbs.h"
 #include "prefs-utils.h"
+#include "interface.h"
 
 #include "extension/extension.h"
 #include "extension/db.h"
@@ -44,6 +45,9 @@ namespace Dialog {
 ExtensionEditor::ExtensionEditor()
     : Dialog ("dialogs.extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR)
 {
+    _notebook_info.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+    _notebook_help.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+    _notebook_params.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  
     //Main HBox
     Gtk::HBox* hbox_list_page = Gtk::manage(new Gtk::HBox());
@@ -125,14 +129,49 @@ ExtensionEditor::on_pagelist_selection_changed (void)
     Glib::RefPtr<Gtk::TreeSelection> selection = _page_list.get_selection();
     Gtk::TreeModel::iterator iter = selection->get_selected();
     if (iter) {
-        // _page_frame.remove();
+        /* Get the row info */
         Gtk::TreeModel::Row row = *iter;
-        // _current_page = row[_page_list_columns._col_page];
-        // _page_title.set_markup("<span size='large'><b>" + row[_page_list_columns._col_name] + "</b></span>");
-        // _page_frame.add(*_current_page);
-        // _current_page->show();
         Glib::ustring id = row[_page_list_columns._col_id];
+        Glib::ustring name = row[_page_list_columns._col_name];
+
+        /* Set the selection in the preferences */
         prefs_set_string_attribute("dialogs.extensioneditor", "selected-extension", id.c_str());
+
+        /* Adjust the dialog's title */
+        gchar title[500];
+        sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_EXTENSIONEDITOR), title);
+        Glib::ustring utitle(title);
+        set_title(utitle + ": " + name);
+
+        /* Clear the notbook pages */
+        _notebook_info.remove();
+        _notebook_help.remove();
+        _notebook_params.remove();
+
+        Inkscape::Extension::Extension * ext = Inkscape::Extension::db.get(id.c_str());
+
+        /* Make sure we have all the widges */
+        Gtk::Widget * info = NULL;
+        Gtk::Widget * help = NULL;
+        Gtk::Widget * params = NULL;
+
+        if (ext != NULL) {
+            info = ext->get_info_widget();
+            help = ext->get_help_widget();
+            params = ext->get_params_widget();
+        }
+
+        /* Place them in the pages */
+        if (info != NULL) {
+            _notebook_info.add(*info);
+        }
+        if (help != NULL) {
+            _notebook_help.add(*help);
+        }
+        if (params != NULL) {
+            _notebook_params.add(*params);
+        }
+
     }
 
     return;
@@ -174,7 +213,6 @@ ExtensionEditor::add_extension (Inkscape::Extension::Extension * ext)
     Gtk::TreeModel::Row row = *iter;
     row[_page_list_columns._col_name] = ext->get_name();
     row[_page_list_columns._col_id] =   ext->get_id();
-    row[_page_list_columns._col_page] = NULL;
 
     return iter;
 }