Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#6798) meeting players from the players' dialog
Home

[Freeciv-Dev] (PR#6798) meeting players from the players' dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#6798) meeting players from the players' dialog
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Wed, 31 Mar 2004 16:13:45 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6798 >

> [i-freeciv-lists@xxxxxxxxxxxxx - Sun Nov 09 13:11:24 2003]:
> 
> On Sat, Nov 08, 2003 at 01:45:19AM -0800, Christian Knoke wrote:
> > 
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=6798 >
> > 
> > On Fri, Nov 07, 2003 at 08:09:49PM -0800, Jason Short wrote:
> > > 
> > > <URL: http://rt.freeciv.org/Ticket/Display.html?id=6798 >
> > > 
> > > In the players' dialog, you should be able to double-click on a player
> > > to meet with them.  Having to choose an item from the menu is just too
> > > much work.
> > 
> > In GTK 1.2, a double click on a player should present the intelligence
> > dialog, IMHO. I use this more often than 'meeting'. Plus, it is less
> > intrusive, if you do it accidently, no one is disturbed.
> 
> I vote for double-click == meeting for AI players.

Double-click on left mouse button, intel dialog. Double-click on right
mouse button, meeting dialog.

Patch attached.
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.31
diff -u -r1.31 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 31 Jan 2004 17:52:40 -0000      1.31
+++ client/gui-gtk-2.0/plrdlg.c 1 Apr 2004 00:12:16 -0000
@@ -154,6 +154,38 @@
 /**************************************************************************
 ...
 **************************************************************************/
+static gboolean button_press_callback(GtkTreeView *view, GdkEventButton *ev)
+{
+  if (ev->type == GDK_2BUTTON_PRESS) {
+    GtkTreePath *path;
+
+    gtk_tree_view_get_cursor(view, &path, NULL);
+    if (path) {
+      GtkTreeIter it;
+      gint id;
+      struct player *plr;
+
+      gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &it, path);
+      gtk_tree_path_free(path);
+
+      gtk_tree_model_get(GTK_TREE_MODEL(store), &it, PLRNO_COLUMN, &id, -1);
+      plr = get_player(id);
+
+      if (ev->button == 1) {
+       if (can_intel_with_player(plr)) {
+         popup_intel_dialog(plr);
+       }
+      } else {
+       dsend_packet_diplomacy_init_meeting_req(&aconnection, id);
+      }
+    }
+  }
+  return FALSE;
+}
+
+/**************************************************************************
+...
+**************************************************************************/
 void create_players_dialog(void)
 {
   static char *titles[NUM_COLUMNS] = {
@@ -229,7 +261,9 @@
 
   players_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(players_list));
   g_signal_connect(players_selection, "changed",
-        G_CALLBACK(selection_callback), NULL);
+      G_CALLBACK(selection_callback), NULL);
+  g_signal_connect(players_list, "button_press_event",
+      G_CALLBACK(button_press_callback), NULL);
 
   for (i = 0; i < NUM_COLUMNS; i++) {
     GtkCellRenderer *renderer;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#6798) meeting players from the players' dialog, Vasco Alexandre da Silva Costa <=