Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.85 KB | None | 0 0
  1. diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c
  2. index eba51c0..33be80a 100644
  3. --- a/src/empathy-debug-window.c
  4. +++ b/src/empathy-debug-window.c
  5. @@ -84,6 +84,7 @@ typedef struct
  6. /* Toolbar items */
  7. GtkWidget *chooser;
  8. GtkToolItem *save_button;
  9. + GtkToolItem *save_all_button;
  10. GtkToolItem *copy_button;
  11. GtkToolItem *clear_button;
  12. GtkToolItem *pause_button;
  13. @@ -156,6 +157,12 @@ typedef struct
  14. gchar *message;
  15. } DebugMessage;
  16.  
  17. +typedef struct
  18. +{
  19. + EmpathyDebugWindow *debug_window;
  20. + gchar *service_name;
  21. +} GetMessagesServiceUserData;
  22. +
  23. static DebugMessage *
  24. debug_message_new (gdouble timestamp,
  25. const gchar *domain,
  26. @@ -228,8 +235,28 @@ debug_window_cache_new_message (EmpathyDebugWindow *debug_window,
  27. }
  28.  
  29. static void
  30. +split_domain_category (const gchar *domain_category,
  31. + gchar **domain_ptr,
  32. + gchar **category_ptr)
  33. +{
  34. + if (g_strrstr (domain_category, "/"))
  35. + {
  36. + gchar **parts = g_strsplit (domain_category, "/", 2);
  37. + *domain_ptr = g_strdup (parts[0]);
  38. + *category_ptr = g_strdup (parts[1]);
  39. + g_strfreev (parts);
  40. + }
  41. + else
  42. + {
  43. + *domain_ptr = g_strdup (domain_category);
  44. + *category_ptr = g_strdup ("");
  45. + }
  46. +}
  47. +
  48. +static void
  49. debug_window_add_message (EmpathyDebugWindow *debug_window,
  50. - gboolean should_cache,
  51. + gboolean store_to_cache,
  52. + gboolean store_to_UI,
  53. gdouble timestamp,
  54. const gchar *domain_category,
  55. guint level,
  56. @@ -240,38 +267,30 @@ debug_window_add_message (EmpathyDebugWindow *debug_window,
  57. GtkTreeIter iter;
  58. gchar *string;
  59.  
  60. - if (should_cache)
  61. + if (store_to_cache)
  62. debug_window_cache_new_message (debug_window, timestamp, domain_category,
  63. level, message);
  64.  
  65. - if (g_strrstr (domain_category, "/"))
  66. - {
  67. - gchar **parts = g_strsplit (domain_category, "/", 2);
  68. - domain = g_strdup (parts[0]);
  69. - category = g_strdup (parts[1]);
  70. - g_strfreev (parts);
  71. - }
  72. - else
  73. + if (store_to_UI)
  74. {
  75. - domain = g_strdup (domain_category);
  76. - category = g_strdup ("");
  77. - }
  78. + split_domain_category (domain_category, &domain, &category);
  79.  
  80. - if (g_str_has_suffix (message, "\n"))
  81. - string = g_strchomp (g_strdup (message));
  82. - else
  83. - string = g_strdup (message);
  84. + if (g_str_has_suffix (message, "\n"))
  85. + string = g_strchomp (g_strdup (message));
  86. + else
  87. + string = g_strdup (message);
  88.  
  89.  
  90. - gtk_list_store_append (priv->store, &iter);
  91. - gtk_list_store_set (priv->store, &iter,
  92. - COL_DEBUG_TIMESTAMP, timestamp,
  93. - COL_DEBUG_DOMAIN, domain,
  94. - COL_DEBUG_CATEGORY, category,
  95. - COL_DEBUG_LEVEL_STRING, log_level_to_string (level),
  96. - COL_DEBUG_MESSAGE, string,
  97. - COL_DEBUG_LEVEL_VALUE, level,
  98. - -1);
  99. + gtk_list_store_append (priv->store, &iter);
  100. + gtk_list_store_set (priv->store, &iter,
  101. + COL_DEBUG_TIMESTAMP, timestamp,
  102. + COL_DEBUG_DOMAIN, domain,
  103. + COL_DEBUG_CATEGORY, category,
  104. + COL_DEBUG_LEVEL_STRING, log_level_to_string (level),
  105. + COL_DEBUG_MESSAGE, string,
  106. + COL_DEBUG_LEVEL_VALUE, level,
  107. + -1);
  108. + }
  109.  
  110. g_free (string);
  111. g_free (domain);
  112. @@ -289,7 +308,7 @@ debug_window_new_debug_message_cb (TpProxy *proxy,
  113. {
  114. EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data;
  115.  
  116. - debug_window_add_message (debug_window, TRUE, timestamp, domain, level,
  117. + debug_window_add_message (debug_window, TRUE, TRUE, timestamp, domain, level,
  118. message);
  119. }
  120.  
  121. @@ -316,6 +335,7 @@ debug_window_set_toolbar_sensitivity (EmpathyDebugWindow *debug_window,
  122. GtkWidget *vbox = gtk_bin_get_child (GTK_BIN (debug_window));
  123.  
  124. gtk_widget_set_sensitive (GTK_WIDGET (priv->save_button), sensitive);
  125. + gtk_widget_set_sensitive (GTK_WIDGET (priv->save_all_button), sensitive);
  126. gtk_widget_set_sensitive (GTK_WIDGET (priv->copy_button), sensitive);
  127. gtk_widget_set_sensitive (GTK_WIDGET (priv->clear_button), sensitive);
  128. gtk_widget_set_sensitive (GTK_WIDGET (priv->pause_button), sensitive);
  129. @@ -341,15 +361,16 @@ debug_window_set_toolbar_sensitivity (EmpathyDebugWindow *debug_window,
  130. }
  131.  
  132. static void
  133. -debug_window_get_messages_cb (TpProxy *proxy,
  134. +debug_window_get_messages (TpProxy *proxy,
  135. const GPtrArray *messages,
  136. const GError *error,
  137. gpointer user_data,
  138. - GObject *weak_object)
  139. + gchar *name,
  140. + gboolean store_to_cache,
  141. + gboolean store_to_UI)
  142. {
  143. EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data;
  144. EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
  145. - gchar *name;
  146. GList *old_messages;
  147. guint i;
  148.  
  149. @@ -362,7 +383,6 @@ debug_window_get_messages_cb (TpProxy *proxy,
  150.  
  151. debug_window_set_toolbar_sensitivity (debug_window, TRUE);
  152.  
  153. - name = get_active_service_name (debug_window);
  154. old_messages = g_hash_table_lookup (priv->cache, name);
  155.  
  156. /* we call get_messages either when a new CM is added or
  157. @@ -375,11 +395,12 @@ debug_window_get_messages_cb (TpProxy *proxy,
  158. debug_message_list_free (old_messages);
  159. }
  160.  
  161. + /* Adding each message in messages to cache and/or UI store */
  162. for (i = 0; i < messages->len; i++)
  163. {
  164. GValueArray *values = g_ptr_array_index (messages, i);
  165.  
  166. - debug_window_add_message (debug_window, TRUE,
  167. + debug_window_add_message (debug_window, store_to_cache, store_to_UI,
  168. g_value_get_double (g_value_array_get_nth (values, 0)),
  169. g_value_get_string (g_value_array_get_nth (values, 1)),
  170. g_value_get_uint (g_value_array_get_nth (values, 2)),
  171. @@ -396,6 +417,38 @@ debug_window_get_messages_cb (TpProxy *proxy,
  172. }
  173.  
  174. static void
  175. +debug_window_get_messages_cb (TpProxy *proxy,
  176. + const GPtrArray *messages,
  177. + const GError *error,
  178. + gpointer user_data,
  179. + GObject *weak_object)
  180. +{
  181. + GetMessagesServiceUserData *service_data = (GetMessagesServiceUserData *) user_data;
  182. + EmpathyDebugWindow *debug_window = service_data->debug_window;
  183. + gchar *name = service_data->service_name;
  184. +
  185. + debug_window_get_messages(proxy, messages, error,
  186. + debug_window, name, TRUE, TRUE);
  187. + g_free (name);
  188. +}
  189. +
  190. +static void
  191. +debug_window_get_all_services_messages_cb (TpProxy *proxy,
  192. + const GPtrArray *messages,
  193. + const GError *error,
  194. + gpointer user_data,
  195. + GObject *weak_object)
  196. +{
  197. + GetMessagesServiceUserData *service_data = (GetMessagesServiceUserData *) user_data;
  198. + EmpathyDebugWindow *debug_window = service_data->debug_window;
  199. + gchar *name = service_data->service_name;
  200. +
  201. + debug_window_get_messages(proxy, messages, error,
  202. + debug_window, name, TRUE, FALSE);
  203. + g_free (name);
  204. +}
  205. +
  206. +static void
  207. debug_window_add_log_messages_from_cache (EmpathyDebugWindow *debug_window,
  208. const gchar *name)
  209. {
  210. @@ -414,8 +467,8 @@ debug_window_add_log_messages_from_cache (EmpathyDebugWindow *debug_window,
  211. {
  212. dm = l->data;
  213.  
  214. - debug_window_add_message (debug_window, FALSE, dm->timestamp,
  215. - dm->domain, dm->level, dm->message);
  216. + debug_window_add_message (debug_window, FALSE, TRUE,
  217. + dm->timestamp, dm->domain, dm->level, dm->message);
  218. }
  219. }
  220.  
  221. @@ -433,41 +486,16 @@ proxy_invalidated_cb (TpProxy *proxy,
  222. }
  223.  
  224. static void
  225. -debug_window_service_chooser_changed_cb (GtkComboBox *chooser,
  226. - EmpathyDebugWindow *debug_window)
  227. +create_proxy_to_get_messages (EmpathyDebugWindow *debug_window,
  228. + GtkTreeIter iter, emp_cli_debug_callback_for_get_messages get_messages_cb)
  229. {
  230. EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
  231. TpDBusDaemon *dbus;
  232. - GError *error = NULL;
  233. - gchar *bus_name, *name = NULL;
  234. TpProxy *proxy;
  235. - GtkTreeIter iter;
  236. - gboolean gone;
  237. -
  238. - if (!gtk_combo_box_get_active_iter (chooser, &iter))
  239. - {
  240. - DEBUG ("No CM is selected");
  241. - if (gtk_tree_model_iter_n_children (
  242. - GTK_TREE_MODEL (priv->service_store), NULL) > 0)
  243. - {
  244. - gtk_combo_box_set_active (chooser, 0);
  245. - }
  246. - return;
  247. - }
  248. -
  249. - gtk_list_store_clear (priv->store);
  250. -
  251. - gtk_tree_model_get (GTK_TREE_MODEL (priv->service_store), &iter,
  252. - COL_NAME, &name, COL_GONE, &gone, -1);
  253. -
  254. - if (gone)
  255. - {
  256. - debug_window_add_log_messages_from_cache (debug_window, name);
  257. - g_free (name);
  258. - return;
  259. - }
  260. -
  261. - g_free (name);
  262. + GError *error = NULL;
  263. + gchar *bus_name = NULL;
  264. + gchar *name = NULL;
  265. + GetMessagesServiceUserData *user_data;
  266.  
  267. dbus = tp_dbus_daemon_dup (&error);
  268.  
  269. @@ -506,8 +534,13 @@ debug_window_service_chooser_changed_cb (GtkComboBox *chooser,
  270.  
  271. tp_proxy_add_interface_by_id (priv->proxy, emp_iface_quark_debug ());
  272.  
  273. + gtk_tree_model_get (GTK_TREE_MODEL (priv->service_store), &iter,
  274. + COL_NAME, &name, -1);
  275. + user_data = g_slice_new0 (GetMessagesServiceUserData);
  276. + user_data->debug_window = debug_window;
  277. + user_data->service_name = name;
  278. emp_cli_debug_call_get_messages (priv->proxy, -1,
  279. - debug_window_get_messages_cb, debug_window, NULL, NULL);
  280. + get_messages_cb, user_data, NULL, NULL);
  281.  
  282. priv->invalid_signal_id = g_signal_connect (proxy, "invalidated",
  283. G_CALLBACK (proxy_invalidated_cb), debug_window);
  284. @@ -515,6 +548,44 @@ debug_window_service_chooser_changed_cb (GtkComboBox *chooser,
  285. g_object_unref (dbus);
  286. }
  287.  
  288. +static void
  289. +debug_window_service_chooser_changed_cb (GtkComboBox *chooser,
  290. + EmpathyDebugWindow *debug_window)
  291. +{
  292. + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
  293. + gchar *name = NULL;
  294. + GtkTreeIter iter;
  295. + gboolean gone;
  296. +
  297. + if (!gtk_combo_box_get_active_iter (chooser, &iter))
  298. + {
  299. + DEBUG ("No CM is selected");
  300. + if (gtk_tree_model_iter_n_children (
  301. + GTK_TREE_MODEL (priv->service_store), NULL) > 0)
  302. + {
  303. + gtk_combo_box_set_active (chooser, 0);
  304. + }
  305. + return;
  306. + }
  307. +
  308. + gtk_list_store_clear (priv->store);
  309. +
  310. + gtk_tree_model_get (GTK_TREE_MODEL (priv->service_store), &iter,
  311. + COL_NAME, &name, COL_GONE, &gone, -1);
  312. +
  313. + if (gone)
  314. + {
  315. + debug_window_add_log_messages_from_cache (debug_window, name);
  316. + g_free (name);
  317. + return;
  318. + }
  319. +
  320. + g_free (name);
  321. +
  322. + create_proxy_to_get_messages (debug_window, iter,
  323. + (emp_cli_debug_callback_for_get_messages) debug_window_get_messages_cb);
  324. +}
  325. +
  326. typedef struct
  327. {
  328. const gchar *name;
  329. @@ -1110,55 +1181,70 @@ debug_window_time_formatter (GtkTreeViewColumn *tree_column,
  330. g_free (time_str);
  331. }
  332.  
  333. -static gboolean
  334. -debug_window_store_filter_foreach (GtkTreeModel *model,
  335. - GtkTreePath *path,
  336. - GtkTreeIter *iter,
  337. - gpointer user_data)
  338. +static GFileOutputStream *
  339. +get_file_output_stream (const char *filename)
  340. {
  341. - GFileOutputStream *output_stream = (GFileOutputStream *) user_data;
  342. - gchar *domain, *category, *message, *level_str, *level_upper;
  343. - gdouble timestamp;
  344. - gchar *line, *time_str;
  345. + GFile *gfile = NULL;
  346. GError *error = NULL;
  347. - gboolean out = FALSE;
  348. -
  349. - gtk_tree_model_get (model, iter,
  350. - COL_DEBUG_TIMESTAMP, &timestamp,
  351. - COL_DEBUG_DOMAIN, &domain,
  352. - COL_DEBUG_CATEGORY, &category,
  353. - COL_DEBUG_LEVEL_STRING, &level_str,
  354. - COL_DEBUG_MESSAGE, &message,
  355. - -1);
  356. + GFileOutputStream *output_stream = NULL;
  357.  
  358. - level_upper = g_ascii_strup (level_str, -1);
  359. + gfile = g_file_new_for_path (filename);
  360. + output_stream = g_file_replace (gfile, NULL, FALSE,
  361. + G_FILE_CREATE_NONE, NULL, &error);
  362.  
  363. - time_str = debug_window_format_timestamp (timestamp);
  364. + if (error != NULL)
  365. + {
  366. + DEBUG ("Failed to open file for writing: %s", error->message);
  367. + g_error_free (error);
  368. + }
  369.  
  370. - line = g_strdup_printf ("%s%s%s-%s: %s: %s\n",
  371. - domain, EMP_STR_EMPTY (category) ? "" : "/",
  372. - category, level_upper, time_str, message);
  373. + g_object_unref (gfile);
  374. + return output_stream;
  375. +}
  376.  
  377. - g_free (time_str);
  378. +static void
  379. +save_one_service_from_cache (const gchar *name,
  380. + GList *messages,
  381. + GFileOutputStream *output_stream)
  382. +{
  383. + GList *l;
  384. + gchar *domain, *category, *time_str, *line, *level_upper;
  385. + DebugMessage *dm;
  386. + GError *error = NULL;
  387.  
  388. - g_output_stream_write (G_OUTPUT_STREAM (output_stream), line,
  389. - strlen (line), NULL, &error);
  390. + if (messages == NULL)
  391. + return;
  392.  
  393. - if (error != NULL)
  394. + for (l = messages; l != NULL; l = l->next)
  395. {
  396. - DEBUG ("Failed to write to file: %s", error->message);
  397. - g_error_free (error);
  398. - out = TRUE;
  399. - }
  400. + dm = l->data;
  401.  
  402. - g_free (line);
  403. - g_free (level_upper);
  404. - g_free (level_str);
  405. - g_free (domain);
  406. - g_free (category);
  407. - g_free (message);
  408. + split_domain_category (dm->domain, &domain, &category);
  409. +
  410. + level_upper = g_ascii_strup (log_level_to_string (dm->level), -1);
  411. +
  412. + time_str = debug_window_format_timestamp (dm->timestamp);
  413. +
  414. + line = g_strdup_printf ("%s%s%s-%s: %s: %s\n",
  415. + domain, EMP_STR_EMPTY (category) ? "" : "/",
  416. + category, level_upper, time_str, dm->message);
  417.  
  418. - return out;
  419. + g_free (time_str);
  420. +
  421. + g_output_stream_write (G_OUTPUT_STREAM (output_stream), line,
  422. + strlen (line), NULL, &error);
  423. +
  424. + if (error != NULL)
  425. + {
  426. + DEBUG ("Failed to write CM %s debug data to file: %s", name, error->message);
  427. + g_error_free (error);
  428. + }
  429. +
  430. + g_free (line);
  431. + g_free (level_upper);
  432. + g_free (domain);
  433. + g_free (category);
  434. + }
  435. }
  436.  
  437. static void
  438. @@ -1167,56 +1253,100 @@ debug_window_save_file_chooser_response_cb (GtkDialog *dialog,
  439. EmpathyDebugWindow *debug_window)
  440. {
  441. EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
  442. + GList *messages;
  443. gchar *filename = NULL;
  444. - GFile *gfile = NULL;
  445. + const gchar *name;
  446. GFileOutputStream *output_stream = NULL;
  447. - GError *error = NULL;
  448.  
  449. if (response_id != GTK_RESPONSE_ACCEPT)
  450. goto OUT;
  451.  
  452. - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
  453. + /* getting cached message list for active service */
  454. + name = get_active_service_name (debug_window);
  455. + messages = g_hash_table_lookup (priv->cache, name);
  456.  
  457. - DEBUG ("Saving log as %s", filename);
  458. + /* getting output stream */
  459. + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
  460.  
  461. - gfile = g_file_new_for_path (filename);
  462. - output_stream = g_file_replace (gfile, NULL, FALSE,
  463. - G_FILE_CREATE_NONE, NULL, &error);
  464. + DEBUG ("Saving log for CM %s in %s",name, filename);
  465.  
  466. - if (error != NULL)
  467. + output_stream = get_file_output_stream (filename);
  468. + if (output_stream == NULL)
  469. {
  470. - DEBUG ("Failed to open file for writing: %s", error->message);
  471. - g_error_free (error);
  472. goto OUT;
  473. }
  474.  
  475. - gtk_tree_model_foreach (priv->store_filter,
  476. - debug_window_store_filter_foreach, output_stream);
  477. + /* writing list to output stream */
  478. + save_one_service_from_cache (name, messages, output_stream);
  479.  
  480. OUT:
  481. - if (gfile != NULL)
  482. - g_object_unref (gfile);
  483. + if (output_stream != NULL)
  484. + g_object_unref (output_stream);
  485. +
  486. + g_free (filename);
  487. +
  488. + gtk_widget_destroy (GTK_WIDGET (dialog));
  489. +}
  490. +
  491. +static void
  492. +debug_window_save_all_file_chooser_response_cb (GtkDialog *dialog,
  493. + gint response_id,
  494. + EmpathyDebugWindow *debug_window)
  495. +{
  496. + EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
  497. + gchar *filename = NULL;
  498. + GtkTreeIter iter;
  499. + GFileOutputStream *output_stream = NULL;
  500. +
  501. + if (response_id != GTK_RESPONSE_ACCEPT)
  502. + goto OUT;
  503. +
  504. + /* Getting output stream */
  505. + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
  506.  
  507. + DEBUG ("Saving all services' logs in %s", filename);
  508. +
  509. + output_stream = get_file_output_stream (filename);
  510. + if (output_stream == NULL)
  511. + {
  512. + goto OUT;
  513. + }
  514. +
  515. + /* Loading cache with messages for each service */
  516. + gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->service_store), &iter);
  517. + while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->service_store), &iter))
  518. + {
  519. + create_proxy_to_get_messages (debug_window, iter,
  520. + (emp_cli_debug_callback_for_get_messages)
  521. + debug_window_get_all_services_messages_cb);
  522. + }
  523. +
  524. + /* Writing cached messages for each service to log */
  525. + g_hash_table_foreach (priv->cache, (GHFunc) save_one_service_from_cache,
  526. + output_stream);
  527. +
  528. +OUT:
  529. if (output_stream != NULL)
  530. g_object_unref (output_stream);
  531.  
  532. - if (filename != NULL)
  533. - g_free (filename);
  534. + g_free (filename);
  535.  
  536. gtk_widget_destroy (GTK_WIDGET (dialog));
  537. }
  538.  
  539. static void
  540. -debug_window_save_clicked_cb (GtkToolButton *tool_button,
  541. +create_save_file_chooser (gchar *title,
  542. + gchar *name,
  543. + GCallback file_chooser_response_cb,
  544. EmpathyDebugWindow *debug_window)
  545. {
  546. GtkWidget *file_chooser;
  547. - gchar *name, *tmp = NULL;
  548. + gchar *tmp = NULL;
  549. char time_str[32];
  550. time_t t;
  551. struct tm *tm_s;
  552.  
  553. - file_chooser = gtk_file_chooser_dialog_new (_("Save"),
  554. + file_chooser = gtk_file_chooser_dialog_new (_(title),
  555. GTK_WINDOW (debug_window), GTK_FILE_CHOOSER_ACTION_SAVE,
  556. GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
  557. GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
  558. @@ -1229,8 +1359,6 @@ debug_window_save_clicked_cb (GtkToolButton *tool_button,
  559. gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_chooser),
  560. g_get_tmp_dir ());
  561.  
  562. - name = get_active_service_name (debug_window);
  563. -
  564. t = time (NULL);
  565. tm_s = localtime (&t);
  566. if (tm_s != NULL)
  567. @@ -1241,18 +1369,38 @@ debug_window_save_clicked_cb (GtkToolButton *tool_button,
  568.  
  569. if (tmp == NULL)
  570. tmp = g_strdup_printf ("%s.log", name);
  571. - g_free (name);
  572.  
  573. gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (file_chooser), tmp);
  574. g_free (tmp);
  575.  
  576. g_signal_connect (file_chooser, "response",
  577. - G_CALLBACK (debug_window_save_file_chooser_response_cb),
  578. + file_chooser_response_cb,
  579. debug_window);
  580.  
  581. gtk_widget_show (file_chooser);
  582. }
  583.  
  584. +static void
  585. +debug_window_save_clicked_cb (GtkToolButton *tool_button,
  586. + EmpathyDebugWindow *debug_window)
  587. +{
  588. + gchar *name;
  589. + name = get_active_service_name (debug_window);
  590. +
  591. + create_save_file_chooser("Save", name,
  592. + G_CALLBACK (debug_window_save_file_chooser_response_cb), debug_window);
  593. +}
  594. +
  595. +static void
  596. +debug_window_save_all_clicked_cb (GtkToolButton *tool_button,
  597. + EmpathyDebugWindow *debug_window)
  598. +{
  599. + gchar *name = "empathy_debug_full";
  600. +
  601. + create_save_file_chooser("Save all", name,
  602. + G_CALLBACK (debug_window_save_all_file_chooser_response_cb), debug_window);
  603. +}
  604. +
  605. static gboolean
  606. debug_window_copy_model_foreach (GtkTreeModel *model,
  607. GtkTreePath *path,
  608. @@ -1440,6 +1588,17 @@ am_prepared_cb (GObject *am,
  609. gtk_tool_item_set_is_important (GTK_TOOL_ITEM (priv->save_button), TRUE);
  610. gtk_toolbar_insert (GTK_TOOLBAR (toolbar), priv->save_button, -1);
  611.  
  612. + /* Save all */
  613. + image = gtk_image_new_from_stock (GTK_STOCK_SAVE,
  614. + GTK_ICON_SIZE_MENU);
  615. + gtk_widget_show (image);
  616. + priv->save_all_button = gtk_tool_button_new (image, _("Save all"));
  617. + g_signal_connect (priv->save_all_button, "clicked",
  618. + G_CALLBACK (debug_window_save_all_clicked_cb), object);
  619. + gtk_widget_show (GTK_WIDGET (priv->save_all_button));
  620. + gtk_tool_item_set_is_important (GTK_TOOL_ITEM (priv->save_all_button), TRUE);
  621. + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), priv->save_all_button, -1);
  622. +
  623. /* Copy */
  624. priv->copy_button = gtk_tool_button_new_from_stock (GTK_STOCK_COPY);
  625. g_signal_connect (priv->copy_button, "clicked",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement