<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
- <widget class="GtkLabel" id="label8">
+ <widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="label" translatable="yes">label8</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">URI : </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="txt_uri">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="btn_get">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">GET</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
</child>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
- <widget class="GtkLabel" id="label9">
+ <widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
- <property name="label" translatable="yes">label9</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTextView" id="txt_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="justification">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap_mode">GTK_WRAP_NONE</property>
+ <property name="cursor_visible">True</property>
+ <property name="pixels_above_lines">0</property>
+ <property name="pixels_below_lines">0</property>
+ <property name="pixels_inside_wrap">0</property>
+ <property name="left_margin">0</property>
+ <property name="right_margin">0</property>
+ <property name="indent">0</property>
+ <property name="text" translatable="yes"></property>
+ </widget>
+ </child>
</widget>
</child>
Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
{
Gtk::MenuItem *conect=0, *exit=0, *about=0;
+ Gtk::Button *btn_get=0;
+ txt_view = 0;
+ txt_get = 0;
+
rg->get_widget("mnu_file_connect", conect);
rg->get_widget("mnu_file_exit", exit);
rg->get_widget("mnu_help_about", about);
rg->get_widget_derived("dlgConectar", dlg_conectar);
+ rg->get_widget("btn_get", btn_get);
+ rg->get_widget("txt_view", txt_view);
+ rg->get_widget("txt_uri", txt_get);
dlg_conectar->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_connect_ok) );
conect->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_connect));
exit->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_exit));
about->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_help_about));
+ btn_get->signal_clicked().connect( SigC::slot(*this, &Principal::on_get_clicked) );
+
+ conexion = NULL;
}
Principal::~Principal()
{
+ delete conexion;
}
void Principal::on_dlg_connect_ok()
{
- std::cout << "Conectando ..." << std::endl;
- std::cout << dlg_conectar->get_server_name() << ":" << dlg_conectar->get_server_port() << std::endl;
+ if (conexion == NULL) {
+ std::cout << "Conectando ..." << std::endl;
+ // Creo la conexion
+ conexion = new PlaQui::Server::ControlClient(dlg_conectar->get_server_name(), dlg_conectar->get_server_port());
+ // Conecto las señales
+ conexion->signal_ok_received().connect( SigC::slot(*this, &Principal::on_conexion_ok) );
+ conexion->signal_error_received().connect( SigC::slot(*this, &Principal::on_conexion_error) );
+ // Lanzo la conexion!
+ conexion->run();
+ } else {
+ std::cout << "Ya estas conectado" << std::endl;
+ }
dlg_conectar->hide();
+
+ // mando algo para ver que me dice
+ PlaQui::Server::Command command("/", "status");
+ conexion->send(command);
}
void Principal::on_mnu_file_exit()
dlg->show();*/
}
+void Principal::on_conexion_ok()
+{
+ txt_view->get_buffer()->insert_at_cursor("El server dice que ta' todo ok!\n");
+}
+
+void Principal::on_conexion_error()
+{
+ txt_view->get_buffer()->insert_at_cursor("El server dice que hay error\n");
+}
+
+void Principal::on_get_clicked()
+{
+ if (conexion == NULL) {
+ txt_view->get_buffer()->insert_at_cursor("SIN CONEXION\n");
+ }
+
+ txt_view->get_buffer()->insert_at_cursor("Enviada URI : ");
+ txt_view->get_buffer()->insert_at_cursor(txt_get->get_text());
+ txt_view->get_buffer()->insert_at_cursor("\n");
+
+ PlaQui::Server::Command command(txt_get->get_text(), "");
+ conexion->send(command);
+
+}
+