Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] (PR#11753) Give embassy button in gtk1 diplomacy dialog
Home

[Freeciv-Dev] (PR#11753) Give embassy button in gtk1 diplomacy dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11753) Give embassy button in gtk1 diplomacy dialog
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sat, 1 Jan 2005 06:05:37 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11753 >

This patch adds "Give embassy" button to the gtk1 diplomacy dialog.
(This makes gtk1 client useable again)
--
mateusz

Tylko w freeciv2/client: freeciv.desktop
diff -ur -Xfreeciv/diff_ignore freeciv/client/gui-gtk/diplodlg.c 
freeciv2/client/gui-gtk/diplodlg.c
--- freeciv/client/gui-gtk/diplodlg.c   2004-07-13 23:54:16.000000000 +0200
+++ freeciv2/client/gui-gtk/diplodlg.c  2004-12-31 11:08:04.000000000 +0100
@@ -66,6 +66,8 @@
   GtkWidget *dip_pact_menu;
   GtkWidget *dip_vision_button0;
   GtkWidget *dip_vision_button1;
+  GtkWidget *dip_embassy_button0;
+  GtkWidget *dip_embassy_button1;
 
   GtkWidget *dip_label;
   GtkWidget *dip_clauselabel;
@@ -108,6 +110,7 @@
 static void diplomacy_dialog_alliance_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_team_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data);
+static void diplomacy_dialog_embassy_callback(GtkWidget *w, gpointer data);
 static void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog);
 static void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog);
 static gint diplomacy_dialog_mbutton_callback(GtkWidget *w, GdkEvent *event);
@@ -454,6 +457,28 @@
   if (gives_shared_vision(plr1, plr0))
     gtk_widget_set_sensitive(pdialog->dip_vision_button1, FALSE);
 
+  pdialog->dip_embassy_button0 = gtk_button_new_with_label(_("Give embassy"));
+  gtk_box_pack_start(GTK_BOX(pdialog->dip_vbox0),
+                    pdialog->dip_embassy_button0,
+                    FALSE, FALSE, 2);
+  gtk_signal_connect(GTK_OBJECT(pdialog->dip_embassy_button0), "clicked",
+                     GTK_SIGNAL_FUNC(diplomacy_dialog_embassy_callback),
+                    (gpointer)pdialog);
+  if (player_has_embassy(plr1, plr0)) {
+    gtk_widget_set_sensitive(pdialog->dip_embassy_button0, FALSE);
+  }
+
+  pdialog->dip_embassy_button1 = gtk_button_new_with_label(_("Give embassy"));
+  gtk_box_pack_start(GTK_BOX(pdialog->dip_vbox1),
+                    pdialog->dip_embassy_button1,
+                    FALSE, FALSE, 2);
+  gtk_signal_connect(GTK_OBJECT(pdialog->dip_embassy_button1), "clicked",
+                     GTK_SIGNAL_FUNC(diplomacy_dialog_embassy_callback),
+                    (gpointer)pdialog);
+  if (player_has_embassy(plr0, plr1)) {
+    gtk_widget_set_sensitive(pdialog->dip_embassy_button0, FALSE);
+  }
+
   /* Start of pact button insertion */
 
   pdialog->dip_pact_menu=gtk_menu_new();
@@ -787,6 +812,19 @@
                                           0);
 }
 
+/****************************************************************
+  Called whenever give embassy button is clicked
+*****************************************************************/
+static void diplomacy_dialog_embassy_callback(GtkWidget *w, gpointer data)
+{
+  struct Diplomacy_dialog *pdialog=(struct Diplomacy_dialog *)data;    
+  struct player *pgiver = (w == pdialog->dip_embassy_button0) ?
+      pdialog->treaty.plr0 : pdialog->treaty.plr1;
+  dsend_packet_diplomacy_create_clause_req(&aconnection,
+                                          pdialog->treaty.plr1->player_no,
+                                          pgiver->player_no, CLAUSE_EMBASSY,
+                                          0);
+}
 
 /****************************************************************
 ...
Tylko w freeciv2/data: Freeciv
Tylko w freeciv2: freeciv.spec

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11753) Give embassy button in gtk1 diplomacy dialog, Mateusz Stefek <=