[gtkmm] Deprecate Gtk::Main in favor of Gtk::Application.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Deprecate Gtk::Main in favor of Gtk::Application.
- Date: Sat, 3 Mar 2012 11:43:19 +0000 (UTC)
commit e8fa79e2f5ddde06a8dc85af7bc4e7769a56daa9
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 2 21:59:41 2012 +0100
Deprecate Gtk::Main in favor of Gtk::Application.
* gtk/src/main.[hg|ccg]: Deprecate most of this API.
* demos/gtk-demo/example_change_display.cc:
* demos/gtk-demo/main.cc: Use Gtk::Application instead of Gtk::Main.
ChangeLog | 8 ++++++
demos/gtk-demo/main.cc | 6 ++--
demos/pixbuf-demo.cc | 6 ++--
gtk/src/main.ccg | 19 ++++++++++------
gtk/src/main.hg | 57 +++++++++++++++++++++++++++++++++++++++--------
5 files changed, 73 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4d14279..49cd2a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-03-02 Murray Cumming <murrayc murrayc com>
+ Deprecate Gtk::Main in favor of Gtk::Application.
+
+ * gtk/src/main.[hg|ccg]: Deprecate most of this API.
+ * demos/gtk-demo/example_change_display.cc:
+ * demos/gtk-demo/main.cc: Use Gtk::Application instead of Gtk::Main.
+
+2012-03-02 Murray Cumming <murrayc murrayc com>
+
ColorSelection*: Document these as deprecated.
* gtk/src/colorselection.hg: Add @deprecated doxygen tags.
diff --git a/demos/gtk-demo/main.cc b/demos/gtk-demo/main.cc
index de08517..c70a568 100644
--- a/demos/gtk-demo/main.cc
+++ b/demos/gtk-demo/main.cc
@@ -24,10 +24,10 @@
int main (int argc, char *argv[])
{
- Gtk::Main kit(argc, argv);
+ Glib::RefPtr<Gtk::Application> app =
+ Gtk::Application::create(argc, argv, "org.gtkmm.demos.demo");
DemoWindow window;
- kit.run(window);
- return 0;
+ return app->run(window);
}
diff --git a/demos/pixbuf-demo.cc b/demos/pixbuf-demo.cc
index b4e4ec3..804b4ac 100644
--- a/demos/pixbuf-demo.cc
+++ b/demos/pixbuf-demo.cc
@@ -192,7 +192,8 @@ int main(int argc, char** argv)
{
try
{
- Gtk::Main main_instance (&argc, &argv);
+ Glib::RefPtr<Gtk::Application> app =
+ Gtk::Application::create(argc, argv, "org.gtkmm.demos.pixbuf-demo");
Gtk::Window window;
window.add(*Gtk::manage(new DemoRenderArea()));
@@ -200,12 +201,11 @@ int main(int argc, char** argv)
window.set_resizable(false);
window.show_all();
- Gtk::Main::run(window);
+ return app->run(window);
}
catch(const Glib::Error& error)
{
std::cerr << error.what() << std::endl;
return EXIT_FAILURE;
}
- return EXIT_SUCCESS;
}
diff --git a/gtk/src/main.ccg b/gtk/src/main.ccg
index 16c7876..64062ad 100644
--- a/gtk/src/main.ccg
+++ b/gtk/src/main.ccg
@@ -33,6 +33,8 @@
#include <gdkmm/wrap_init.h>
#include <gtkmm/wrap_init.h>
+_DEPRECATE_IFDEF_START
+
namespace
{
@@ -202,6 +204,8 @@ void GtkMainConnectionNode::list_notify_all()
} // anonymous namespace
+_DEPRECATE_IFDEF_END
+
namespace Gtk
{
@@ -239,17 +243,12 @@ gint KeySnooperSig::gtk_callback(GtkWidget* widget, GdkEventKey* event, gpointer
return 0;
}
-_DEPRECATE_IFDEF_END
-
/**** Gtk::Main -- static data *********************************************/
-_DEPRECATE_IFDEF_START
KeySnooperSig Main::signal_key_snooper_;
-_DEPRECATE_IFDEF_END
Main* Main::instance_ = 0;
-
/**** Gtk::Main -- construction/destruction ********************************/
Main::Main(int& argc, char**& argv, bool set_locale)
@@ -394,16 +393,19 @@ guint Main::level()
return instance_->level_impl();
}
+_DEPRECATE_IFDEF_END
+
bool Main::iteration(bool blocking)
{
- return instance_->iteration_impl(blocking);
+ return gtk_main_iteration_do(blocking);
}
bool Main::events_pending()
{
- return instance_->events_pending_impl();
+ return gtk_events_pending();
}
+_DEPRECATE_IFDEF_START
/**** Gtk::Main -- static signal accessors *********************************/
@@ -445,5 +447,8 @@ void Main::on_window_hide()
quit_impl();
}
+_DEPRECATE_IFDEF_END
+
} /* namespace Gtk */
+
diff --git a/gtk/src/main.hg b/gtk/src/main.hg
index 63da89b..f0dc988 100644
--- a/gtk/src/main.hg
+++ b/gtk/src/main.hg
@@ -33,10 +33,11 @@ _DEFS(gtkmm,gtk)
#define GDK_DISABLE_DEPRECATION_WARNINGS 1
#m4 _POP()
-
namespace Gtk
{
+_DEPRECATE_IFDEF_START
+
class Widget;
class Window;
@@ -45,7 +46,7 @@ class Window;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//Actually, I'd like to just keep these out of the alphabetical list. murrayc.
-_DEPRECATE_IFDEF_START
+
/// KeySnooper Signal Class (internal)
class KeySnooperSig
{
@@ -57,10 +58,11 @@ public:
protected:
static int gtk_callback(GtkWidget* widget, GdkEventKey* event, gpointer data);
};
-_DEPRECATE_IFDEF_END
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+_DEPRECATE_IFDEF_END
+
//**********************************************************************
@@ -85,11 +87,14 @@ _DEPRECATE_IFDEF_END
* kit.run(window);
* }
* @endcode
+ *
+ * @deprecated Use Gtk::Application instead.
*/
class Main : public sigc::trackable
{
public:
+_DEPRECATE_IFDEF_START
//This offers the same functionality as gtk_init_with_args():
/** Scans the argument vector, and strips off all parameters parsed by GTK+ or your @a option_context.
* Add a Glib::OptionGroup to the Glib::OptionContext to parse your own command-line arguments.
@@ -110,6 +115,8 @@ public:
* @param option_context A Glib::OptionContext containing Glib::OptionGroups which described the command-line arguments taken by your program.
*
* @throw Glib::OptionError
+ *
+ * @deprecated Use Gtk::Application instead.
*/
Main(int& argc, char**& argv, Glib::OptionContext& option_context);
@@ -127,6 +134,8 @@ public:
* setlocale(LC_ALL, ""). You would want to pass false if you wanted to set
* the locale for your program to something other than the user's locale, or
* if you wanted to set different values for different locale categories.
+ *
+ * @deprecated Use Gtk::Application instead.
*/
Main(int* argc, char*** argv, bool set_locale = true);
@@ -139,6 +148,8 @@ public:
* setlocale(LC_ALL, ""). You would want to pass false if you wanted to set
* the locale for your program to something other than the user's locale, or
* if you wanted to set different values for different locale categories.
+ *
+ * @deprecated Use Gtk::Application instead.
*/
Main(int& argc, char**& argv, bool set_locale = true);
@@ -148,19 +159,28 @@ public:
* setlocale(LC_ALL, ""). You would want to pass false if you wanted to set
* the locale for your program to something other than the user's locale, or
* if you wanted to set different values for different locale categories.
+ *
+ * @deprecated Use Gtk::Application instead.
*/
explicit Main(bool set_locale = true);
-
+ /**
+ * @deprecated Use Gtk::Application instead.
+ */
virtual ~Main();
- /// Access to the one global instance of Gtk::Main.
+ /** Access to the one global instance of Gtk::Main.
+ *
+ * @deprecated Use Gtk::Application instead.
+ */
static Gtk::Main* instance();
/** Start the event loop.
* This begins the event loop which handles events. No
* events propagate until this has been called. It may be
* called recursively to popup dialogs
+ *
+ * @deprecated Use Gtk::Application instead.
*/
static void run();
@@ -169,13 +189,20 @@ public:
* the application, but just call hide() on your Window class.
*
* @param window The window to show. This method will return when the window is hidden.
+ *
+ * @deprecated Use Gtk::Application instead.
*/
static void run(Window& window);
/** Makes the innermost invocation of the main loop return when it regains control.
+ *
+ * @deprecated Use Gtk::Application instead.
*/
static void quit();
+ /**
+ * @deprecated Use Gtk::Application instead.
+ */
static guint level();
//This attempts to provide the same functionality as gtk_get_option_group():
@@ -188,9 +215,14 @@ public:
*
* @param option_context Option Context to which the group will be added.
* @param open_default_display Whether to open the default display when parsing the commandline arguments.
+ *
+ * @deprecated Use Gtk::Application instead.
*/
static void add_gtk_option_group(Glib::OptionContext& option_context, bool open_default_display = true);
+_DEPRECATE_IFDEF_END
+
+
/** Runs a single iteration of the main loop.
* If no events are waiting to be processed GTK+ will block until the next event is noticed.
* If you don't want to block then pass false for @a blocking or check if any events are pending with
@@ -217,6 +249,7 @@ public:
static bool events_pending();
_DEPRECATE_IFDEF_START
+
/** KeySnooper signal
* Allows you to channel keypresses to a signal handler
* without registering with the widget.
@@ -230,14 +263,19 @@ _DEPRECATE_IFDEF_START
* @deprecated Key snooping should not be done. Events should be handled by widgets.
*/
static KeySnooperSig& signal_key_snooper();
-_DEPRECATE_IFDEF_END
- // Initialize table of wrap_new functions.
- // Doesn't need an instance of Gtk::Main.
+ /** Initialize the table of wrap_new functions.
+ * This doesn't need an instance of Gtk::Main.
+ *
+ * @deprecated Use Gtk::Application instead.
+ */
static void init_gtkmm_internals();
+_DEPRECATE_IFDEF_END
+
protected:
+_DEPRECATE_IFDEF_START
void init(int* argc, char*** argv, bool set_locale);
// TODO: implement this to use the new Glib::OptionEntry argument parsing classes.
//void init(int* argc, char*** argv, const std::string& parameter_string, const std::vector<const Glib::OptionEntry&>& entries, const std::string& translation_domain);
@@ -251,13 +289,12 @@ protected:
// Signal handlers:
virtual void on_window_hide();
-_DEPRECATE_IFDEF_START
// Signal proxies:
static KeySnooperSig signal_key_snooper_;
-_DEPRECATE_IFDEF_END
private:
static Main* instance_;
+_DEPRECATE_IFDEF_END
};
} // namespace Gtk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]