[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp
From:       Alexander Dymo <cloudtemple () mksat ! net>
Date:       2005-11-09 22:02:44
Message-ID: 1131573764.848431.19817.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 479275 by dymo:

Backport the gtkmm template fix because this template was completely broken on all
modern distros.


 M  +1 -2      configure.in  
 M  +3 -4      gtk2mm.cc  
 M  +6 -0      gtk2mm.glade  
 M  +1 -0      gtk2mm.gladep  
 M  +2 -5      main_window.cc  
 M  +2 -2      main_window.hh  
 M  +21 -10    main_window_glade.cc  
 M  +10 -11    main_window_glade.hh  


--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/configure.in #479274:479275
@@ -14,7 +14,6 @@
 
 AC_LANG_CPLUSPLUS
 
-AM_PATH_GTKMM(1.2.8,,
-	AC_MSG_ERROR(Cannot find a matching GTK-- library: Please install version 1.2.8 or newer))
+PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.8.0])
 
 AC_OUTPUT(Makefile src/Makefile )
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc #479274:479275
@@ -1,6 +1,6 @@
 %{CC_TEMPLATE}
 
-#include <gtk--/main.h>
+#include <gtkmm/main.h>
 
 #include "main_window.hh"
 
@@ -9,8 +9,7 @@
    
    Gtk::Main m(&argc, &argv);
 
-   main_window *main_window = new class main_window();
-   m.run();
-   delete main_window;
+   main_window main_window;
+   Gtk::Main::run(main_window);
    return 0;
 }
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/gtk2mm.glade #479274:479275
@@ -14,6 +14,12 @@
   <property name="modal">False</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <signal name="delete_event" handler="quit"/>
 
   <child>
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/gtk2mm.gladep #479274:479275
@@ -6,4 +6,5 @@
   <program_name>%{APPNAMELC}</program_name>
   <language>C++</language>
   <gnome_support>FALSE</gnome_support>
+  <gettext_support>FALSE</gettext_support>
 </glade-project>
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/main_window.cc #479274:479275
@@ -7,9 +7,6 @@
 #include "config.h"
 #include "main_window.hh"
 
-#include <gtk--/main.h>
-
-gint main_window::quit(GdkEventAny *ev)
-{
-    Gtk::Main::quit();
+bool main_window::quit(GdkEventAny *ev)
+{  return 0;
 }
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/main_window.hh #479274:479275
@@ -13,7 +13,7 @@
 #  define _MAIN_WINDOW_HH
 class main_window : public main_window_glade
 {
-protected:
-        virtual gint quit(GdkEventAny *ev);
+
+        bool quit(GdkEventAny *ev);
 };
 #endif
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc #479274:479275
@@ -1,27 +1,38 @@
 %{CC_TEMPLATE}
 
-// DO NOT EDIT THIS FILE ! It was created using
-// glade-- /home/amp8165/Projects/gtk2mm/gtk2mm.glade
-// for gtk 2.2.4 and gtkmm 1.2.10
+// DO NOT EDIT THIS FILE ! It was created using glade-- 
+// for gtk 2.8.3 and gtkmm 2.8.0
 //
 // Please modify the corresponding derived classes in ./src/main_window.cc
 
+
+#if defined __GNUC__ && __GNUC__ < 3
+#error This program will crash if compiled with g++ 2.x
+// see the dynamic_cast bug in the gtkmm FAQ
+#endif //
 #include "config.h"
+#include <gtkmmconfig.h>
+#if GTKMM_MAJOR_VERSION==2 && GTKMM_MINOR_VERSION>2
+#include <sigc++/compatibility.h>
+#define GMM_GTKMM_22_24(a,b) b
+#else //gtkmm 2.2
+#define GMM_GTKMM_22_24(a,b) a
+#endif //
 #include "main_window_glade.hh"
 #include <gdk/gdkkeysyms.h>
-#include <gtk--/accelgroup.h>
+#include <gtkmm/accelgroup.h>
 
 main_window_glade::main_window_glade(
-) : Gtk::Window(GTK_WINDOW_TOPLEVEL)
+) : Gtk::Window(Gtk::WINDOW_TOPLEVEL)
 {  main_window = this;
-   
-   Gtk::AccelGroup *main_window_accgrp = Gtk::AccelGroup::create();
-   gmm_data = new GlademmData(main_window_accgrp);
+   gmm_data = new GlademmData(get_accel_group());
    main_window->set_title("%{APPNAME} Project");
    main_window->set_modal(false);
-   main_window->add_accel_group(*(gmm_data->getAccelGroup()));
+   main_window->property_window_position().set_value(Gtk::WIN_POS_CENTER);
+   main_window->set_resizable(true);
+   main_window->property_destroy_with_parent().set_value(false);
    main_window->show();
-   main_window->delete_event.connect(SigC::slot(this, &main_window_glade::quit));
+   main_window->signal_delete_event().connect(SigC::slot(*this, &main_window_glade::quit), false);
 }
 
 main_window_glade::~main_window_glade()
--- branches/KDE/3.5/kdevelop/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh #479274:479275
@@ -1,8 +1,7 @@
 %{HH_TEMPLATE}
 
-// DO NOT EDIT THIS FILE ! It was created using
-// glade-- /home/amp8165/Projects/gtk2mm/gtk2mm.glade
-// for gtk 2.2.4 and gtkmm 1.2.10
+// DO NOT EDIT THIS FILE ! It was created using glade--
+// for gtk 2.8.3 and gtkmm 2.8.0
 //
 // Please modify the corresponding derived classes in ./src/main_window.hh and./src/main_window.cc
 
@@ -12,38 +11,38 @@
 
 #if !defined(GLADEMM_DATA)
 #define GLADEMM_DATA 
-#include <gtk--/accelgroup.h>
+#include <gtkmm/accelgroup.h>
 
 class GlademmData
 {  
         
-        Gtk::AccelGroup *accgrp;
+        Glib::RefPtr<Gtk::AccelGroup> accgrp;
 public:
         
-        GlademmData(Gtk::AccelGroup *ag) : accgrp(ag)
+        GlademmData(Glib::RefPtr<Gtk::AccelGroup> ag) : accgrp(ag)
         {  
         }
         
-        Gtk::AccelGroup * getAccelGroup()
+        Glib::RefPtr<Gtk::AccelGroup>  getAccelGroup()
         {  return accgrp;
         }
 };
 #endif //GLADEMM_DATA
 
-#include <gtk--/window.h>
+#include <gtkmm/window.h>
 
 class main_window_glade : public Gtk::Window
 {  
         
         GlademmData *gmm_data;
 public:
-        class Gtk::Window *main_window;
+        class Gtk::Window * main_window;
 protected:
         
         main_window_glade();
         
         ~main_window_glade();
-
-        virtual gint quit(GdkEventAny *ev) = 0;
+private:
+        virtual bool quit(GdkEventAny *ev) = 0;
 };
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic