~ubuntu-core-dev/synaptic/ubuntu

« back to all changes in this revision

Viewing changes to gtk/rgmainwindow.cc

  • Committer: mvo
  • Date: 2004-11-21 16:33:06 UTC
  • Revision ID: gustavo@niemeyer.net-20041121163306-1aa02b6941ee8bcf
* removed all GTK_CHECK_VERSION(2,2,0) calls, we only support 2.4 and better
* removed ZvtTerminal support (old, unmaintained, buggy and broken)

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 
100
100
 
101
101
 
102
 
#if ! GTK_CHECK_VERSION(2,2,0)
103
 
// This function is needed to be compatible with gtk 2.0
104
 
// data takes a GList** and fills the list with GtkTreePathes 
105
 
// (just like the return of gtk_tree_selection_get_selected_rows()).
106
 
void cbGetSelectedRows(GtkTreeModel *model,
107
 
                       GtkTreePath *path, GtkTreeIter *iter, gpointer data)
108
 
{
109
 
   GList **list;
110
 
   list = (GList **) data;
111
 
   *list = g_list_append(*list, gtk_tree_path_copy(path));
112
 
}
113
 
#endif
114
102
 
115
103
 
116
104
 
187
175
         ok = gtk_tree_model_iter_next(model, &iter);
188
176
      }
189
177
   } else {
190
 
#if GTK_CHECK_VERSION(2,4,0)
191
178
      // we auto set to "All" when we have gtk2.4 (without the list is 
192
179
      // too slow)
193
180
      GtkTreeModel *model;
198
185
      model = gtk_tree_view_get_model(GTK_TREE_VIEW(_subViewList));
199
186
      gtk_tree_model_get_iter_first(model, &iter);
200
187
      gtk_tree_selection_select_iter(selection, &iter);
201
 
#endif
202
188
   }
203
189
}
204
190
 
215
201
   GList *list = NULL;
216
202
 
217
203
   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(_treeView));
218
 
#if GTK_CHECK_VERSION(2,2,0)
219
204
   list = gtk_tree_selection_get_selected_rows(selection, &_pkgList);
220
 
#else
221
 
   gtk_tree_selection_selected_foreach(selection, cbGetSelectedRows, &list);
222
 
#endif
223
 
 
224
205
   if (list == NULL) // Empty.
225
206
      return NULL;
226
207
 
568
549
 
569
550
   // get list of selected pkgs
570
551
   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(_treeView));
571
 
#if GTK_CHECK_VERSION(2,2,0)
572
552
   list = li = gtk_tree_selection_get_selected_rows(selection, &_pkgList);
573
 
#else
574
 
   li = list = NULL;
575
 
   gtk_tree_selection_selected_foreach(selection, cbGetSelectedRows, &list);
576
 
   li = list;
577
 
#endif
578
553
 
579
554
   // save pkg state
580
555
   RPackageLister::pkgState state;
846
821
                                                  //"text", NAME_COLUMN,
847
822
                                                  "background-gdk",
848
823
                                                  COLOR_COLUMN, NULL);
849
 
#if GTK_CHECK_VERSION(2,3,2)
850
824
      gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
851
825
      gtk_tree_view_column_set_fixed_width(column, 200);
852
 
#else
853
 
      gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
854
 
#endif
855
826
 
856
827
      //gtk_tree_view_insert_column(GTK_TREE_VIEW(_treeView), column, pos);
857
828
      all_columns.push_back(pair<int, GtkTreeViewColumn *>(pos, column));
1015
986
   if (name_column)
1016
987
      gtk_tree_view_set_expander_column(GTK_TREE_VIEW(_treeView), name_column);
1017
988
 
1018
 
#if GTK_CHECK_VERSION(2,4,0)
1019
 
#warning build with new fixed_height_mode
1020
989
   g_object_set(G_OBJECT(_treeView), 
1021
990
                "fixed_height_mode", TRUE,
1022
991
                NULL);
1023
 
#endif
1024
992
 
1025
993
   _pkgList = GTK_TREE_MODEL(gtk_pkg_list_new(_lister));
