OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/gtk/task_manager_gtk.h" | 5 #include "chrome/browser/gtk/task_manager_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 GTK_TREE_VIEW(treeview_)); | 479 GTK_TREE_VIEW(treeview_)); |
480 gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); | 480 gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); |
481 g_signal_connect(selection, "changed", | 481 g_signal_connect(selection, "changed", |
482 G_CALLBACK(OnSelectionChangedThunk), this); | 482 G_CALLBACK(OnSelectionChangedThunk), this); |
483 | 483 |
484 gtk_container_add(GTK_CONTAINER(scrolled), treeview_); | 484 gtk_container_add(GTK_CONTAINER(scrolled), treeview_); |
485 | 485 |
486 SetInitialDialogSize(); | 486 SetInitialDialogSize(); |
487 gtk_util::ShowDialog(dialog_); | 487 gtk_util::ShowDialog(dialog_); |
488 | 488 |
| 489 // If the model already has resources, we need to add them before we start |
| 490 // observing events. |
| 491 if (model_->ResourceCount() > 0) { |
| 492 OnItemsAdded(0, model_->ResourceCount()); |
| 493 } |
| 494 |
489 model_->AddObserver(this); | 495 model_->AddObserver(this); |
490 } | 496 } |
491 | 497 |
492 void TaskManagerGtk::SetInitialDialogSize() { | 498 void TaskManagerGtk::SetInitialDialogSize() { |
493 // Hook up to the realize event so we can size the page column to the | 499 // Hook up to the realize event so we can size the page column to the |
494 // size of the leftover space after packing the other columns. | 500 // size of the leftover space after packing the other columns. |
495 g_signal_connect(treeview_, "realize", | 501 g_signal_connect(treeview_, "realize", |
496 G_CALLBACK(OnTreeViewRealizeThunk), this); | 502 G_CALLBACK(OnTreeViewRealizeThunk), this); |
497 // If we previously saved the dialog's bounds, use them. | 503 // If we previously saved the dialog's bounds, use them. |
498 if (g_browser_process->local_state()) { | 504 if (g_browser_process->local_state()) { |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 guint keyval, | 963 guint keyval, |
958 GdkModifierType modifier) { | 964 GdkModifierType modifier) { |
959 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { | 965 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { |
960 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget | 966 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget |
961 // is destroyed. The deleted object will receive gtk signals otherwise. | 967 // is destroyed. The deleted object will receive gtk signals otherwise. |
962 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); | 968 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); |
963 } | 969 } |
964 | 970 |
965 return TRUE; | 971 return TRUE; |
966 } | 972 } |
OLD | NEW |