pidgin/gtkdebug.c

branch
gtkdoc-conversion
changeset 35500
ae6432ea326f
parent 35454
cf2a24d01503
child 35506
4252b2882889
equal deleted inserted replaced
35499:c4c5e0a670b1 35500:ae6432ea326f
105 if ((fp = g_fopen(filename, "w+")) == NULL) { 105 if ((fp = g_fopen(filename, "w+")) == NULL) {
106 purple_notify_error(win, NULL, _("Unable to open file."), NULL, NULL); 106 purple_notify_error(win, NULL, _("Unable to open file."), NULL, NULL);
107 return; 107 return;
108 } 108 }
109 109
110 tmp = gtk_webview_get_body_text(GTK_WEBVIEW(win->text)); 110 tmp = pidgin_webview_get_body_text(PIDGIN_WEBVIEW(win->text));
111 fprintf(fp, "Pidgin Debug Log : %s\n", purple_date_format_full(NULL)); 111 fprintf(fp, "Pidgin Debug Log : %s\n", purple_date_format_full(NULL));
112 fprintf(fp, "%s", tmp); 112 fprintf(fp, "%s", tmp);
113 g_free(tmp); 113 g_free(tmp);
114 114
115 fclose(fp); 115 fclose(fp);
123 } 123 }
124 124
125 static void 125 static void
126 clear_cb(GtkWidget *w, DebugWindow *win) 126 clear_cb(GtkWidget *w, DebugWindow *win)
127 { 127 {
128 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "clear();"); 128 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "clear();");
129 } 129 }
130 130
131 static void 131 static void
132 pause_cb(GtkWidget *w, DebugWindow *win) 132 pause_cb(GtkWidget *w, DebugWindow *win)
133 { 133 {
134 win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w)); 134 win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w));
135 135
136 if (win->paused) 136 if (win->paused)
137 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "pauseOutput();"); 137 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "pauseOutput();");
138 else 138 else
139 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "resumeOutput();"); 139 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "resumeOutput();");
140 } 140 }
141 141
142 /****************************************************************************** 142 /******************************************************************************
143 * regex stuff 143 * regex stuff
144 *****************************************************************************/ 144 *****************************************************************************/
183 } 183 }
184 184
185 static void 185 static void
186 regex_toggle_filter(DebugWindow *win, gboolean filter) 186 regex_toggle_filter(DebugWindow *win, gboolean filter)
187 { 187 {
188 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "regex.clear();"); 188 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "regex.clear();");
189 189
190 if (filter) { 190 if (filter) {
191 const char *text; 191 const char *text;
192 char *regex; 192 char *regex;
193 char *script; 193 char *script;
194 194
195 text = gtk_entry_get_text(GTK_ENTRY(win->expression)); 195 text = gtk_entry_get_text(GTK_ENTRY(win->expression));
196 regex = gtk_webview_quote_js_string(text); 196 regex = pidgin_webview_quote_js_string(text);
197 script = g_strdup_printf("regex.filterAll(%s, %s, %s);", 197 script = g_strdup_printf("regex.filterAll(%s, %s, %s);",
198 regex, 198 regex,
199 win->invert ? "true" : "false", 199 win->invert ? "true" : "false",
200 win->highlight ? "true" : "false"); 200 win->highlight ? "true" : "false");
201 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), script); 201 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), script);
202 g_free(script); 202 g_free(script);
203 g_free(regex); 203 g_free(regex);
204 } 204 }
205 } 205 }
206 206
359 359
360 if (level != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel))) 360 if (level != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel)))
361 gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), level); 361 gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), level);
362 362
363 tmp = g_strdup_printf("setFilterLevel('%d');", level); 363 tmp = g_strdup_printf("setFilterLevel('%d');", level);
364 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), tmp); 364 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), tmp);
365 g_free(tmp); 365 g_free(tmp);
366 } 366 }
367 367
368 static void 368 static void
369 filter_level_changed_cb(GtkWidget *combo, gpointer null) 369 filter_level_changed_cb(GtkWidget *combo, gpointer null)
597 G_CALLBACK(filter_level_changed_cb), NULL); 597 G_CALLBACK(filter_level_changed_cb), NULL);
598 } 598 }
599 599
600 /* Add the gtkwebview */ 600 /* Add the gtkwebview */
601 frame = pidgin_create_webview(FALSE, &win->text, NULL); 601 frame = pidgin_create_webview(FALSE, &win->text, NULL);
602 gtk_webview_set_format_functions(GTK_WEBVIEW(win->text), 602 pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(win->text),
603 GTK_WEBVIEW_ALL ^ GTK_WEBVIEW_SMILEY ^ GTK_WEBVIEW_IMAGE); 603 PIDGIN_WEBVIEW_ALL ^ PIDGIN_WEBVIEW_SMILEY ^ PIDGIN_WEBVIEW_IMAGE);
604 gtk_webview_load_html_string(GTK_WEBVIEW(win->text), gtkdebug_html); 604 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(win->text), gtkdebug_html);
605 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); 605 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
606 gtk_widget_show(frame); 606 gtk_widget_show(frame);
607 607
608 clear_cb(NULL, win); 608 clear_cb(NULL, win);
609 609
790 790
791 js = g_strdup_printf("append(%d, '%s', '%s', %s);", 791 js = g_strdup_printf("append(%d, '%s', '%s', %s);",
792 level, mdate, category ? category : "", esc_s); 792 level, mdate, category ? category : "", esc_s);
793 g_free(esc_s); 793 g_free(esc_s);
794 794
795 gtk_webview_safe_execute_script(GTK_WEBVIEW(debug_win->text), js); 795 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(debug_win->text), js);
796 g_free(js); 796 g_free(js);
797 } 797 }
798 798
799 static gboolean 799 static gboolean
800 pidgin_debug_is_enabled(PurpleDebugLevel level, const char *category) 800 pidgin_debug_is_enabled(PurpleDebugLevel level, const char *category)

mercurial