1026
994
   gtk_tree_view_set_model(GTK_TREE_VIEW(_treeView), _pkgList);
1726
1694
      int viewNr = _config->FindI("Synaptic::ViewMode", 0);
1727
1695
      changeView(viewNr);
1728
1696
 
1729
 
#if GTK_CHECK_VERSION(2,4,0)
1730
1697
      // we auto set to "All" on startup when we have gtk2.4 (without
1731
1698
      // the list is too slow)
1732
1699
      GtkTreeModel *model;
1737
1704
      model = gtk_tree_view_get_model(GTK_TREE_VIEW(_subViewList));
1738
1705
      gtk_tree_model_get_iter_first(model, &iter);
1739
1706
      gtk_tree_selection_select_iter(selection, &iter);
1740
 
#endif
1741
1707
   }
1742
1708
   updatePackageInfo(NULL);
1743
1709
   return true;
1781
1747
      gdk_window_set_cursor(_win->window, NULL);
1782
1748
   }
1783
1749
 
1784
 
#if GTK_CHECK_VERSION(2,4,0)
1785
1750
   // fast enough with the new fixed-height mode
1786
1751
   while (gtk_events_pending())
1787
1752
      gtk_main_iteration();
1788
 
#else
1789
 
   // because of the comment above, we only do 5 iterations now
1790
 
   //FIXME: this is more a hack than a real solution
1791
 
   for (int i = 0; i < 5; i++) {
1792
 
      if (gtk_events_pending())
1793
 
         gtk_main_iteration();
1794
 
   }
1795
 
#endif
1796
1753
}
1797
1754
 
1798
1755
void RGMainWindow::setTreeLocked(bool flag)
2343
2300
      cerr << "selectedRow(): me->_pkgTree == NULL " << endl;
2344
2301
      return;
2345
2302
   }
2346
 
#if GTK_CHECK_VERSION(2,2,0)
2347
2303
   list = li = gtk_tree_selection_get_selected_rows(selection, &me->_pkgList);
2348
 
#else
2349
 
   li = list = NULL;
2350
 
   gtk_tree_selection_selected_foreach(selection, cbGetSelectedRows, &list);
2351
 
   li = list;
2352
 
#endif
2353
2304
 
2354
2305
   // list is empty
2355
2306
   if (li == NULL) {
2552
2503
#else
2553
2504
   bool UseTerminal = true;
2554
2505
#endif
2555
 
   RGZvtInstallProgress *zvt = NULL;
 
2506
   RGTermInstallProgress *term = NULL;
2556
2507
   if (_config->FindB("Synaptic::UseTerminal", UseTerminal) == true)
2557
 
      iprogress = zvt = new RGZvtInstallProgress(me);
 
2508
      iprogress = term = new RGTermInstallProgress(me);
2558
2509
   else
2559
2510
#endif
2560
2511
#ifdef HAVE_RPM
2567
2518
   me->_lister->commitChanges(fprogress, iprogress);
2568
2519
 
2569
2520
#ifdef HAVE_TERMINAL
2570
 
   // wait until the zvt dialog is closed
2571
 
   if (zvt != NULL) {
2572
 
      while (GTK_WIDGET_VISIBLE(GTK_WIDGET(zvt->window()))) {
 
2521
   // wait until the term dialog is closed
 
2522
   if (term != NULL) {
 
2523
      while (GTK_WIDGET_VISIBLE(GTK_WIDGET(term->window()))) {
2573
2524
         RGFlushInterface();
2574
2525
         usleep(100000);
2575
2526
      }
2824
2775
 
2825
2776
   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(me->_treeView));
2826
2777
   GList *li, *list;
2827
 
#if GTK_CHECK_VERSION(2,2,0)
 
2778
 
2828
2779
   list = li = gtk_tree_selection_get_selected_rows(selection, &me->_pkgList);
2829
 
#else
2830
 
   li = list = NULL;
2831
 
   gtk_tree_selection_selected_foreach(selection, cbGetSelectedRows, &list);
2832
 
   li = list;
2833
 
#endif
2834
2780
   if (li == NULL)
2835
2781
      return;
2836
2782