Added HUP function to dolconf.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Tue, 8 May 2007 02:48:05 +0000 (02:48 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Tue, 8 May 2007 02:48:05 +0000 (02:48 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@1028 959494ce-11ee-0310-bf91-de5d638817bd

config/Makefile.am
config/dolconf-wnd.desc
config/dolconf.c

index 58ed667..db77000 100644 (file)
@@ -27,7 +27,7 @@ dolconf_LDFLAGS=      $(shell pkg-config --libs gtk+-2.0) \
 dolconf_CPPFLAGS=      $(shell pkg-config --cflags gtk+-2.0) \
                        $(shell pkg-config --cflags libxml-2.0) \
                        -DLOCALEDIR=\"$(localedir)\"
-dolconf_LDADD=         $(top_srcdir)/common/libcommon.a
+dolconf_LDADD=         $(top_srcdir)/common/libcommon.a $(top_srcdir)/lib/libdcui.la
 
 %.gtk: %.desc $(top_srcdir)/common/makegdesc
        $(top_srcdir)/common/makegdesc $< >$@
index a52698b..8e7a55c 100644 (file)
@@ -7,6 +7,7 @@
                        :menuitem label: _Main
                                :menu
                                        $smenuitem name: save stock: SAVE sig: activate
+                                       $menuitem name: hup label: "_Apply settings now" sig: activate accel: "CONTROL+A"
                                        $smenuitem name: quit stock: QUIT sig: activate
                                end
                        end
index 38d1367..cd5c5aa 100644 (file)
@@ -31,6 +31,8 @@
 #include <pwd.h>
 #include <stdarg.h>
 #include <arpa/inet.h>
+#include <doldaconnect/uilib.h>
+#include <doldaconnect/uimisc.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -69,6 +71,7 @@ void cb_cfw_orport_toggled(GtkWidget *widget, gpointer uudata);
 void cb_cfw_oraddr_toggled(GtkWidget *widget, gpointer uudata);
 void cb_cfw_uinet_toggled(GtkWidget *widget, gpointer uudata);
 void cb_cfw_save_activate(GtkWidget *widget, gpointer uudata);
+void cb_cfw_hup_activate(GtkWidget *widget, gpointer uudata);
 void cb_cfw_quit_activate(GtkWidget *widget, gpointer uudata);
 void cb_cfw_shareadd_clicked(GtkWidget *widget, gpointer uudata);
 void cb_cfw_sharerem_clicked(GtkWidget *widget, gpointer uudata);
@@ -716,6 +719,29 @@ void cb_cfw_uinet_toggled(GtkWidget *widget, gpointer uudata)
     gtk_widget_set_sensitive(GTK_WIDGET(cfw_uibox), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
 }
 
+void cb_cfw_hup_activate(GtkWidget *widget, gpointer uudata)
+{
+    int tag;
+    struct dc_response *resp;
+    
+    if(dc_connectsync2(dc_srv_local, DC_LATEST) < 0) {
+       msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not connect to server"));
+       return;
+    }
+    if(dc_login(NULL, 1, dc_convnone, NULL) != DC_LOGIN_ERR_SUCCESS) {
+       dc_disconnect();
+       msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not connect to server"));
+       return;
+    }
+    tag = dc_queuecmd(NULL, NULL, L"hup", NULL);
+    if((resp = dc_gettaggedrespsync(tag)) != NULL) {
+       if(resp->code != 200)
+           msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not connect to server"));
+       dc_freeresp(resp);
+    }
+    dc_disconnect();
+}
+
 void cb_cfw_save_activate(GtkWidget *widget, gpointer uudata)
 {
     struct cfvar *cv;
@@ -748,6 +774,7 @@ int main(int argc, char **argv)
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
     prepstatic();
+    dc_init();
     
     gtk_init(&argc, &argv);
     state = -1;