index 7d2242802ed4f07d955f8c7be03288a1c66a4a90..2483dc50e6b20388ad600baf92086bf2d89e8e96 100644 (file)
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
-/**
- * \brief Base class for dialogs in Inkscape. This class provides certain
- * common behaviors and styles wanted of all dialogs in the application.
- *
- * Authors:
+/** @file
+ * @brief Base class for dialogs in Inkscape - implementation
+ */
+/* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
- * buliabyak@gmail.com
+ * buliabyak@gmail.com
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Gustav Broberg <broberg@kth.se>
*
#include "dialog-manager.h"
#include "modifier-fns.h"
#include "shortcuts.h"
-#include "prefs-utils.h"
+#include "preferences.h"
#include "interface.h"
#include "verbs.h"
namespace Dialog {
void
-sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr)
+sp_retransientize(Inkscape::Application */*inkscape*/, SPDesktop *desktop, gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onDesktopActivated (desktop);
}
void
-sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr)
+sp_dialog_shutdown(GtkObject */*object*/, gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onShutdown();
}
-void hideCallback(GtkObject *object, gpointer dlgPtr)
+void hideCallback(GtkObject */*object*/, gpointer dlgPtr)
{
g_return_if_fail( dlgPtr != NULL );
dlg->onHideF12();
}
-void unhideCallback(GtkObject *object, gpointer dlgPtr)
+void unhideCallback(GtkObject */*object*/, gpointer dlgPtr)
{
g_return_if_fail( dlgPtr != NULL );
*/
Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path, int verb_num,
- Glib::ustring const &apply_label)
+ Glib::ustring const &apply_label)
: _hiddenF12 (false),
_prefs_path (prefs_path),
_verb_num(verb_num),
@@ -109,7 +108,7 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat
_title = title;
_behavior = behavior_factory(*this);
-
+
if (Inkscape::NSApplication::Application::getNewGui()) {
_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*this, &Dialog::onDesktopActivated));
_dialogs_hidden_connection = Inkscape::NSApplication::Editor::connectDialogsHidden (sigc::mem_fun (*this, &Dialog::onHideF12));
_dialogs_unhidden_connection.disconnect();
_shutdown_connection.disconnect();
}
-
+
save_geometry();
delete _behavior;
+ _behavior = 0;
}
_behavior->onDesktopActivated(desktop);
}
-void
+void
Dialog::onShutdown()
{
save_geometry();
{
_user_hidden = false;
- int x = prefs_get_int_attribute (_prefs_path, "x", -1000);
- int y = prefs_get_int_attribute (_prefs_path, "y", -1000);
- int w = prefs_get_int_attribute (_prefs_path, "w", 0);
- int h = prefs_get_int_attribute (_prefs_path, "h", 0);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ int x = prefs->getInt(_prefs_path + "/x", -1000);
+ int y = prefs->getInt(_prefs_path + "/y", -1000);
+ int w = prefs->getInt(_prefs_path + "/w", 0);
+ int h = prefs->getInt(_prefs_path + "/h", 0);
// g_print ("read %d %d %d %d\n", x, y, w, h);
if (w != 0 && h != 0) {
resize(w, h);
}
-
+
// If there are stored values for where the dialog should be
// located, then restore the dialog to that position.
// also check if (x,y) is actually onscreen with the current screen dimensions
if (x<0) x=0;
if (y<0) y=0;
- prefs_set_int_attribute (_prefs_path, "x", x);
- prefs_set_int_attribute (_prefs_path, "y", y);
- prefs_set_int_attribute (_prefs_path, "w", w);
- prefs_set_int_attribute (_prefs_path, "h", h);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt(_prefs_path + "/x", x);
+ prefs->setInt(_prefs_path + "/y", y);
+ prefs->setInt(_prefs_path + "/w", w);
+ prefs->setInt(_prefs_path + "/h", h);
}
}
bool
-Dialog::_onDeleteEvent(GdkEventAny *event)
+Dialog::_onDeleteEvent(GdkEventAny */*event*/)
{
save_geometry();
_user_hidden = true;
event.window = dlg->window;
event.send_event = TRUE;
- if (event.window)
+ if (event.window)
g_object_ref(G_OBJECT(event.window));
gtk_main_do_event ((GdkEvent*)&event);
- if (event.window)
+ if (event.window)
g_object_unref(G_OBJECT(event.window));
}