File: left_red_button_callback.C

package info (click to toggle)
peruser 4b33-10
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,944 kB
  • ctags: 1,064
  • sloc: cpp: 22,397; perl: 2,733; makefile: 345; sh: 335
file content (44 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "npsummary.h"

void left_red_button_callback( GtkWidget *widget, gpointer data )
{
   NP_Summary *summary = ( NP_Summary *)data;

   if ( !summary->total || summary->tree == NULL )
      return;

   if ( summary->current_node == NULL || summary->selected_item == NULL )
   {
      gtk_tree_select_child( GTK_TREE( summary->tree_widget ),
                             GTK_WIDGET( summary->tree->item ));
   }

   np_thread_node_t *pointer, *old = summary->current_node;

   while(( pointer = left_button_callback( NULL, data )) != NULL )
   {
      if ( pointer->is_article == 0 && pointer->item != NULL )
         break;

      summary->current_node = pointer;
   }
                                        
   if ( pointer != NULL && pointer->is_article == 0 && pointer->item != NULL )
   {
      old = pointer;
      while( old->is_child == 1 )
      {
         old = old->parent;
         gtk_tree_item_expand( GTK_TREE_ITEM( old->item ));
      }
      
      summary->button = 1;
      gtk_tree_select_child( GTK_TREE( summary->tree_widget ),
                             GTK_WIDGET( pointer->item ));
      summary->button = 0;
   }
   else
      summary->current_node = old;

   return;
}