Hi I recently tried to update this application to gtkmm4, however I am not finding anyway to have the widgets shown in the application. I have found that the function show_al() has been removed because the widgets now are to be visible by default, so I really don't understand why.
main:
#include <iostream>
#include "config.h"
#ifdef ENABLE_NLS
# include <libintl.h>
#endif
#include "u-i-controller.h"
/* For testing propose use the local (not installed) ui file */
/* #define UI_FILE PACKAGE_DATA_DIR"/ui/time_keeper.ui" */
#define UI_FILE "src/time_keeper.ui"
Gtk::ApplicationWindow * main_win = nullptr;
Glib::RefPtr<Gtk::Builder> builder = nullptr;
void activate_app(Gtk::Application * app)
{
app->add_window(*main_win);
//Load the Glade file and instiate its widgets:
try
{
builder = Gtk::Builder::create_from_file(UI_FILE);
main_win = (Gtk::ApplicationWindow*) builder->get_widget<Gtk::ApplicationWindow>("main_window");
}
catch (const Glib::FileError & ex)
{
std::cerr << ex.what() << std::endl;
}
main_win->show();
//return app->run(helloworld, argc, argv);
//main_win->show_all_children ();
//main_win->show_all_children ()
}
int
main (int argc, char *argv[])
{
auto app = Gtk::Application::create("org.gtkmm.time_keeper");
return app->make_window_and_run<Gtk::ApplicationWindow>(argc, argv);
if (main_win)
{
app->signal_startup().connect(sigc::bind<0/*,Gtk::Application**/>(sigc::ptr_fun(&activate_app), app.get() ) );
UI_Controller * controller = new UI_Controller(builder.get(),app.get());
}
}
ui file:
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkApplicationWindow" id="main_window">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">13</property>
<property name="homogeneous">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="focusable">1</property>
<!--property name="shadow-type">in</property-->
<property name="child">
<object class="GtkViewport">
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">current activity time</property>
</object>
</child>
<child>
<object class="GtkGrid" id="timer_grid">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkEntry">
<property name="focusable">1</property>
<property name="hexpand">1</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="start_timer">
<property name="label" translatable="yes">Start</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="stop_timer">
<property name="label" translatable="yes">Stop</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="restart_timer">
<property name="label" translatable="yes">Restart</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">2</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="add_timer">
<property name="label" translatable="yes">+</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">3</property>
<property name="row">0</property>
<property name="row-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="timer_display">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="focusable">1</property>
<!--property name="shadow-type">in</property-->
<property name="child">
<object class="GtkViewport">
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">activity limit</property>
</object>
</child>
<child>
<object class="GtkGrid" id="counter_grid">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkEntry">
<property name="focusable">1</property>
<property name="hexpand">1</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
<property name="column-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Start</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Stop</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Restart</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">2</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">+</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<layout>
<property name="column">3</property>
<property name="row">0</property>
<property name="row-span">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="focusable">1</property>
<property name="hexpand">1</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</interface>
those are the most warnings that I receive but I dont think it has much to do with it:
(time_keeper:620): Gtk-WARNING **: 17:22:19.139: Unknown key gtk-menu-images in ~/.config/gtk-4.0/settings.ini
(time_keeper:620): Gtk-WARNING **: 17:22:19.139: Unknown key gtk-toolbar-style in ~/.config/gtk-4.0/settings.ini
Related
I am downloading image to local folder by using WSO2 EI File Connector, Image getting downloaded successfully but it is not viewable. Anyone please help me?
getting image URL(eg. https://carsales.pxcrush.net/dealerweb/car/cil/cc5754691391091045492.jpg) from Database.
getting base64 content from imageURL
then inserting those content into local folder using file connector.
Note: Bae64 comes from API which is not included here. base64 content is correct only, because i can get exact image from this base64 by using base64 to Image converter
Added below in axis2.xml file.
<messageFormatter contentType="application/octet-stream" class="org.apache.axis2.format.BinaryFormatter"/>
<messageBuilder contentType="application/octet-stream" class="org.apache.axis2.format.BinaryBuilder"/>
Code Snippet:
<sequence name="DownloadImageFileSequnce" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="===DownloadImageFileSequnce" value="called=="/>
</log>
<property value="D:\Test\CarSalesStockImages" name="PATH"/>
<property expression="get-property('StockNo')" name="FOLDERNAME"/>
<property expression="get-property('eachImageName')" name="FILENAME"/>
<property expression="get-property('image_val')" name="CONTENT"/>
<!-- <property name="messageType" value="application/octet-stream" scope="axis2"/> -->
<property expression="fn:concat('file://',$ctx:PATH,'/',$ctx:FOLDERNAME,'/',$ctx:FILENAME)" name="source"/>
<log level="custom">
<!-- <property name="===CONTENT===" expression="get-property('CONTENT')"/> -->
<property name="===PATH===" expression="get-property('PATH')"/>
<property name="===FOLDERNAME===" expression="get-property('FOLDERNAME')"/>
<property name="===FILENAME===" expression="get-property('FILENAME')"/>
<property name="===source===" expression="get-property('source')"/>
</log>
<fileconnector.isFileExist>
<source>{$ctx:source}</source>
</fileconnector.isFileExist>
<property expression="json-eval($.fileExist)" name="exists" type="BOOLEAN"/>
<filter xpath="$ctx:exists">
<then>
<fileconnector.append>
<destination>{$ctx:source}</destination>
<inputContent>{$ctx:CONTENT}</inputContent>
</fileconnector.append>
<payloadFactory media-type="json">
<format>{"status":"File updated"}</format>
<args/>
</payloadFactory>
<log level="custom">
<property name="==Response==" expression="json-eval($.)"/>
</log>
</then>
<else>
<fileconnector.create>
<source>{$ctx:source}</source>
<inputContent>{$ctx:CONTENT}</inputContent>
</fileconnector.create>
<payloadFactory media-type="json">
<format>{"status":"File created"}</format>
<args/>
</payloadFactory>
<log level="custom">
<property name="==Response==" expression="json-eval($.)"/>
</log>
</else>
</filter>
</sequence>
I have found solution by using vfs instead of wso2 file connector.
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="DownloadImageFileSequnce" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="===DownloadImageFileSequnce" value="called=="/>
</log>
<property name="PATH" scope="default" type="STRING" value="D:\Test\CarSalesStockImages"/>
<property expression="get-property('StockNo')" name="FOLDERNAME" scope="default" type="STRING"/>
<property expression="get-property('eachImageName')" name="FILENAME" scope="default" type="STRING"/>
<property expression="get-property('image_val')" name="CONTENT" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<ns:binary xmlns:ns="http://ws.apache.org/commons/ns/payload">$1</ns:binary>
</format>
<args>
<arg evaluator="xml" expression="$ctx:CONTENT"/>
</args>
</payloadFactory>
<script language="js"><![CDATA[var binaryNode =
mc.getEnvelope().getBody().getFirstElement().getFirstOMChild();
binaryNode.setBinary(true);]]></script>
<!-- <property expression="concat($ctx:PATH,'/',$ctx:FOLDERNAME,'/',$ctx:FILENAME)" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/> -->
<property expression="concat('vfs:file:///',$ctx:PATH,'/',$ctx:FOLDERNAME,'/',$ctx:FILENAME)" name="localpath"/>
<header name="To" expression="get-property('localpath')"/>
<log level="custom">
<property expression="$ctx:localpath" name="==ReplyFileName==="/>
</log>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property action="remove" name="REST_URL_POSTFIX" scope="axis2"/>
<property name="messageType" scope="axis2" type="STRING" value="application/octet-stream"/>
<call/>
<payloadFactory media-type="json">
<format>
{
"status": "success",
"statusMessage" : "Image downloaded"
}
</format>
<args/>
</payloadFactory>
<log level="custom">
<property expression="json-eval($.)" name="Response"/>
</log>
</sequence>
I'm trying to prototype a simple block diagram editor in Ruby Gtk3 on Linux. It seems to me that my use of Gtk/Cairo is either not adequate, or I hit a memory leak.
The symptoms are the following: when I create a graphical object (rectangle) and move it, my memory usage rapidly increases as shown below.
The problem is the use of Gtk3::DrawingArea.queue_draw.
What I am missing?
My versions are the following:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
gtk3 (3.2.7)
require 'gtk3'
BLUE = [0.1,0.0,0.7]
class Rectangle
attr_accessor :x,:y,:w,:h
attr_accessor :color
def initialize x,y,w,h
#x,#y,#w,#h= x,y,w,h
#color=BLUE
end
def draw ctx
ctx.set_source_rgb *color
ctx.rectangle x,y,w,h
ctx.fill
end
end
class Drawer
def initialize
init_gui
#grobs=[]
#on_rect=nil
end
def init_gui
builder = Gtk::Builder.new
builder.add_from_file('drawing.glade')
#window = builder['applicationwindow2']
#window.signal_connect('destroy'){Gtk.main_quit}
#drawingArea = builder['drawingarea']
init_event_handlers
#window.present
end
def init_event_handlers
#drawingArea.signal_connect "draw" do
ctx=#drawingArea.window.create_cairo_context
redraw
end
#drawingArea.signal_connect("button-press-event") do |widget, event|
puts "mouse pressed"
if #on_rect
#moving=true
else
#grobs << Rectangle.new(event.x,event.y,50,50)
redraw
end
end
#drawingArea.signal_connect("motion-notify-event") do |widget, event|
puts "moving rect" if #moving
if #moving
#on_rect.x=event.x+#dx
#on_rect.y=event.y+#dy
#drawingArea.queue_draw
else
if #on_rect=on_rect?(event)
#dx,#dy=#on_rect.x-event.x,#on_rect.y-event.y
w,h=#on_rect.w,#on_rect.h
#drawingArea.queue_draw
end
end
end
#drawingArea.signal_connect("button-release-event") do |widget, event|
puts "mouse released"
#moving=false
#on_rect=nil
redraw
end
def on_rect? event
for rect in #grobs
if event.x>rect.x && event.x < rect.x+rect.w
if event.y>rect.y && event.y < rect.y+rect.h
return rect
end
end
end
nil
end
end
def redraw
ctx=#drawingArea.window.create_cairo_context
#grobs.each{|grob| grob.draw(ctx)}
end
end #class
Drawer.new
Gtk.main
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkApplicationWindow" id="applicationwindow2">
<property name="name">app_window</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">drawing_2</property>
<property name="has_resize_grip">True</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem1">
<property name="label">gtk-new</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem2">
<property name="label">gtk-open</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem3">
<property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem4">
<property name="label">gtk-save-as</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem5">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem6">
<property name="label">gtk-cut</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem7">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem8">
<property name="label">gtk-paste</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem9">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem10">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="drawingarea">
<property name="name">drawing_area</property>
<property name="width_request">1000</property>
<property name="height_request">600</property>
<property name="visible">True</property>
<property name="app_paintable">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="margin_left">9</property>
<property name="margin_right">10</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<signal name="drag-begin" handler="drag" swapped="no"/>
<signal name="drag-motion" handler="drag" swapped="no"/>
<signal name="scroll-event" handler="scroll" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
I have no idea about Ruby memory management, but I suggest you use the Cairo context that Gtk gives you, instead of creating your own:
--- test.rb.orig 2018-07-28 08:04:24.958448613 +0200
+++ test.rb 2018-07-28 08:05:11.889968403 +0200
## -38,9 +38,8 ## class Drawer
def init_event_handlers
- #drawingArea.signal_connect "draw" do
- ctx=#drawingArea.window.create_cairo_context
- redraw
+ #drawingArea.signal_connect "draw" do |widget, ctx|
+ #grobs.each{|grob| grob.draw(ctx)}
end
#drawingArea.signal_connect("button-press-event") do |widget, event|
I reported this issue to the maintainer (kou). The thread is here. This is really a bug (unnecessary object copies). Thanks to him, it is now fixed. The bug fix is here. This fix requires cairo >=1.15.14.
I want to make a remote control for my PC. Basically all I need is to run a command on a button click. Following this guide I managed to build the layout and it's everything i've ever dreamed of.
But when I try to run it using
gtkdialog -g test.glade -p MainWindow
this happens
(gtkdialog:18284): libglade-WARNING **: Expected <glade-interface>. Got <interface>.
(gtkdialog:18284): libglade-WARNING **: did not finish in PARSER_FINISH state
(gtkdialog:18284): libglade-CRITICAL **: glade_xml_get_widget: assertion 'self != NULL' failed
(gtkdialog:18284): ERROR **: Can not load 'MainWindow' from file 'test.glade'
And after that nothing really happens..
Is there a easier way to do this?
My idea is to put that program on a separate virtual screen and access it using my cellphone.
That's the glade file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="LvUP">
<property name="label" translatable="yes">Left Channel UP</property>
<property name="width_request">217</property>
<property name="height_request">154</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 5%+,0%-" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="VolUp">
<property name="label" translatable="yes">Vol UP</property>
<property name="width_request">217</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="pactl set-sink-volume 0 +5%" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="RvUP">
<property name="label" translatable="yes">Right Channel UP</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 0%-,5%+" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="prev">
<property name="label">gtk-media-previous</property>
<property name="height_request">154</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="play">
<property name="label" translatable="yes">Play / Pause</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="clementine -t" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="next">
<property name="label">gtk-media-next</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="clementine -f" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="LvDown">
<property name="label" translatable="yes">Left Channel Down</property>
<property name="height_request">154</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 5%-,0%-" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="VolDown">
<property name="label" translatable="yes">Vol Down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="pactl set-sink-volume 0 -5%" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="RvDown">
<property name="label" translatable="yes">Right Channel Down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 0%-,5%-" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="mute">
<property name="label" translatable="yes">Mute</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="foff">
<property name="label" translatable="yes">Hello Darkness, My Old Friend | foff</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="hib">
<property name="label" translatable="yes">Hib3rnate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
gtkdialog is an old dead project that does not support the modern gtkbuilder syntax that glade uses. It should be avoided and you should make the application in a language such as python or gjs which has official bindings.
My springcontext-notification XML:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
<bean
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="notificationJmsConnectionFactory" />
<property name="destinationName" value="${bpm.task.queue}" />
<property name="messageListener" ref="taskMessageReceiver" />
<property name="sessionTransacted" value="true" />
<property name="clientId" value="BPMTaskMessageLisetners" />
<property name="transactionManager" ref="transactionManager" />
<property name="maxConcurrentConsumers" value="${bpm.task.queue.listener.concurrency}" />
</bean>
<bean id="taskMessageReceiver"
class="com.sterling.ag.jms.impl.TaskMessageListenerImpl">
</bean>
<bean id="notificationJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="notificationJmsConnectionFactory" />
<property name="sessionTransacted" value="true" />
</bean>
<jee:jndi-lookup id="notificationJmsConnectionFactory"
jndi-name="java:/JmsXA">
<!--
<jee:environment>java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory</jee:environment>
-->
</jee:jndi-lookup>
<alias name="notificationJmsTemplate" alias="auditJmsTemplate" />
<alias name="notificationJmsTemplate" alias="historyExchangeJmsTemplate" />
</beans>
I have added another queue. How should i configure it in the above XML??
You need to create a separate container and listener
<bean
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="notificationJmsConnectionFactory" />
<property name="destinationName" value="${bpm.task.queue2}" />
<property name="messageListener" ref="taskMessageReceiver2" />
<property name="sessionTransacted" value="true" />
<property name="clientId" value="BPMTaskMessageLisetners" />
<property name="transactionManager" ref="transactionManager" />
<property name="maxConcurrentConsumers" value="${bpm.task.queue.listener.concurrency2}" />
</bean>
<bean id="taskMessageReceiver2"
class="com.sterling.ag.jms.impl.TaskMessageListenerImpl2">
</bean>
I am using Spring.Data.NHibernate12 on my database level.my application connection with database is not getting released.Sometime in Nhibernate log i am getting
set transaction must be first statement of transaction .Setting transaction tag on top of the function.
Underneath given is Dataconfiguration.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database">
<object id="AuditLogger" type="Risco.Rsp.Ac.Audit.AuditLogger, Risco.Rsp.Ac.Audit" singleton="false">
<property name="CacheSettings" ref="CacheSettings"/>
</object>
<object id="CacheSettings"
type="Risco.Rsp.Ac.AMAC.CacheMgmt.Utilities.UpdateEntityCacheHelper, Risco.Rsp.Ac.AMAC.CacheMgmt.Utilities" singleton="false"/>
<object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
<property name="ConfigSections" value="databaseSettings"/>
</object>
<db:provider id="AMACDbProvider"
provider="OracleClient-2.0"
connectionString="Data Source=RISCODEVDB;User ID=amsbvt; Password=amsuser1234;"/>
<!-- For creating Factory objects -->
<object id="NHibernateSessionFactory"
type="Spring.Data.NHibernate.LocalSessionFactoryObject,Spring.Data.NHibernate12">
<property name="DbProvider" ref="AMACDbProvider"/>
<property name="MappingAssemblies">
<list>
<value>Risco.Rsp.Ac.AMAC.Mapping</value>
<value>Risco.Rsp.Ac.Logging.Appenders</value>
<value>Risco.Rsp.Ac.AMAC.CacheMappings</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.Oracle9Dialect"/>
<entry key="hibernate.connection.driver_class"
value="NHibernate.Driver.OracleClientDriver"/>
</dictionary>
</property>
</object>
<object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate" singleton="false">
<property name="SessionFactory" ref="NHibernateSessionFactory" />
<property name="TemplateFlushMode" value="Auto" />
<property name="CacheQueries" value="true" />
<property name="EntityInterceptor" ref="AuditLogger"/>
</object>
<!-- To make use of spring's + nHibernate transaction management-->
<object id="transactionManager" singleton="true" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate12">
<property name="DbProvider" ref="AMACDbProvider"/>
<property name="SessionFactory" ref="NHibernateSessionFactory"/>
<property name="EntityInterceptor" ref="AuditLogger"/>
</object>
<object id="CategoryDAOTx" type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject,Spring.Data">
<property name="PlatformTransactionManager" ref="transactionManager"/>
<property name="Target" ref="SendConfigDataDAO"/>
<property name="TransactionAttributes">
<name-values>
<add key="Save" value="PROPAGATION_REQUIRED"/>
<add key="Delete" value="PROPAGATION_REQUIRED"/>
<add key="SaveOrUpdate" value="PROPAGATION_REQUIRED"/>
<add key="FetchForUpdate" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>
<object id="SendConfigDataDAO" type="Risco.Rsp.Ac.AMAC.DAO.SendConfigDataMgmt.SendConfigDataDAO,Risco.Rsp.Ac.AMAC.DAO.SendConfigDataMgmt">
<property name="HibernateTemplate" ref="HibernateTemplate" />
<property name="SessionFactory" ref="NHibernateSessionFactory"/>
</object>
<!--<tx:attribute-driven/>-->
</objects>
First of all, you need to update the NHibernate to 3 version.
Instead of using Spring.Data.NHibernate12, you must use Spring.Data.NHibernate30.
I am working with it very well.
Regards,